private static bool IsExecutionForOrder(Order.Order order, Execution execution) { return order.Quantity.CompareTo(0) == execution.Quantity.CompareTo(0) || order.Quantity.CompareTo(0) == execution.CancelledQuantity.CompareTo(0); }
private void OnSessionOrderExecuted(Execution execution) { var transactionId = TryParseTransactionId(execution.Order.InstructionId); if (transactionId == null) return; SendOutMessage(new ExecutionMessage { SecurityId = new SecurityId { Native = execution.Order.InstrumentId }, OriginalTransactionId = transactionId.Value, TradeId = execution.ExecutionId, TradePrice = execution.Price, TradeVolume = execution.Quantity.Abs(), ExecutionType = ExecutionTypes.Transaction, Side = execution.Order.Quantity > 0 ? Sides.Buy : Sides.Sell, Commission = execution.Order.Commission, ServerTime = CurrentTime.Convert(TimeZoneInfo.Utc) }); }
public bool Equals(Execution other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return other._exceutionId == _exceutionId && other._price == _price && other._quantity == _quantity && Equals(other._order, _order) && other._cancelledQuantity == _cancelledQuantity; }