예제 #1
0
        protected override bool ProcessInstrument(CtpResponse?rsp)
        {
            if (!rsp.HasValue)
            {
                return(true);
            }
            try {
                var data = rsp.Value.Item1.AsInstrument;
                if (data == null)
                {
                    if (rsp.Value.IsLast)
                    {
                        _client.spi.ProcessQryInstrument(null, true);
                    }
                    return(true);
                }

                if (CtpConvert.CheckRspInfo(rsp.Value.Item2))
                {
                    _client.spi.ProcessQryInstrument(CtpConvert.GetInstrumentField(data), rsp.Value.IsLast);
                    return(rsp.Value.IsLast);
                }
                else
                {
                    _client.SendError(rsp.Value.Item2, nameof(ProcessInstrument));
                    _client.spi.ProcessQryInstrument(null, true);
                }
            }
            catch (Exception e) {
                _client.SendError(-1, e.Message);
                _client.spi.ProcessQryInstrument(null, true);
            }
            return(true);
        }
 private void ProcessInstrument(CtpResponse rsp)
 {
     try {
         var data = rsp.Item1.AsInstrument;
         if (data == null)
         {
             return;
         }
         if (CtpConvert.CheckRspInfo(rsp.Item2))
         {
             _client.Spi.ProcessQryInstrument(CtpConvert.GetInstrumentField(data), rsp.IsLast);
         }
         else
         {
             _client.SendError(rsp.Item2, nameof(ProcessInstrument));
             _client.Spi.ProcessQryInstrument(null, true);
         }
     }
     catch (Exception e) {
         _client.SendError(-1, e.Message);
         _client.Spi.ProcessQryInstrument(null, true);
     }
 }