private void Connect_MD() { lock (_lock) { if (null == Api || IntPtr.Zero == Api) { Api = MdApi.MD_CreateMdApi(); MdApi.CTP_RegOnRtnDepthMarketData(m_pMsgQueue, _fnOnRtnDepthMarketData_Holder); MdApi.MD_RegMsgQueue2MdApi(Api, m_pMsgQueue); MdApi.MD_Connect(Api, tempPath, string.Join(";", server.MarketData.ToArray()), server.BrokerID, account.InvestorId, account.Password); } } }
public override void Connect() { lock (locker) { base.Connect(); IntPtrKey = MdApi.MD_CreateMdApi(); MdApi.MD_RegMsgQueue2MdApi(IntPtrKey, _MsgQueue.Queue); MdApi.MD_Connect(IntPtrKey, _TempPath, _Front.MarketDataAddress, _Front.BrokerId, _Account.InvestorId, _Account.Password); } }
//建立行情 private void Connect_MD() { lock (_lockMd) { if (_bWantMdConnect && (null == m_pMdApi || IntPtr.Zero == m_pMdApi)) { m_pMdApi = MdApi.MD_CreateMdApi(); MdApi.CTP_RegOnRtnDepthMarketData(m_pMsgQueue, _fnOnRtnDepthMarketData_Holder); MdApi.MD_RegMsgQueue2MdApi(m_pMdApi, m_pMsgQueue); MdApi.MD_Connect(m_pMdApi, _newTempPath, string.Join(";", server.MarketData.ToArray()), server.BrokerID, account.InvestorId, account.Password); //向单例对象中注入操作用句柄 CTPAPI.GetInstance().__RegMdApi(m_pMdApi); } } }
//建立行情 private void Connect_MD() { lock (_lockMd) { if (_bWantMdConnect && (null == m_pMdApi || IntPtr.Zero == m_pMdApi)) { m_pMdApi = MdApi.MD_CreateMdApi(); MdApi.XSpeed_RegOnMarketData(m_pMsgQueue, _fnOnMarketData_Holder); MdApi.MD_RegMsgQueue2MdApi(m_pMdApi, m_pMsgQueue); MdApi.MD_Connect(m_pMdApi, string.Join(";", server.MarketData.ToArray()), account.InvestorId, account.Password, 0); //向单例对象中注入操作用句柄 XSpeedAPI.GetInstance().__RegMdApi(m_pMdApi); } } }