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&) {} }
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&) {} }