Esempio n. 1
0
        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;
        }
Esempio n. 2
0
 public SendOrderFill(SessionMediator sessionMediator,
                      OrderMatch orderMatch,
                      FixSessionID sessionID)
 {
     _sessionMediator = sessionMediator;
     _orderMatch = orderMatch;
     _sessionID = sessionID;
 }
Esempio n. 3
0
        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);
            }
        }
Esempio n. 4
0
 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");
 }
Esempio n. 6
0
        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();
        }
Esempio n. 7
0
 private void OnOrderMatched(OrderMatch matchDetails, FixSessionID sessionID)
 {
     var cmd = _commandFactory.CreateSendOrderFill(matchDetails, sessionID);
     _outputQueue.Enqueue(cmd);
 }
Esempio n. 8
0
 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);
 }