internal void OnHistoricalOrder(HistoricalOrderResponse message)
        {
            if (NewHistoricalOrder == null)
                return;

            var order = message.HistoricalOrder;
            var status = order.FilledQuantity > 0 ? Status.Filled : Status.Canceled;
            var historicalOrder = new Order(order.UserID, order.Symbol, status == Status.Filled ? order.FilledQuantity : order.CancelledQuantity,
                DataConverter.ToClientOrderType(order.OrderType), order.OrderSide.ToClientSide(), order.Commission,
                status == Status.Filled ? order.AvgFillPrice : order.Price, order.OpenDate, DataConverter.ToClientTIF(order.TimeInForce))
            {
                OrderStatus = status,
                BrokerName = order.BrokerName,
                AccountId = order.AccountId,
                BrokerID = order.BrokerID,
                ServerSide = order.ServerSide,
                OpeningQty = order.OpeningQty,
                ClosingQty = order.ClosingQty
            };

            NewHistoricalOrder?.Invoke(this, new EventArgs<string, Order>(message.AccountID, historicalOrder));
        }
示例#2
0
 protected void OnNewHistoricalOrder(Order order, Status status) =>
 NewHistoricalOrder?.Invoke(this, new EventArgs <Order, Status>(order, status));