コード例 #1
0
void Application::onLogon( const FIX::SessionID& sessionID )
{
  //std::cout << std::endl << "Logon - " << sessionID << std::endl;
  this->senderCompID = sessionID.getSenderCompID();
  this->targetCompID = sessionID.getTargetCompID();
  this->resetFlags();
}
コード例 #2
0
ファイル: FixProviderImpl.cpp プロジェクト: MeowBot/freequant
void FixProviderImpl::unsubscribe(std::vector<std::string> symbols) {
    std::string uuid = FreeQuant::toGuidString();
    FIX::MDReqID mdReqId(uuid);
    FIX::SubscriptionRequestType subType(FIX::SubscriptionRequestType_DISABLE_PREVIOUS_SNAPSHOT_PLUS_UPDATE_REQUEST);
    FIX::MarketDepth marketDepth(1);

    FIX44::MarketDataRequest message(mdReqId, subType, marketDepth);

    message.set(FIX::MDUpdateType(FIX::MDUpdateType_INCREMENTAL_REFRESH));
    message.set(FIX::AggregatedBook(true));
    std::string s;
    s.append(1, FIX::Scope_LOCAL);

    FIX::Scope scope(s);
    message.set(scope);

    message.set(FIX::MDImplicitDelete(false));

    FIX44::MarketDataRequest::NoMDEntryTypes typeGroup;
    typeGroup.set(FIX::MDEntryType(FIX::MDEntryType_OPENING_PRICE));
    message.addGroup(typeGroup);
    typeGroup.set(FIX::MDEntryType(FIX::MDEntryType_CLOSING_PRICE));
    message.addGroup(typeGroup);
    typeGroup.set(FIX::MDEntryType(FIX::MDEntryType_TRADING_SESSION_HIGH_PRICE));
    message.addGroup(typeGroup);
    typeGroup.set(FIX::MDEntryType(FIX::MDEntryType_TRADING_SESSION_LOW_PRICE));
    message.addGroup(typeGroup);
    typeGroup.set(FIX::MDEntryType(FIX::MDEntryType_BID));
    message.addGroup(typeGroup);
    typeGroup.set(FIX::MDEntryType(FIX::MDEntryType_OFFER));
    message.addGroup(typeGroup);
    typeGroup.set(FIX::MDEntryType(FIX::MDEntryType_TRADE_VOLUME));
    message.addGroup(typeGroup);
    typeGroup.set(FIX::MDEntryType(FIX::MDEntryType_OPEN_INTEREST));
    message.addGroup(typeGroup);

    FIX44::MarketDataRequest::NoRelatedSym symGroup;
    symGroup.set(FIX::Symbol("GOOG"));
    message.addGroup(symGroup);
    symGroup.set(FIX::Symbol("IF1210"));
    message.addGroup(symGroup);


    FIX::SessionID sessionID;
    sessionID.fromString(_sessionString);
    try {
        FIX::Session::sendToTarget(message, sessionID);
    } catch (FIX::SessionNotFound&) {}
}
コード例 #3
0
ファイル: requestApplication.cpp プロジェクト: antmd/esm
  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 ) ;
  }
コード例 #4
0
ファイル: requestApplication.cpp プロジェクト: antmd/esm
  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 ) ;
  }
コード例 #5
0
ファイル: FixProviderImpl.cpp プロジェクト: MeowBot/freequant
void FixProviderImpl::subscribe(std::vector<std::string> symbols) {
    std::cout << __FUNCTION__ << std::endl;
    FIX44::MarketDataRequest message;
    message.set(FIX::MDReqID(FreeQuant::createGuid()));
    message.set(FIX::SubscriptionRequestType(FIX::SubscriptionRequestType_SNAPSHOT_PLUS_UPDATES));
    message.set(FIX::MarketDepth(0));
    message.set(FIX::MDUpdateType(FIX::MDUpdateType_FULL_REFRESH));

    std::vector<char> types;
    types.push_back(FIX::MDEntryType_OPENING_PRICE);
    types.push_back(FIX::MDEntryType_CLOSING_PRICE);
    for (auto i = types.begin(); i != types.end(); ++i) {
        FIX44::MarketDataRequest::NoMDEntryTypes group;
        FIX::MDEntryType type(*i);
        group.set(type);
        message.addGroup(group);
    }

    for (auto i = symbols.begin(); i != symbols.end(); i++) {
        FIX44::MarketDataRequest::NoRelatedSym group;
        group.set(FIX::Symbol(*i));
        message.addGroup(group);
    }

//                std::string uuid = FreeQuant::toGuidString();
//                FIX::MDReqID mdReqId(uuid);
//                FIX::SubscriptionRequestType subType(FIX::SubscriptionRequestType_SNAPSHOT_PLUS_UPDATES);
//                FIX::MarketDepth marketDepth(1);

//                FIX44::MarketDataRequest message(mdReqId, subType, marketDepth);

//                message.set(FIX::MDUpdateType(FIX::MDUpdateType_INCREMENTAL_REFRESH));
//                message.set(FIX::AggregatedBook(true));
//                string s;
//                s.append(1, FIX::Scope_LOCAL);

//                FIX::Scope scope(s);
//                message.set(scope);

//                message.set(FIX::MDImplicitDelete(false));

//                FIX44::MarketDataRequest::NoMDEntryTypes typeGroup;
//                typeGroup.set(FIX::MDEntryType(FIX::MDEntryType_OPENING_PRICE));
//                message.addGroup(typeGroup);
//                typeGroup.set(FIX::MDEntryType(FIX::MDEntryType_CLOSING_PRICE));
//                message.addGroup(typeGroup);
//                typeGroup.set(FIX::MDEntryType(FIX::MDEntryType_TRADING_SESSION_HIGH_PRICE));
//                message.addGroup(typeGroup);
//                typeGroup.set(FIX::MDEntryType(FIX::MDEntryType_TRADING_SESSION_LOW_PRICE));
//                message.addGroup(typeGroup);
//                typeGroup.set(FIX::MDEntryType(FIX::MDEntryType_BID));
//                message.addGroup(typeGroup);
//                typeGroup.set(FIX::MDEntryType(FIX::MDEntryType_OFFER));
//                message.addGroup(typeGroup);
//                typeGroup.set(FIX::MDEntryType(FIX::MDEntryType_TRADE_VOLUME));
//                message.addGroup(typeGroup);
//                typeGroup.set(FIX::MDEntryType(FIX::MDEntryType_OPEN_INTEREST));
//                message.addGroup(typeGroup);

//                FIX44::MarketDataRequest::NoRelatedSym symGroup;
//                symGroup.set(FIX::Symbol("GOOG"));
//                message.addGroup(symGroup);
//                symGroup.set(FIX::Symbol("IF1210"));
//                message.addGroup(symGroup);
    FIX::SessionID sessionID;
    sessionID.fromString(_sessionString);
    try {
        FIX::Session::sendToTarget(message, sessionID);
    } catch (FIX::SessionNotFound&) {}
}
コード例 #6
0
ファイル: FixProviderImpl.cpp プロジェクト: MeowBot/freequant
void FixProviderImpl::onCreate(const FIX::SessionID& sessionID) {
    _sessionString = sessionID.toString();
    std::cout << __FUNCTION__ << ": " << sessionID << std::endl;
}