public static string Name(this InstrumentField field) { if (field == null) { return(string.Empty); } return(PInvokeUtility.ReadString(field.InstrumentName)); }
public static DateTime ExpireDate(this InstrumentField field) { if (field != null && field.ExpireDate > 0) { return(GetDateTime(field.ExpireDate)); } return(DateTime.MaxValue); }
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); }
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); }
public static void SetName(this InstrumentField field, string name) { field.InstrumentName = PInvokeUtility.Gb2312.GetBytes(name); }
void IXSpi.ProcessQryInstrument(InstrumentField inst, bool last) { InstrumentReceived?.Invoke(this, inst, last); }