Exemplo n.º 1
0
 public void Connect()
 {
     lock (locker)
     {
         MdApi.MD_Connect();
     }
 }
Exemplo n.º 2
0
 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);
         }
     }
 }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            MdApi.CTP_ReadConfigFile("F:\\CTP-MATLAB\\bin\\ConfigFile.xml");

            MdApi.CTP_RegMDOnConnect(OnConnect);
            MdApi.CTP_RegOnRtnDepthMarketData_Tick(OnRtnDepthMarketData_Tick);
            MdApi.MD_Connect();
            TdApi.TD_Connect();

            while (true)
            {
            }
        }
Exemplo n.º 4
0
        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);
            }
        }
Exemplo n.º 5
0
        //建立行情
        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);
                }
            }
        }
Exemplo n.º 6
0
        //建立行情
        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);
                }
            }
        }