private static void NotifyOnInstrument(DynamicInstrument i) { if (OnInstrument != null) { OnInstrument(i); } }
public static void UpdateInstrument(QuikConnectionManager.DynamicInstrument obj) { try { var i = Instruments.First(k => k.Id == obj.Id); i.Update(obj.LastPrice, obj.Volatility, obj.TheorPrice, 0, obj.Ask, obj.AskVol, obj.Bid, obj.BidVol); if (i.Type == Entities.InstrumentType.Futures) { foreach (Entities.Instrument ins in Instruments) { if (ins.BaseContract == i.Code) { ins.SettlePrice = i.LastPrice; } } } if (Portfolios.Any(k => k.BaseCode == i.Code)) { foreach (Entities.Portfolio p in Portfolios.Where(k => k.BaseCode == i.Code)) { p.Refresh(); } } //i.LastPrice = obj.LastPrice; //i.Volatility = obj.Volatility; //i.TheorPrice = obj.TheorPrice; //i.BestAsk = obj.Ask; //i.BestAskVolume = obj.AskVol; //i.BestBid = obj.Bid; //i.BestBidVolume = obj.BidVol; } catch (SystemException e) { log.Error("Update for unknown instrument Id={0}", obj.Id); } }
static void ConnectionManager_OnInstrument(DynamicInstrument obj) { Console.WriteLine("Instrument update"); }