public void AddLmtOrder(OrderTask orderTask) { bool isOK = OrderTaskManager.CheckExecuteOrder(orderTask); if (isOK) { this.OrderTasks.Insert(0,orderTask); } else { this.OrderTasks.Add(orderTask); } orderTask.SetCellDataDefine(orderTask.OrderStatus); if (this._LmtOrderForInstrument.Instrument.Id == Guid.Empty) { this.LmtOrderForInstrument.Update(orderTask); } else { bool isCurrentInstrument = orderTask.InstrumentId == this.LmtOrderForInstrument.Instrument.Id; } this.LmtOrderForInstrument.UpdateSumBuySellLot(true, orderTask); if (isOK && this.OnSettingFirstRowStyleEvent != null && this.SelectedInstrumentId != null && (orderTask.InstrumentId == this.SelectedInstrumentId)) { this.OnSettingFirstRowStyleEvent(); } }
public void AddInstanceOrder(OrderTask orderTask) { this.OrderTasks.Add(orderTask); orderTask.SetCellDataDefine(orderTask.OrderStatus); if (this.InstantOrderForInstrument.Instrument.Id == Guid.Empty) { this.InstantOrderForInstrument.Update(orderTask); } else { bool isCurrentInstrument = orderTask.InstrumentId == this.InstantOrderForInstrument.Instrument.Id; } this.InstantOrderForInstrument.UpdateSumBuySellLot(true, orderTask); if (this.OnSettingFirstRowStyleEvent != null && this.SelectedInstrumentId != null && (orderTask.InstrumentId == this.SelectedInstrumentId)) { this.OnSettingFirstRowStyleEvent(); } }
private void AddOrderTaskEntity(Order order) { if (order.Transaction.OrderType == iExchange.Common.OrderType.MarketOnOpen || order.Transaction.OrderType == iExchange.Common.OrderType.MarketOnClose) { OrderTask orderTask = new OrderTask(order); orderTask.BaseOrder = order; orderTask.OrderStatus = OrderStatus.TimeArrived; MooMocOrderForInstrument mooMocOrderForInstrument = null; mooMocOrderForInstrument = this._MooMocOrderForInstrumentModel.MooMocOrderForInstruments.SingleOrDefault(P => P.Instrument.Id == order.Transaction.Instrument.Id); if (mooMocOrderForInstrument == null) { mooMocOrderForInstrument = new MooMocOrderForInstrument(); InstrumentClient instrument = order.Transaction.Instrument; mooMocOrderForInstrument.Instrument = instrument; mooMocOrderForInstrument.Origin = instrument.Origin; mooMocOrderForInstrument.Variation = 0; this._MooMocOrderForInstrumentModel.MooMocOrderForInstruments.Add(mooMocOrderForInstrument); } if (orderTask.IsBuy == BuySell.Buy) { mooMocOrderForInstrument.SumBuyLot += orderTask.Lot.Value; } else { mooMocOrderForInstrument.SumSellLot += orderTask.Lot.Value; } mooMocOrderForInstrument.OrderTasks.Add(orderTask); } else if(order.Transaction.OrderType == iExchange.Common.OrderType.SpotTrade) { OrderTask orderTask = new OrderTask(order); orderTask.BaseOrder = order; this._ProcessInstantOrder.AddInstanceOrder(orderTask); } else { OrderTask orderTask = new OrderTask(order); orderTask.BaseOrder = order; this._OrderTaskModel.OrderTasks.Add(orderTask); orderTask.SetCellDataDefine(orderTask.OrderStatus); } }