Ejemplo n.º 1
0
        public override void onMessage(QuickFix40.NewOrderSingle order, SessionID sessionID)
        {
            Symbol   symbol   = new Symbol();
            Side     side     = new Side();
            OrdType  ordType  = new OrdType();
            OrderQty orderQty = new OrderQty();
            Price    price    = new Price();
            ClOrdID  clOrdID  = new ClOrdID();

            order.get(ordType);

            if (ordType.getValue() != OrdType.LIMIT)
            {
                throw new IncorrectTagValue(ordType.getField());
            }

            order.get(symbol);
            order.get(side);
            order.get(orderQty);
            order.get(price);
            order.get(clOrdID);

            QuickFix40.ExecutionReport executionReport = new QuickFix40.ExecutionReport
                                                             (genOrderID(),
                                                             genExecID(),
                                                             new ExecTransType(ExecTransType.NEW),
                                                             new OrdStatus(OrdStatus.FILLED),
                                                             symbol,
                                                             side,
                                                             orderQty,
                                                             new LastShares(orderQty.getValue()),
                                                             new LastPx(price.getValue()),
                                                             new CumQty(orderQty.getValue()),
                                                             new AvgPx(price.getValue()));

            executionReport.set(clOrdID);

            if (order.isSetAccount())
            {
                executionReport.set(order.getAccount());
            }

            try
            {
                Session.sendToTarget(executionReport, sessionID);
            }
            catch (SessionNotFound) {}
        }
Ejemplo n.º 2
0
  public override void onMessage( QuickFix40.NewOrderSingle order, SessionID sessionID )
  {
    Symbol symbol = new Symbol();
    Side side = new Side();
    OrdType ordType = new OrdType();
    OrderQty orderQty = new OrderQty();
    Price price = new Price();
    ClOrdID clOrdID = new ClOrdID();

    order.get( ordType );

    if ( ordType.getValue() != OrdType.LIMIT )
      throw new IncorrectTagValue( ordType.getField() );

    order.get( symbol );
    order.get( side );
    order.get( orderQty );
    order.get( price );
    order.get( clOrdID );

    QuickFix40.ExecutionReport executionReport = new QuickFix40.ExecutionReport
        ( genOrderID(),
          genExecID(),
          new ExecTransType( ExecTransType.NEW ),
          new OrdStatus ( OrdStatus.FILLED ),
          symbol,
          side,
          orderQty,
          new LastShares ( orderQty.getValue() ),
          new LastPx ( price.getValue() ),
          new CumQty ( orderQty.getValue() ),
          new AvgPx ( price.getValue() ) );

    executionReport.set( clOrdID );

    if( order.isSetAccount() )
      executionReport.set( order.getAccount() );

    try
    {
      Session.sendToTarget( executionReport, sessionID );
    }
    catch ( SessionNotFound ) {}
  }