示例#1
0
 public static void AddInstrument(QuikConnectionManager.StaticInstrument obj)
 {
     if (Instruments.Any(k => k.Id == obj.Id))
     {
         //var i=Instruments.First(k => k.Id == obj.Id);
         log.Warn("Trying to add existing instrument Id={0} Code={1} Class={2} ", obj.Id, obj.Code, obj.Class);
     }
     else
     {
         if (obj.InstrumentType == "Futures")
         {
             Entities.Instrument instr = new Entities.Instrument(obj.Id, obj.Code, obj.Class, Entities.InstrumentType.Futures, obj.BaseContract, obj.BaseContractClass, obj.FullName);
             instr.DaysToMate   = obj.DaysToMate;
             instr.MaturityDate = Convert.ToDateTime(obj.MaturityDate).Date;
             Instruments.Add(instr);
         }
         else
         {
             Entities.Instrument instr = new Entities.Instrument(obj.Id, obj.Code, obj.Class, Entities.InstrumentType.Option, obj.FullName, obj.OptionType == "Call" ? Entities.OptionType.Call : Entities.OptionType.Put, obj.Strike, obj.BaseContract, obj.BaseContractClass);
             instr.DaysToMate   = obj.DaysToMate;
             instr.MaturityDate = Convert.ToDateTime(obj.MaturityDate).Date;
             Instruments.Add(instr);
         }
         log.Trace("New instrument added Id={0} Code={1} Class={2}", obj.Id, obj.Code, obj.Class);
     }
 }
 private static void NotifyOnNewInstrument(StaticInstrument arg)
 {
     if (OnNewInstrument != null)
     {
         OnNewInstrument(arg);
     }
 }
示例#3
0
 static void ConnectionManager_OnNewInstrument(StaticInstrument obj)
 {
     Console.WriteLine("New instrumetn");
 }
 private static void NotifyOnNewInstrument(StaticInstrument arg)
 {
     if (OnNewInstrument != null) OnNewInstrument(arg);
 }