Transcript
  • API

  • Api

  • ApiApiApiApiTcpApiTcpUdpThostApiTraderApi ApiMdUserApi2ApiApi

  • - Api3Thost1

    Thost

    Thost

  • 3enum THOST_TE_RESUME_TYPE{// THOST_TERT_RESTART = 0,// THOST_TERT_RESUME,// THOST_TERT_QUICK};

  • - MdUserApiQuick

  • - TraderApi testTraderApi

    MdUserApi testMdUserApi

  • - TraderApiThostFtdcTraderApi.hCThostFtdcUserApiCThostFtdcUserSpiThostFtdcUserApiStruct.hThostFtdcUserApiDataType.hthosttraderapi.libthosttraderapi.dll

    MdUserApiThostFtdcMdApi.hCThostFtdcMdApiCThostFtdcMdSpiThostFtdcUserApiStruct.hThostFtdcUserApiDataType.hTraderApithostMdapi.libthostMdapi.dll

  • - ApiReq***, OnRsp***ReqUserLoginOnRspUserLogin

    ReqQry***OnRspQry***ReqQryInstrumentOnRspQryInstrument

    OnRtn***OnRtnOrderOnRtnTrade

    OnErrRtn***OnErrRtnOrderInsertOnErrRtnOrderAction

  • /virtual int ReqQryInstrument(CThostFtdcQryInstrumentField *pQryInstrument, int nRequestID) = 0;

    virtual void OnRspQryInstrument(CThostFtdcInstrumentField *pInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};

  • /ExchangeID

    RequestIDRequestIDTraderApiRequestIDTraderApiRequestID/

    0RspInfoRspInfoRspInfo0RspInfo1IsLastIsLasttrue

  • FrontID + SessionID + OrderRefFrontID, SessionID MaxOrderRefOrderRef OrderRefMaxOrderRefOrderRefThostOrderRefBrokerID + BrokerOrderSeqThost1exchangeID + traderID + OrderLocalIDexchangeID + OrderSysID

    OrderRefOrderSysID

  • ReqUserLogin()()ThostFrontID+SessionID+MaxOrderRef

  • 1(ReqQrySettlementInfo)(ReqSettlementInfoConfirm)Thost(ReqQrySettlementInfoConfirm)

  • ReqOrderInsert

    ///fldOrder.VolumeCondition = THOST_FTDC_VC_AV;/// 1fldOrder.MinVolume = 1;/// fldOrder.ForceCloseReason = THOST_FTDC_FCC_NotForceClose;/// fldOrder.IsAutoSuspend = 1;///fldOrder.UserForceClose = 0;

  • /// OrderPriceType = THOST_FTDC_OPT_LimitPrice;/// LimitPrice = ;/// TimeCondition = THOST_FTDC_TC_GFD;/// fldOrder.OrderPriceType = THOST_FTDC_OPT_AnyPrice;///0fldOrder.LimitPrice = 0;///fldOrder.TimeCondition = THOST_FTDC_TC_IOC;

    ///ContingentCondition = ; ///StopPrice = ;/// OrderPriceType = THOST_FTDC_OPT_LimitPrice;/// LimitPrice = ;/// TimeCondition = THOST_FTDC_TC_GFD;

  • THOST_FTDC_OF_CloseTHOST_FTDC_OF_CloseTodayTHOST_FTDC_OF_CloseThostOnRspOrderInsertThostOnRspOrderInserOnRtnOrder OnRtnOrderOnRtnTradeOnErrRtnOrder

  • ReqOrderAction/// /// OrderRef,ThostOrderActionRef/// ActionFlag = THOST_FTDC_AF_Delete/// FrontID +SessionID+OrderRefExchangID+OrderSysID/// BrokerIDUserID,InvestorIDInstrumentID

    ThostOnRspOrderAction

    ThostOnRspOrderActionOnRtnOrder

    OnRtnOrder

    OnErrRtnOrderAction

    2

  • - OnRtnOrder()

    FrontID + SessionID + OrderRefBrokerID + BrokerOrderSeqExchangeID + TraderID + LocalOrderIDExchangeID + OrderSysID ///TFtdcOrderStatusType///#define THOST_FTDC_OST_AllTraded '0'///#define THOST_FTDC_OST_PartTradedQueueing '1'///#define THOST_FTDC_OST_PartTradedNotQueueing '2'///#define THOST_FTDC_OST_NoTradeQueueing '3'///#define THOST_FTDC_OST_NoTradeNotQueueing '4'///#define THOST_FTDC_OST_Canceled '5'///#define THOST_FTDC_OST_Unknown 'a'///#define THOST_FTDC_OST_NotTouched 'b'

  • OnRtnTrade()

    BrokerID + BrokerOrderSeqExchangeID + TraderID + LocalOrderIDExchangeID + OrderSysID

  • ()/

  • /SubscribeMarketDataOnRspSubMarketDataOnRtnDepthMarketDataUnSubMarketDataOnRspUnSubMarketData

  • Qq59216315APIAPI.pdfAPI.pdf.xls.pdfCTPTradeApi.pdf/.rarwindows32/linux 64 http://202.109.110.121/api.htm