Пример #1
0
 public static string Name(this InstrumentField field)
 {
     if (field == null)
     {
         return(string.Empty);
     }
     return(PInvokeUtility.ReadString(field.InstrumentName));
 }
Пример #2
0
 public static DateTime ExpireDate(this InstrumentField field)
 {
     if (field != null && field.ExpireDate > 0)
     {
         return(GetDateTime(field.ExpireDate));
     }
     return(DateTime.MaxValue);
 }
Пример #3
0
 public static DateTime ExpireDate(this InstrumentField field)
 {
     if (field != null && field.ExpireDate > 0)
     {
         var year  = field.ExpireDate / 10000;
         var month = field.ExpireDate % 10000 / 100;
         var day   = field.ExpireDate % 100;
         return(new DateTime(year, month, day));
     }
     return(DateTime.MaxValue);
 }
Пример #4
0
        public static InstrumentField GetInstrumentField(CtpInstrument info)
        {
            var inst = new InstrumentField();

            inst.InstrumentID = info.InstrumentID;
            inst.ExchangeID   = info.ExchangeID;
            inst.Symbol       = info.InstrumentID;
            inst.ProductID    = info.ProductID;
            inst.SetName(info.InstrumentName);
            inst.Type              = GetInstrumentType(info.ProductClass);
            inst.VolumeMultiple    = info.VolumeMultiple;
            inst.PriceTick         = info.PriceTick;
            inst.ExpireDate        = GetDate(info.ExpireDate);
            inst.OptionsType       = GetPutCall(info.OptionsType);
            inst.StrikePrice       = (info.StrikePrice < double.Epsilon || Math.Abs(info.StrikePrice - double.MaxValue) < double.Epsilon) ? 0 : info.StrikePrice;
            inst.UnderlyingInstrID = info.UnderlyingInstrID;
            return(inst);
        }
Пример #5
0
 public static void SetName(this InstrumentField field, string name)
 {
     field.InstrumentName = PInvokeUtility.Gb2312.GetBytes(name);
 }
Пример #6
0
 void IXSpi.ProcessQryInstrument(InstrumentField inst, bool last)
 {
     InstrumentReceived?.Invoke(this, inst, last);
 }