예제 #1
0
 //订阅合约
 void SubscribeInstrument(string inst)
 {
     if (inst.EndsWith("000"))
     {
         var insts = _dataProcess.Rate000.Where(n => _dataProcess.InstrumentInfo[n.Key].ProductID == inst.TrimEnd('0')).Select(n => n.Key).ToArray();
         if (insts.Count() > 0)
         {
             _q.ReqSubscribeMarketData(insts);
             return;
         }
     }
     _q.ReqSubscribeMarketData(inst);
 }
예제 #2
0
파일: Plat.cs 프로젝트: yutiansut/hf_at
 //订阅合约
 void SubscribeInstrument(string inst)
 {
     if (inst.EndsWith("000"))
     {
         var proc  = inst.TrimEnd('0').TrimEnd('_');
         var insts = _dataProcess.InstrumentInfo.Where(n => n.Value.ProductID == proc).Select(n => n.Key).ToArray();
         if (insts.Count() > 0)
         {
             _q.ReqSubscribeMarketData(insts);
             return; //订阅所有000相关的合约后退出
         }
     }
     _q.ReqSubscribeMarketData(inst);
 }
예제 #3
0
 //合约选择
 private void comboBoxInstrument_SelectedIndexChanged(object sender, EventArgs e)
 {
     //价格最小变动
     this.numericUpDownPrice.Increment     = (decimal)_t.DicInstrumentField[this.comboBoxInstrument.Text].PriceTick;
     this.numericUpDownPrice.DecimalPlaces = this.numericUpDownPrice.Increment >= 1 ? 0 : this.numericUpDownPrice.Increment.ToString().Split('.')[1].Length;
     this.numericUpDownPrice.Value         = 0; //新合约行情来的时候才会更新
     _q.ReqSubscribeMarketData(this.comboBoxInstrument.Text);
 }
예제 #4
0
 //订阅合约
 void SubscribeInstrument(string inst)
 {
     //000
     if (inst.EndsWith("000"))
     {
         var insts = _dataProcess.InstrumentInfo.Where(n => n.Value.ProductID == inst.TrimEnd('0')).Select(n => n.Value._id).ToArray();
         if (insts.Count() > 0)
         {
             _dicTick000.TryAdd(inst, new Tick
             {
                 InstrumentID   = inst,
                 UpdateTime     = string.Empty,
                 UpdateMillisec = 0,
             });
             //_q.ReqSubscribeMarketData(insts);//不能订阅多个??
             foreach (var v in insts)
             {
                 _q.ReqSubscribeMarketData(v);
             }
             return;
         }
     }
     _q.ReqSubscribeMarketData(inst);
 }