kinda copy / pastey stuff from cme

This commit is contained in:
Kevin Darby committed 2019-02-12 13:00:47 -05:00
1 parent 4c798f6db4
commit 2b4add85a2
8 files changed
+25 -97

No files matched your search

+1
View File
@@ -10,6 +10,7 @@ MarketDataConfig {
PlatformMap {
value {
glbx_platform: "PLATFORM_MDP3ONIXS"
ice_platform: "PLATFORM_ICEONIXS"
}
}
+2
View File
@@ -12,6 +12,8 @@ message PlatformMap
{
// PLATFORM_MDP3ONIXS
optional string glbx_platform = 1 [default = "PLATFORM_SIM"];
// PLATFORM_ICEONIXS
optional string ice_platform = 1 [default = "PLATFORM_SIM"];
}
+2
View File
@@ -61,6 +61,8 @@ void PlatformLoader::run() {
switch (_platform) {
case PLATFORM_MDP3ONIXS:
break;
case PLATFORM_ICEONIXS:
break;
default:
bts_assert(false);
break;
+15 -24
View File
@@ -38,14 +38,14 @@ const string production_config_path() { return data_path() + "ConnectivityConfig
const std::string log_path() {return log:: log_path().string() + "/onix_ice";}
bool check_file_exists_with_instructions(const string& filename, const string& url, bool log) {
if (!boost::filesystem::exists(filename)) {
download_file(url.c_str(), filename.c_str());
}
// if (!boost::filesystem::exists(filename)) {
// download_file(url.c_str(), filename.c_str());
// }
if (!boost::filesystem::exists(filename)) {
if (log) {
LOG(md,Error,
"File {} is not present on this system. "
"Please download it from the CME ftp site. "
"Please download it from the ICE web site. "
"I will wait until the file is present.\n$ curl {} > {} ",
filename, url, filename);
}
@@ -57,17 +57,14 @@ bool check_file_exists_with_instructions(const string& filename, const string& u
// For exponential backoff on logging this return true if x is a power of 2 or 0
bool is_pow_two_or_0(uint32_t x) { return (x & (~x + 1)) == x; }
void await_cme_config() {
void await_ice_config() {
std::string config_url;
std::string templates_url;
if (config::get<config::DeploymentType>().type() != "dev") {
config_url = "ftp://ftp.cmegroup.com/SBEFix/Production/Configuration/config.xml";
templates_url = "ftp://ftp.cmegroup.com/SBEFix/Production/Templates/templates_FixBinary.xml";
config_url = "https://community.theice.com/docs/DOC-19989";
}
else {
config_url = "ftp://ftp.cmegroup.com/SBEFix/Cert/Configuration/config.xml";
templates_url = "ftp://ftp.cmegroup.com/SBEFix/Cert/Templates/templates_FixBinary.xml";
config_url = "https://community.theice.com/docs/DOC-19989";
}
boost::filesystem::create_directories(data_path());
@@ -80,12 +77,6 @@ void await_cme_config() {
++count;
std::this_thread::sleep_for(1s);
}
count = 0;
while(!check_file_exists_with_instructions(template_path(), templates_url, is_pow_two_or_0(count))) {
++count;
std::this_thread::sleep_for(1s);
}
// If we waited for someone to download the file give it a second to be finished downloading
if (count > 0) {
std::this_thread::sleep_for(1s);
@@ -104,17 +95,17 @@ SecurityType infer_security_type(const string& label) {
// TODO: Allow configuration to override this?
LOG(md,Warn,"Unable to guess security type from label: '{}"
"' Treating as OPTION.",label);
return SECURITYTYPE_OPTION;
return SECURITYTYPE_FUTURE;
}
const std::vector<CMEChannel> get_configured_cme_channels() {
const std::vector<ICEChannel> get_configured_ice_channels() {
std::vector<UserSymbol> symbols;
// Get all glbx symbols
get_system_md_symbols(api::VENUE_GLBX, api::SECURITYTYPE_UNSET, &symbols);
get_system_md_symbols(api::VENUE_ICE, api::SECURITYTYPE_UNSET, &symbols);
return parse_channels(symbols);
}
const vector<CMEChannel> parse_channels(const vector<UserSymbol>& symbols) {
vector<CMEChannel> result;
const vector<ICEChannel> parse_channels(const vector<UserSymbol>& symbols) {
vector<ICEChannel> result;
bool skip_options = config::get<PublisherOptions>().skip_options();
pugi::xml_document doc;
@@ -123,12 +114,12 @@ const vector<CMEChannel> parse_channels(const vector<UserSymbol>& symbols) {
auto configuration = doc.root().child("configuration");
bts_assert(configuration);
LOG(md,Info,"CME: Loaded '{}' config. Last updated: {}" ,
LOG(md,Info,"ICE: Loaded '{}' config. Last updated: {}" ,
std::string(configuration.attribute("environment").as_string("??")),
std::string(configuration.attribute("updated").as_string("??")));
auto channels = configuration.children("channel");
for (const auto& chan : channels) {
CMEChannel channel;
ICEChannel channel;
channel.id = chan.attribute("id").as_string();
auto channel_type = infer_security_type(chan.attribute("label").as_string());
if (channel_type == SECURITYTYPE_OPTION && skip_options) continue;
@@ -148,7 +139,7 @@ const vector<CMEChannel> parse_channels(const vector<UserSymbol>& symbols) {
for (const auto& srccon : connections) {
std::string id = srccon.attribute("id").as_string();
if (!id.empty()) {
CMEConnection connection;
ICEConnection connection;
connection.feed_type = srccon.child("type").attribute("feed-type").as_string();
connection.ip = srccon.child_value("ip");
connection.port = srccon.child("port").text().as_uint();
-69
View File
@@ -29,75 +29,6 @@ const std::string config_path();
const std::string template_path();
const std::string log_path();
inline void decode_ticks(int vtt, double mintick, FixedSecurity& dest) {
switch(vtt) {
default:
case 0:
dest.low_tick = mintick;
dest.high_tick = mintick;
dest.price_break = 0;
break;
case 1:
dest.price_break = 500;
dest.low_tick = 5;
dest.high_tick = 10;
break;
case 2:
dest.price_break = 5;
dest.low_tick = 0.5;
dest.high_tick = 1;
break;
case 3:
dest.price_break = 10;
dest.low_tick = 1;
dest.high_tick = 2;
break;
case 4:
dest.price_break = 500;
dest.low_tick = 5;
dest.high_tick = 25;
break;
case 10:
dest.price_break = 300;
dest.low_tick = 5;
dest.high_tick = 25;
break;
case 11:
dest.price_break = 300;
dest.low_tick = 5;
dest.high_tick = 10;
break;
case 12:
dest.price_break = 5;
dest.low_tick = 0.25;
dest.high_tick = 0.5;
break;
}
}
inline int floorlog10(int64_t m) {
bts_assert(m >= 0);
if (m < 10) return 0;
if (m < 100) return 1;
if (m < 1000) return 2;
if (m < 10000) return 3;
if (m < 100000) return 4;
if (m < 1000000) return 5;
if (m < 10000000) return 6;
if (m < 100000000) return 7;
if (m < 1000000000) return 8;
if (m < 10000000000) return 9;
if (m < 100000000000) return 10;
if (m < 1000000000000) return 11;
if (m < 10000000000000) return 12;
if (m < 100000000000000) return 13;
if (m < 1000000000000000) return 14;
if (m < 10000000000000000) return 15;
if (m < 100000000000000000) return 16;
if (m < 1000000000000000000) return 17;
return 19;
}
}}//namespace
+1
View File
@@ -11,6 +11,7 @@ enum Platform {
PLATFORM_MDP3ONIXS = 10;
PLATFORM_CELOXICA = 13;
PLATFORM_MDP3EMUMBA = 14;
PLATFORM_ICEONIXS = 15;
}
enum TradingStatus {
@@ -1,6 +1,6 @@
#include "MDP3Main.h"
#include "ICEMain.h"
#include "lib/md/cme/MDP3Utils.h"
#include "lib/md/cme/ICEUtils.h"
#include "lib/config/config.h"
#include "lib/md/coconut2.h"
#include "lib/md/SecurityDB.h"
@@ -25,7 +25,7 @@ using std::size_t;
namespace bts {
namespace md {
MDP3Main::MDP3Main() :
ICEMain::ICEMain() :
_index(),
_recorder ({ utils::Dispatcher::current(), [=](ExchangeKey k) { return SecurityKey(_index.get_key(k.value())); } }),
_producer(PLATFORM_MDP3ONIXS, _recorder ),