public Message CreateFillReport(OrderMatch match, string execID) { var symbol = new Symbol(match.Contract.Symbol); var exReport = new ExecutionReport( new OrderID(match.OrderID.ToString(CultureInfo.InvariantCulture)), new ExecID(execID), new ExecType(match.MatchType == MatchType.Full ? ExecType.FILL : ExecType.PARTIAL_FILL), new OrdStatus(match.MatchType == MatchType.Full ? OrdStatus.FILLED : OrdStatus.PARTIALLY_FILLED), symbol, TranslateFixFields.Translate(match.MarketSide), new LeavesQty(match.RemainingQuantity), new CumQty(match.OriginalOrderQuantity - match.RemainingQuantity), new AvgPx(match.Price)) { ClOrdID = new ClOrdID(match.ClOrdID), Symbol = symbol, OrderQty = new OrderQty(match.OriginalOrderQuantity), LastQty = new LastQty(match.MatchedQuantity), LastPx = new LastPx(match.Price) }; if (TradingAccount.IsSet(match.Account)) exReport.SetField(new Account(match.Account.Name)); return exReport; }
public SendOrderFill(SessionMediator sessionMediator, OrderMatch orderMatch, FixSessionID sessionID) { _sessionMediator = sessionMediator; _orderMatch = orderMatch; _sessionID = sessionID; }
public void OrderFilled(FixSessionID ownerSessionID, OrderMatch matchDetails) { // If we ever support owner details etc then filter those out is session != sessionID foreach (var sessionID in GetAllLoggedInSessions()) { var fixID = _sessionIDMap.GetBySecond(sessionID); Action<IFixMessageHandler> messageSendF = handler => handler.OnOrderFilled(fixID, matchDetails); _sessionRepository.SendMessageToHandler(sessionID, messageSendF); } }
public ICommand CreateSendOrderFill(OrderMatch orderMatch, FixSessionID sessionID) { return new SendOrderFill(_sessionMediator, orderMatch, sessionID); }
private static void AssertEqual(OrderMatch e, OrderMatch a) { const string messageBase = "Expected and actual matches differ on "; Assert.AreEqual(e.OrderID, a.OrderID, messageBase + "OrderID"); Assert.AreEqual(e.Price, a.Price, messageBase + "Price"); Assert.AreEqual(e.MatchedQuantity, a.MatchedQuantity, "MatchedQuantity"); Assert.AreEqual(e.RemainingQuantity, a.RemainingQuantity, "RemainingQuantity"); Assert.AreEqual(e.Contract, a.Contract, "Contract"); Assert.AreEqual(e.MatchType, a.MatchType, "MatchType"); }
public void OnOrderFilled(SessionID sessionID, OrderMatch match) { // Send the order filled execution report to the owning session var message = _messageGenerator.CreateFillReport(match, _execIdGenerator()); _fixFacade.SendToTarget(message, sessionID); // TODO Send the trade message to other connections //var loggedInSessions = _sessionMediator.GetLoggedInSessions(); }
private void OnOrderMatched(OrderMatch matchDetails, FixSessionID sessionID) { var cmd = _commandFactory.CreateSendOrderFill(matchDetails, sessionID); _outputQueue.Enqueue(cmd); }
public void OnOrderFilled(SessionID sessionID, OrderMatch match) { // Send the order filled execution report to the owning session var message = _messageGenerator.CreateFillReport(match, _execIdGenerator()); _fixFacade.SendToTarget(message, sessionID); }