예제 #1
0
  public override void onMessage( QuickFix42.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 );

    QuickFix42.ExecutionReport executionReport = new QuickFix42.ExecutionReport
                                            ( genOrderID(),
                                              genExecID(),
                                              new ExecTransType( ExecTransType.NEW ),
                                              new ExecType( ExecType.FILL ),
                                              new OrdStatus( OrdStatus.FILLED ),
                                              symbol,
                                              side,
                                              new LeavesQty( 0 ),
                                              new CumQty( orderQty.getValue() ),
                                              new AvgPx( price.getValue() ) );

    executionReport.set( clOrdID );
    executionReport.set( orderQty );
    executionReport.set( new LastShares( orderQty.getValue() ) );
    executionReport.set( new LastPx( price.getValue() ) );

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

    try
    {
      Session.sendToTarget( executionReport, sessionID );
    }
    catch ( SessionNotFound ) {}
  }
예제 #2
0
        public override void onMessage(QuickFix42.OrderCancelReject message, SessionID session)
        {
            OrderCancelReject reject = new OrderCancelReject();

            // required fields
            reject.TransactTime = Clock.Now;
            reject.OrderID = message.getOrderID().getValue();
            reject.ClOrdID = message.getClOrdID().getValue();
            reject.OrigClOrdID = message.getOrigClOrdID().getValue();

            (reject as FIXOrderCancelReject).OrdStatus = message.getOrdStatus().getValue();
            (reject as FIXOrderCancelReject).CxlRejResponseTo = message.getCxlRejResponseTo().getValue();
            (reject as FIXOrderCancelReject).CxlRejReason = message.getCxlRejReason().getValue();

            // optional fields
            if (message.isSetSecondaryOrderID())
                reject.SecondaryOrderID = message.getSecondaryOrderID().getValue();

            if (message.isSetAccount())
                reject.Account = message.getAccount().getValue();

            if (message.isSetText())
                reject.Text = message.getText().getValue();

            // event
            provider.EmitOrderCancelReject(reject);
        }