private OrderWorking GenerateOrderWorkingEvent(ExecutionReport message) { var orderId = this.GetOrderId(message); var orderIdBroker = new OrderIdBroker(message.GetField(Tags.OrderID)); var symbol = this.GetSymbol(message.GetField(Tags.Symbol)); var orderSide = FxcmMessageHelper.GetOrderSide(message.GetField(Tags.Side)); var orderType = FxcmMessageHelper.GetOrderType(message.GetField(Tags.OrdType)); var quantity = Quantity.Create(message.GetDecimal(Tags.OrderQty)); var price = FxcmMessageHelper.GetOrderPrice(orderType, message); var timeInForce = FxcmMessageHelper.GetTimeInForce(message.GetField(Tags.TimeInForce)); var expireTime = FxcmMessageHelper.GetExpireTime(message); var workingTime = FxcmMessageHelper.ParseTimestamp(message.GetField(Tags.TransactTime)); return(new OrderWorking( this.accountId, orderId, orderIdBroker, symbol, orderSide, orderType, quantity, price, timeInForce, expireTime, workingTime, this.NewGuid(), this.TimeNow())); }
private OrderPartiallyFilled GenerateOrderPartiallyFilledEvent(ExecutionReport message) { var orderId = this.GetOrderId(message); var executionId = new ExecutionId(message.GetField(Tags.ExecID)); var positionIdBroker = new PositionIdBroker(message.GetField(FxcmTags.PosID)); var symbol = this.GetSymbol(message.GetField(Tags.Symbol)); var orderSide = FxcmMessageHelper.GetOrderSide(message.GetField(Tags.Side)); var filledQuantity = Quantity.Create(message.GetDecimal(Tags.CumQty)); var averagePrice = Price.Create(message.GetDecimal(Tags.AvgPx)); var quoteCurrency = this.GetQuoteCurrency(symbol, message.GetField(Tags.Currency)); var leavesQuantity = Quantity.Create(message.GetInt(Tags.LeavesQty)); var executionTime = FxcmMessageHelper.ParseTimestamp(message.GetField(Tags.TransactTime)); return(new OrderPartiallyFilled( this.accountId, orderId, executionId, positionIdBroker, symbol, orderSide, filledQuantity, leavesQuantity, averagePrice, quoteCurrency, executionTime, this.NewGuid(), this.TimeNow())); }
private OrderExpired GenerateOrderExpiredEvent(ExecutionReport message) { var orderId = this.GetOrderId(message); var expiredTime = FxcmMessageHelper.ParseTimestamp(message.GetField(Tags.TransactTime)); return(new OrderExpired( this.accountId, orderId, expiredTime, this.NewGuid(), this.TimeNow())); }
private OrderRejected GenerateOrderRejectedEvent(ExecutionReport message) { var orderId = this.GetOrderId(message); var rejectedTime = FxcmMessageHelper.ParseTimestamp(message.GetField(Tags.TransactTime)); var rejectReason = message.GetField(FxcmTags.ErrorDetails).TrimEnd('.'); return(new OrderRejected( this.accountId, orderId, rejectedTime, rejectReason, this.NewGuid(), this.TimeNow())); }
private OrderModified GenerateOrderModifiedEvent(ExecutionReport message) { var orderId = this.GetOrderId(message); var orderIdBroker = new OrderIdBroker(message.GetField(Tags.OrderID)); var orderType = FxcmMessageHelper.GetOrderType(message.GetField(Tags.OrdType)); var quantity = message.IsSetField(Tags.LeavesQty) ? Quantity.Create(message.GetDecimal(Tags.LeavesQty)) : Quantity.Create(message.GetDecimal(Tags.OrderQty)); var price = FxcmMessageHelper.GetOrderPrice(orderType, message); var modifiedTime = FxcmMessageHelper.ParseTimestamp(message.GetField(Tags.TransactTime)); return(new OrderModified( this.accountId, orderId, orderIdBroker, quantity, price, modifiedTime, this.NewGuid(), this.TimeNow())); }
public void OnMessage(QuickFix.FIX44.OrderCancelReject message) { Debug.NotNull(this.tradingGateway, nameof(this.tradingGateway)); this.Logger.LogDebug(LogId.Network, $"{Received}{Fix} {nameof(OrderCancelReject)}"); var orderId = this.GetOrderId(message); var rejectedTime = FxcmMessageHelper.ParseTimestamp(message.GetField(Tags.TransactTime)); var rejectResponseTo = FxcmMessageHelper.GetCxlRejResponseTo(message.CxlRejResponseTo); var rejectReason = message.GetField(FxcmTags.ErrorDetails).TrimEnd('.'); var orderCancelReject = new OrderCancelReject( this.accountId, orderId, rejectedTime, rejectResponseTo, rejectReason, this.NewGuid(), this.TimeNow()); this.tradingGateway?.Send(orderCancelReject); }
private ZonedDateTime GetMarketDataTimestamp() { var dateTimeString = $"{this.mdBidGroup.GetField(Tags.MDEntryDate)}-{this.mdBidGroup.GetField(Tags.MDEntryTime)}"; return(FxcmMessageHelper.ParseTimestamp(dateTimeString)); }