diff --git a/externals b/externals index 430a9c6b5..c0941c565 160000 --- a/externals +++ b/externals @@ -1 +1 @@ -Subproject commit 430a9c6b5cb063710f961ef9878b6eb3cd4602d9 +Subproject commit c0941c5650a2a136cb036960d009fb8a16fb1165 diff --git a/src/lib/config/defaults/MarketData.conf b/src/lib/config/defaults/MarketData.conf index 17d800d6b..da31831bb 100644 --- a/src/lib/config/defaults/MarketData.conf +++ b/src/lib/config/defaults/MarketData.conf @@ -10,6 +10,7 @@ MarketDataConfig { PlatformMap { value { glbx_platform: "PLATFORM_MDP3ONIXS" + ice_platform: "PLATFORM_ICEONIXS" } } diff --git a/src/lib/config/protos/MarketData.proto b/src/lib/config/protos/MarketData.proto index 4dde48bc2..f864786e5 100755 --- a/src/lib/config/protos/MarketData.proto +++ b/src/lib/config/protos/MarketData.proto @@ -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"]; } diff --git a/src/lib/md/PlatformLoader.cpp b/src/lib/md/PlatformLoader.cpp index acd1ace54..21ef4c02e 100644 --- a/src/lib/md/PlatformLoader.cpp +++ b/src/lib/md/PlatformLoader.cpp @@ -61,6 +61,8 @@ void PlatformLoader::run() { switch (_platform) { case PLATFORM_MDP3ONIXS: break; + case PLATFORM_ICEONIXS: + break; default: bts_assert(false); break; diff --git a/src/lib/md/ice/ICEUtils.cpp b/src/lib/md/ice/ICEUtils.cpp index 44144916f..a71e9879d 100644 --- a/src/lib/md/ice/ICEUtils.cpp +++ b/src/lib/md/ice/ICEUtils.cpp @@ -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().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 get_configured_cme_channels() { +const std::vector get_configured_ice_channels() { std::vector 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 parse_channels(const vector& symbols) { - vector result; +const vector parse_channels(const vector& symbols) { + vector result; bool skip_options = config::get().skip_options(); pugi::xml_document doc; @@ -123,12 +114,12 @@ const vector parse_channels(const vector& 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 parse_channels(const vector& 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(); diff --git a/src/lib/md/ice/ICEUtils.h b/src/lib/md/ice/ICEUtils.h index f412364d7..5c67020eb 100644 --- a/src/lib/md/ice/ICEUtils.h +++ b/src/lib/md/ice/ICEUtils.h @@ -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 diff --git a/src/lib/md/protos/co2.proto b/src/lib/md/protos/co2.proto index b05794f9c..8d5355be6 100644 --- a/src/lib/md/protos/co2.proto +++ b/src/lib/md/protos/co2.proto @@ -11,6 +11,7 @@ enum Platform { PLATFORM_MDP3ONIXS = 10; PLATFORM_CELOXICA = 13; PLATFORM_MDP3EMUMBA = 14; + PLATFORM_ICEONIXS = 15; } enum TradingStatus { diff --git a/src/server/sparkd/md/platforms/ice_onixs/ICEMain.cpp b/src/server/sparkd/md/platforms/ice_onixs/ICEMain.cpp index 82d6aa0de..8e57ad375 100644 --- a/src/server/sparkd/md/platforms/ice_onixs/ICEMain.cpp +++ b/src/server/sparkd/md/platforms/ice_onixs/ICEMain.cpp @@ -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 ),