#pragma once #include "common.h" namespace bts { namespace md { struct UserSymbol { UserSymbol() : _symbol(), _exchange(), _type() {} UserSymbol(const std::string& s, api::Venue e, SecurityType t) : _symbol(s), _exchange(e), _type(t) {} UserSymbol(const UserSymbol& other) : _symbol(other._symbol), _exchange(other._exchange), _type(other._type) {} const std::string& symbol() const { return _symbol; } api::Venue exchange() const { return _exchange; } SecurityType type() const { return _type; } bool operator== (const UserSymbol& other) const { return _type == other.type() && _exchange == other.exchange() && _symbol == other.symbol(); } bool operator< (const UserSymbol& other) const { if (_type < other.type()) { return true; } else { if (_type == other.type()) { if (_exchange < other.exchange()) { return true; } else { if (_exchange == other.exchange()) { return _symbol < other.symbol(); } } return false; } return false; } } std::string to_string() const { return symbol() + "-" + SecurityType_Name(type()); } bts::api::Product to_product() const { bts::api::Product p; p.set_exchange(_exchange); p.set_type(_type); p.set_symbol(_symbol); return p; } // No move constructor - // because in this case the std::string will be a stock symbol which should be // small enough to be inlined in both msvsc and gcc/clang private: std::string _symbol; api::Venue _exchange; SecurityType _type; }; std::ostream& operator<<(std::ostream& os, const UserSymbol& sym); }}