Files
spark/src/lib/md/common.cpp
T

43 lines
1.1 KiB
C++

#ifndef NO_CPP0X
#include "common.h"
#include "UserSymbol.h"
#include "lib/config/config.h"
#include "PriceSize.h"
#include "lib/config/protos/MarketData.pb.h"
#include <limits>
#include <string>
#include <sstream>
namespace bts {
namespace md {
const double NO_PRICE = std::numeric_limits<double>().quiet_NaN();
const char* SYNTHETIC_SYMBOL = "SYNTHETIC";
std::ostream& operator<<(std::ostream& os, const UserSymbol& sym) {
os << sym.symbol() << "-" << api::SecurityType_Name(sym.type());
return os;
}
}
namespace co2 {
using namespace std;
using namespace md;
string topic(const char* data_type, const string& symbol, SecurityType type, Venue exchange, Platform platform) {
std::ostringstream topic;
topic << "/md/" << config::get<md::PublisherOptions>().channel_prefix()
<< Platform_Name(platform) << "/"
<< Venue_Name(exchange) << "/"
<< symbol << "/"
<< api::SecurityType_Name(type) << "/"
<< data_type;
return topic.str();
}
}
}//namespace
#endif