Ejemplo n.º 1
0
        public int SendOrder(
            string szInstrument,
            string szExchange,
            TZQThostFtdcDirectionType Direction,
            string szCombOffsetFlag,
            string szCombHedgeFlag,
            int VolumeTotalOriginal,
            string LimitPrice,
            TZQThostFtdcOrderPriceTypeType OrderPriceType,
            TZQThostFtdcTimeConditionType TimeCondition,
            TZQThostFtdcContingentConditionType ContingentCondition,
            double StopPrice)
        {
            if (null == m_pTdApi || IntPtr.Zero == m_pTdApi)
            {
                return(0);
            }

            return(TraderApi.TD_SendOrder(
                       m_pTdApi,
                       szInstrument,
                       szExchange,
                       Direction,
                       szCombOffsetFlag,
                       szCombHedgeFlag,
                       VolumeTotalOriginal,
                       LimitPrice,
                       OrderPriceType,
                       TimeCondition,
                       ContingentCondition,
                       StopPrice));
        }
Ejemplo n.º 2
0
 //建立行情
 private void Connect_TD()
 {
     lock (_lockTd)
     {
         if (null == m_pTdApi || IntPtr.Zero == m_pTdApi)
         {
             m_pTdApi = TraderApi.TD_CreateTdApi();
             TraderApi.CTP_RegOnErrRtnOrderAction(m_pMsgQueue, _fnOnErrRtnOrderAction_Holder);
             TraderApi.CTP_RegOnErrRtnOrderInsert(m_pMsgQueue, _fnOnErrRtnOrderInsert_Holder);
             TraderApi.CTP_RegOnRspOrderAction(m_pMsgQueue, _fnOnRspOrderAction_Holder);
             TraderApi.CTP_RegOnRspOrderInsert(m_pMsgQueue, _fnOnRspOrderInsert_Holder);
             TraderApi.CTP_RegOnRspQryDepthMarketData(m_pMsgQueue, _fnOnRspQryDepthMarketData_Holder);
             TraderApi.CTP_RegOnRspQryInstrument(m_pMsgQueue, _fnOnRspQryInstrument_Holder);
             TraderApi.CTP_RegOnRspQryInstrumentCommissionRate(m_pMsgQueue, _fnOnRspQryInstrumentCommissionRate_Holder);
             //TraderApi.CTP_RegOnRspQryInstrumentMarginRate(m_pMsgQueue, _fnOnRspQryInstrumentMarginRate_Holder);
             TraderApi.CTP_RegOnRspQryInvestorPosition(m_pMsgQueue, _fnOnRspQryInvestorPosition_Holder);
             TraderApi.CTP_RegOnRspQryOrder(m_pMsgQueue, _fnOnRspQryOrder_Holder);
             TraderApi.CTP_RegOnRspQryTrade(m_pMsgQueue, _fnOnRspQryTrade_Holder);
             TraderApi.CTP_RegOnRspQryTradingAccount(m_pMsgQueue, _fnOnRspQryTradingAccount_Holder);
             TraderApi.CTP_RegOnRtnInstrumentStatus(m_pMsgQueue, _fnOnRtnInstrumentStatus_Holder);
             TraderApi.CTP_RegOnRtnOrder(m_pMsgQueue, _fnOnRtnOrder_Holder);
             TraderApi.CTP_RegOnRtnTrade(m_pMsgQueue, _fnOnRtnTrade_Holder);
             TraderApi.TD_RegMsgQueue2TdApi(m_pTdApi, m_pMsgQueue);
             TraderApi.TD_Connect(m_pTdApi, szPath, szAddresses,
                                  szBrokerId, szInvestorId, szPassword,
                                  nResumeType,
                                  szUserProductInfo, szAuthCode);
         }
     }
 }
Ejemplo n.º 3
0
 public void ReqQryInstrumentCommissionRate(string szInstrument)
 {
     if (null == m_pTdApi || IntPtr.Zero == m_pTdApi)
     {
         return;
     }
     TraderApi.TD_ReqQryInstrumentCommissionRate(m_pTdApi, szInstrument);
 }
Ejemplo n.º 4
0
 public void ReqQryInvestorPositionDetail(string szInstrument)
 {
     if (null == m_pTdApi || IntPtr.Zero == m_pTdApi)
     {
         return;
     }
     TraderApi.TD_ReqQryInvestorPositionDetail(m_pTdApi, szInstrument);
 }
Ejemplo n.º 5
0
 public void ReqQryTradingAccount()
 {
     if (null == m_pTdApi || IntPtr.Zero == m_pTdApi)
     {
         return;
     }
     TraderApi.TD_ReqQryTradingAccount(m_pTdApi);
 }
Ejemplo n.º 6
0
        public void CancelOrder(ref CZQThostFtdcOrderField pOrder)
        {
            if (null == m_pTdApi || IntPtr.Zero == m_pTdApi)
            {
                return;
            }

            TraderApi.TD_CancelOrder(m_pTdApi, ref pOrder);
        }
Ejemplo n.º 7
0
 private void Disconnect_TD()
 {
     lock (_lockTd)
     {
         if (null != m_pTdApi && IntPtr.Zero != m_pTdApi)
         {
             TraderApi.TD_RegMsgQueue2TdApi(m_pTdApi, IntPtr.Zero);
             TraderApi.TD_ReleaseTdApi(m_pTdApi);
             m_pTdApi = IntPtr.Zero;
         }
         _bTdConnected = false;
     }
 }