Exemple #1
0
 //重载OnRecvDataMsg方法,接收行情数据
 // 请注意:
 //  1. 不要在这个函数里做耗时操作
 //  2. 只在这个函数里做数据获取工作 -- 将数据复制到其它数据缓存区,由其它线程做业务逻辑处理
 public override void OnRecvDataMsg(TDFMSG msg)
 {
     if (msg.MsgID == TDFMSGID.MSG_DATA_MARKET)
     {
         //行情消息
         TDFMarketData[] marketDataArr = msg.Data as TDFMarketData[];
         MarketDataCache.Enqueue(marketDataArr);
     }
     else if (msg.MsgID == TDFMSGID.MSG_DATA_TRANSACTION)
     {
         //逐笔成交
         TDFTransaction[] transactionDataArr = msg.Data as TDFTransaction[];
         TransactionCache.Enqueue(transactionDataArr);
     }
     else if (msg.MsgID == TDFMSGID.MSG_DATA_ORDER)
     {
         //逐笔委托
         TDFOrder[] orderDataArr = msg.Data as TDFOrder[];
         OrderCache.Enqueue(orderDataArr);
     }
     else if (msg.MsgID == TDFMSGID.MSG_DATA_ORDERQUEUE)
     {
         //委托队列
         TDFOrderQueue[] orderQueueDataArr = msg.Data as TDFOrderQueue[];
         OrderQueueCache.Enqueue(orderQueueDataArr);
     }
 }