예제 #1
0
  void RequestApplication::onMessage ( const FIX42::OrderCancelRequest &cancelOrder, const FIX::SessionID &sessionId )
  {
    FIX::Side lSide ;
    cancelOrder.getField( lSide ) ;

    FIX::OrdType lOrdType ;
    cancelOrder.getField( lOrdType ) ;

    FIX::OrderQty lOrderQty ;
    cancelOrder.getField( lOrderQty ) ;

    CancelOrderPtr order( new CancelOrder( 
                                     cancelOrder.getField( FIX::FIELD::OrderID ),
                                     cancelOrder.getField( FIX::FIELD::OrigClOrdID ),
                                     cancelOrder.getField( FIX::FIELD::SecurityID ),
                                     cancelOrder.getField( FIX::FIELD::ClOrdID ),
                                     sessionId.toString(),
                                     FromFix::convert( lSide ),
                                     FromFix::convert( lOrdType ),
                                     lOrderQty ) ) ;



    _market.cancel( order ) ;
  }
예제 #2
0
  void RequestApplication::onMessage ( const FIX42::OrderCancelReplaceRequest &replaceOrder, const FIX::SessionID &sessionId )
  {
    FIX::Side lSide ;
    replaceOrder.getField( lSide ) ;

    FIX::OrdType lOrdType ;
    replaceOrder.getField( lOrdType ) ;

    FIX::OrderQty lOrderQty ;
    replaceOrder.getField( lOrderQty ) ;

    ReplaceOrderPtr order( new ReplaceOrder( 
                               replaceOrder.getField( FIX::FIELD::OrderID ),
                               replaceOrder.getField( FIX::FIELD::OrigClOrdID ),
                               replaceOrder.getField( FIX::FIELD::SecurityID ),
                               replaceOrder.getField( FIX::FIELD::ClOrdID ),
                               sessionId.toString(),
                               FromFix::convert( lSide ),
                               FromFix::convert( lOrdType ),
                               lOrderQty ) ) ;


    try
    {
      FIX::TimeInForce lTimeInForce;
      if( replaceOrder.isSetField( lTimeInForce ) )
      {
        replaceOrder.getField( lTimeInForce );
        order->setTimeInForce( FromFix::convert( lTimeInForce ) ) ;
      }
    }catch( std::exception &e ) {}

    FIX::MaxFloor lMaxFloor ;
    if( replaceOrder.isSetField( lMaxFloor ) )
    {
      replaceOrder.getField( lMaxFloor ) ;
      order->setDisclosedQty( lMaxFloor ) ;
    }

    switch( order->getOrderType() )
    {
      case OrderType_LIMIT :
        { FIX::Price lPrice ; replaceOrder.getField( lPrice ) ; order->setPrice( lPrice ) ; }
        break ;
      case OrderType_STOP_LIMIT :
        { FIX::Price lPrice ; replaceOrder.getField( lPrice ) ; order->setPrice( lPrice ) ; }
        // No break here
      case OrderType_STOP :
        { FIX::StopPx lStopPx ; replaceOrder.getField( lStopPx ) ; order->setStopPrice( lStopPx ) ; }
        break ;
      case OrderType_MARKET :
        break ;
    }

    FIX::CumQty lCumQty ;
    replaceOrder.getField( lCumQty ) ;
    order->addOrderQty( lCumQty ) ;

    _market.replace( order ) ;
  }
예제 #3
0
void FixProviderImpl::onCreate(const FIX::SessionID& sessionID) {
    _sessionString = sessionID.toString();
    std::cout << __FUNCTION__ << ": " << sessionID << std::endl;
}