public void AddTrade(Trade trade) { App.Current.Dispatcher.Invoke(() => { this.Trades.Insert(0, trade); }); }
public override void OnRtnTrade(ThostFtdcTradeField pTrade) { var trade = new Trade { InstrumentID = pTrade.InstrumentID, UserID = pTrade.UserID, Direction = (DirectionType)pTrade.Direction, OffsetFlag = (OffsetFlag)pTrade.OffsetFlag, Price = pTrade.Price, Volume = pTrade.Volume, TradeTime = DateTimeHelper.GenerateTime(pTrade.TradeDate, pTrade.TradeTime), }; TradeRecordViewModel.Instance.AddTrade(trade); }