added: files for Taifex, Cboe

This commit is contained in:
Adeel Khan committed 2024-08-23 00:57:40 +05:00
1 parent 59547e0f37
commit 01fa8e0c63
14 files changed
+203 -4

No files matched your search

+2 -2
View File
@@ -114,10 +114,10 @@ C++
- FixedSecurity.cpp, exchange_id(..) and convert_security(..) both switch
- QueryServer set_mic, switch
- VenueOption name(..) switch
- DomainSecurityUtils switch
- DomainSecurityUtils switch, get_security, convert
- MarketDataSubscription.cpp Pimpl and create add
- MarketDataSubscription.h Pimpl and create add
-MarketDataConfig.proto add entry and create file
---------------------------------------------------------------------------
adding security type
+2
View File
@@ -25,4 +25,6 @@ enum Venue {
VENUE_ICE = 13;
VENUE_COINBASE = 14;
VENUE_OKX = 15;
VENUE_TAIFEX = 16;
VENUE_CBOE = 17;
}
+24
View File
@@ -0,0 +1,24 @@
syntax = "proto3";
import "lib/api/domain/SecurityCriteria.proto";
package bts.api.md;
option csharp_namespace = "bts.api.md";
message CboeMarketDataConfig {
uint32 unique_check_value = 1;
bool use_databento = 10;
bool read_from_file = 20;
//uint32 num_depth_levels = 1;
//uint32 depth_throttle_ms = 2;
bts.api.domain.SecurityCriteria security_criteria = 3;
// Market data isn't subscribed for securities listed here (even if they are
// included by 'security_criteria'). There are some securities that don't
// fit into our system just yet, such as 'BTCBIDR', which trades in prices
// larger than our cpp 'domain::Price' class supports.
//repeated string excluded_securities = 4;
//string url_rest_base = 5;
//string url_ws_base = 6;
}
+4
View File
@@ -11,6 +11,8 @@ import "lib/api/md/DeribitMarketDataConfig.proto";
import "lib/api/md/EmumbaDeribitMarketDataConfig.proto";
import "lib/api/md/OkxMarketDataConfig.proto";
import "lib/api/md/GlbxMarketDataConfig.proto";
import "lib/api/md/TaifexMarketDataConfig.proto";
import "lib/api/md/CboeMarketDataConfig.proto";
option csharp_namespace = "bts.api.md";
@@ -25,6 +27,8 @@ message MarketDataConfig {
repeated CoinbaseMarketDataConfig coinbase =6;
repeated OkxMarketDataConfig okx = 7;
repeated GlbxMarketDataConfig glbx = 8;
repeated CboeMarketDataConfig cboe = 9;
repeated TaifexMarketDataConfig taifex =10;
// Add an entry here for all the exchanges that need their market data to be recorded
repeated EmumbaDeribitMarketDataConfig emumba_deribit = 100;
@@ -0,0 +1,23 @@
syntax = "proto3";
import "lib/api/domain/SecurityCriteria.proto";
package bts.api.md;
option csharp_namespace = "bts.api.md";
message TaifexMarketDataConfig {
uint32 unique_check_value = 1;
bool read_from_file = 20;
//uint32 num_depth_levels = 1;
//uint32 depth_throttle_ms = 2;
bts.api.domain.SecurityCriteria security_criteria = 3;
// Market data isn't subscribed for securities listed here (even if they are
// included by 'security_criteria'). There are some securities that don't
// fit into our system just yet, such as 'BTCBIDR', which trades in prices
// larger than our cpp 'domain::Price' class supports.
//repeated string excluded_securities = 4;
//string url_rest_base = 5;
//string url_ws_base = 6;
}
@@ -72,6 +72,7 @@ bool AdminServiceUtils::has_exchange(
case api::Venue::VENUE_OKX:
case api::Venue::VENUE_BTS:
case api::Venue::VENUE_CBOE:
case api::Venue::VENUE_TAIFEX:
case api::Venue::VENUE_CBOECFE:
case api::Venue::Venue_INT_MIN_SENTINEL_DO_NOT_USE_:
case api::Venue::Venue_INT_MAX_SENTINEL_DO_NOT_USE_:
@@ -184,6 +185,8 @@ AdminServiceUtils::resolve_connection(
case api::Venue::VENUE_BINANCE:
case api::Venue::VENUE_BINANCE_US:
case api::Venue::VENUE_COINBASE:
case api::Venue::VENUE_TAIFEX:
case api::Venue::VENUE_CBOE:
case api::Venue::VENUE_BINANCE_USDS_FUTURES: {
if (account.has_connections())
for (const std::string &conn_name :
@@ -195,7 +198,6 @@ AdminServiceUtils::resolve_connection(
}
return nullptr;
}
case api::Venue::VENUE_CBOE:
case api::Venue::VENUE_CBOECFE:
case api::Venue::Venue_INT_MIN_SENTINEL_DO_NOT_USE_:
case api::Venue::Venue_INT_MAX_SENTINEL_DO_NOT_USE_:
@@ -236,6 +238,8 @@ void AdminServiceUtils::fill_connections_from_config(
break;
case bts::api::VENUE_CBOE:
break;
case bts::api::VENUE_TAIFEX:
break;
case bts::api::VENUE_SIM:
case bts::api::VENUE_SIMICE:
connection.mutable_sim_connection();
@@ -454,6 +458,7 @@ std::string AdminServiceUtils::find_account_exchange_account(
case api::Venue::VENUE_OKX:
case api::Venue::VENUE_BTS:
case api::Venue::VENUE_CBOE:
case api::Venue::VENUE_TAIFEX:
case api::Venue::VENUE_CBOECFE:
case api::Venue::Venue_INT_MIN_SENTINEL_DO_NOT_USE_:
case api::Venue::Venue_INT_MAX_SENTINEL_DO_NOT_USE_:
@@ -737,6 +742,7 @@ bts::api::orderman::RoutingRecord AdminServiceUtils::get_routing_record(
case api::Venue::VENUE_UNSET:
case api::Venue::VENUE_BTS:
case api::Venue::VENUE_CBOE:
case api::Venue::VENUE_TAIFEX:
case api::Venue::VENUE_CBOECFE:
case api::Venue::Venue_INT_MIN_SENTINEL_DO_NOT_USE_:
case api::Venue::Venue_INT_MAX_SENTINEL_DO_NOT_USE_:
@@ -1132,6 +1138,7 @@ std::string AdminServiceUtils::find_user_exchange_id(
case api::Venue::VENUE_UNSET:
case api::Venue::VENUE_BTS:
case api::Venue::VENUE_CBOE:
case api::Venue::VENUE_TAIFEX:
case api::Venue::VENUE_CBOECFE:
case api::Venue::Venue_INT_MIN_SENTINEL_DO_NOT_USE_:
case api::Venue::Venue_INT_MAX_SENTINEL_DO_NOT_USE_:
@@ -1169,6 +1176,8 @@ std::string AdminServiceUtils::find_user_company_id(
case api::Venue::VENUE_UNSET:
case api::Venue::VENUE_BTS:
case api::Venue::VENUE_CBOE:
case api::Venue::VENUE_TAIFEX:
case api::Venue::VENUE_CBOECFE:
case api::Venue::Venue_INT_MIN_SENTINEL_DO_NOT_USE_:
case api::Venue::Venue_INT_MAX_SENTINEL_DO_NOT_USE_:
@@ -19,6 +19,20 @@ SymbolLists {
symbol: "BTC"
symbol: "ETH"
}
list {
key: "TAIFEX"
symbol: "QFFH"
symbol: "UDFI"
symbol: "CDFH"
symbol: "UNFI"
symbol: "MXFH"
symbol: "TMFH"
symbol: "TXFH"
}
list {
key: "CBOE"
symbol:"SPX"
}
list {
key: "BINANCE_US"
symbol: "BTC"
@@ -45,6 +59,16 @@ Symbols {
future: @SymbolLists.list[GLBX].symbol
spread: @SymbolLists.list[GLBX].symbol
}
venues{
name: "VENUE_TAIFEX"
future: @SymbolLists[TAIFEX].symbol
option: @SymbolLists[TAIFEX].symbol
}
venues{
name: "VENUE_CBOE"
future: @SymbolLists[CBOE].symbol
option: @SymbolLists[CBOE].symbol
}
venues {
name: "VENUE_SIMICE"
future: @SymbolLists.list[ICE].symbol
@@ -67,6 +91,16 @@ Symbols {
future: @SymbolLists.list[ICE].symbol
spread: @SymbolLists.list[ICE].symbol
}
venues{
name: "VENUE_TAIFEX"
future: @SymbolLists[TAIFEX].symbol
option: @SymbolLists[TAIFEX].symbol
}
venues{
name: "VENUE_CBOE"
future: @SymbolLists[CBOE].symbol
option: @SymbolLists[CBOE].symbol
}
}
}
@@ -91,6 +125,16 @@ Symbols {
option: @SymbolLists.list[DERIBIT].symbol
spread: @SymbolLists.list[DERIBIT].symbol
}
venues{
name: "VENUE_TAIFEX"
future: @SymbolLists[TAIFEX].symbol
option: @SymbolLists[TAIFEX].symbol
}
venues{
name: "VENUE_CBOE"
future: @SymbolLists[CBOE].symbol
option: @SymbolLists[CBOE].symbol
}
venues {
name: "VENUE_BINANCE"
spot: @SymbolLists.list[BINANCE].symbol
+11
View File
@@ -23,6 +23,10 @@ api::domain::Venue DomainSecurityUtils::convert(bts::api::Venue venue) {
return DOMAIN_VENUE(GLBX);
case bts::api::Venue::VENUE_DERIBIT:
return DOMAIN_VENUE(DERIBIT);
case bts::api::Venue::VENUE_CBOE:
return DOMAIN_VENUE(CBOE);
case bts::api::Venue::VENUE_TAIFEX:
return DOMAIN_VENUE(TAIFEX);
case bts::api::Venue::VENUE_BTS:
return DOMAIN_VENUE(BTS);
case bts::api::Venue::VENUE_SIM:
@@ -53,6 +57,10 @@ bts::api::Venue DomainSecurityUtils::convert(api::domain::Venue venue) {
return api::Venue::VENUE_GLBX;
case DOMAIN_VENUE(DERIBIT):
return api::Venue::VENUE_DERIBIT;
case DOMAIN_VENUE(CBOE):
return api::Venue::VENUE_CBOE;
case DOMAIN_VENUE(TAIFEX):
return api::Venue::VENUE_TAIFEX;
case DOMAIN_VENUE(FTX):
return api::Venue::VENUE_FTX;
case DOMAIN_VENUE(BINANCE):
@@ -163,6 +171,9 @@ bool DomainSecurityUtils::get_security_desc(
case bts::api::Security::ExchangeDataCase::kCboe:
desc = security.cboe().security_desc();
break;
case bts::api::Security::ExchangeDataCase::kTaifex:
desc = security.taifex().security_desc();
break;
case bts::api::Security::ExchangeDataCase::kCfe:
desc = security.cfe().security_desc();
break;
+8
View File
@@ -19,6 +19,7 @@ enum Venue {
VENUE_BINANCE_US = 440;
VENUE_COINBASE = 450;
VENUE_OKX = 460;
VENUE_TAIFEX = 500;
}
enum SecurityType {
@@ -84,6 +85,12 @@ message CBOEExchangeData {
int64 exchange_id = 10;
string security_desc = 20;
int32 class_key = 30;
string source = 40;
}
message TAIFEXExchangeData {
int64 exchange_id = 10;
int32 class_key = 30;
string security_desc = 20;
}
message DeribitExchangeData {
int64 exchange_id = 10;
@@ -225,6 +232,7 @@ message Security {
BinanceUsExchangeData binance_us = 280;
CoinbaseExchangeData coinbase = 290;
OkxExchangeData okx = 300;
TAIFEXExchangeData taifex = 400;
}
}
message SecurityList {
+5
View File
@@ -335,6 +335,8 @@ uint64_t exchange_id(const Security &security) {
return security.binance_usds_futures().exchange_id();
case Security::ExchangeDataCase::kOkx:
return security.okx().exchange_id();
case Security::ExchangeDataCase::kTaifex:
return security.taifex().exchange_id();
// Debatable whether this should be an error or not.
// If is possible that we might create a spread with no exchange in the
// future and if we did this would be a runtime error.
@@ -363,6 +365,9 @@ void convert_security(
case Security::ExchangeDataCase::kCboe:
dest.cboe_class_key = src.cboe().class_key();
break;
case Security::ExchangeDataCase::kTaifex:
dest.cboe_class_key = src.taifex().class_key();
break;
case Security::ExchangeDataCase::kCfe:
dest.cboe_class_key = src.cfe().class_key();
break;
+5
View File
@@ -192,6 +192,11 @@ struct MDConsumerGroup {
this->mic = "OKX";
break;
case api::VENUE_CBOE:
this->mic = "CBOE";
break;
case api::VENUE_TAIFEX:
this->mic = "TAIFEX";
break;
case api::VENUE_CBOECFE:
case api::Venue_INT_MIN_SENTINEL_DO_NOT_USE_:
case api::Venue_INT_MAX_SENTINEL_DO_NOT_USE_:
@@ -18,7 +18,9 @@ EnumOptionNames<api::Venue> VenueOption::names() {
NAME_PAIR(api::VENUE_BINANCE),
NAME_PAIR(api::VENUE_BINANCE_US),
NAME_PAIR(api::VENUE_COINBASE),
NAME_PAIR(api::VENUE_BINANCE_USDS_FUTURES)};
NAME_PAIR(api::VENUE_BINANCE_USDS_FUTURES),
NAME_PAIR(api::VENUE_CBOE),
NAME_PAIR(api::VENUE_TAIFEX)};
}
std::string VenueOption::name(api::Venue venue) {
@@ -45,6 +47,10 @@ std::string VenueOption::name(api::Venue venue) {
return "coinbase";
case api::VENUE_BINANCE_USDS_FUTURES:
return "binance_usds_futures";
case api::VENUE_CBOE:
return "cboe";
case api::VENUE_TAIFEX:
return "taifex";
default:
return std::to_string(static_cast<int32_t>(venue));
}
@@ -32,6 +32,7 @@
#include "server/sparkd/md/okx/OkxSubscription.h"
#include "server/sparkd/md/platforms/mdp3_onixs/MDP3Main.h"
#include "server/sparkd/md/recording/MDReplayer.h"
#include "server/sparkd/md/taifex/TaifexDataHandler.h"
#include <bits/stdint-uintn.h>
#include <boost/filesystem.hpp>
@@ -135,6 +136,14 @@ void MarketDataGateway::run() {
bts_assert(me_->md_config.glbx().size() == 1);
_start_onix_glbx(me_->md_config.glbx().at(0));
}
if (!me_->md_config.cboe().empty()) {
bts_assert(me_->md_config.cboe().size() == 1);
_start_cboe(me_->md_config.cboe().at(0));
}
if (!me_->md_config.taifex().empty()) {
bts_assert(me_->md_config.taifex().size() == 1);
_start_taifex(me_->md_config.taifex().at(0));
}
_start_replays(me_->md_config);
while (true) {
std::this_thread::sleep_for(std::chrono::seconds(1));
@@ -268,6 +277,49 @@ void MarketDataGateway::_start_onix_glbx(
bts::md::run_onixs();
}
void MarketDataGateway::_start_cboe(
bts::api::md::CboeMarketDataConfig cfg) {
LOG(md, Error,
"MarketDataGateway::_start_cboe starting t_id:{} t_name:{}. "
"cfg:\n{}",
os::get_thread_id(), os::get_thread_name(), cfg.DebugString());
bts_assert_msg(false, "inside start cboe");
//bts::md::run_onixs();
}
static void run_taifex(
bts::api::md::TaifexMarketDataConfig cfg,
persistence::IDGenerator *sec_id_store) {
LOG(md, Info, "MarketDataGateway::run_taifex t_id:{} t_name",
os::get_thread_id(), os::get_thread_name());
bts::md::GeneralSecurityIndex sec_index;
bts::md::MDProducer md_producer;
std::shared_ptr<GeneralMarketDataListener> listener =
std::make_shared<bts::md::GeneralMarketDataListener>(
sec_index, md_producer, bts::api::VENUE_TAIFEX);
UNUSED(cfg);
UNUSED(sec_id_store);
bts::md::taifex::TaifexDatahandler::run(cfg.read_from_file(), listener,sec_id_store);
// Timers
// auto &disp = utils::Dispatcher::current();
// utils::DispatcherTimer heartbeat_timer(disp, 250, [&]() {
// for (auto &p : platforms)
// p->send_heartbeats();
// });
// heartbeat_timer.start();
// disp.run();
}
void MarketDataGateway::_start_taifex(
bts::api::md::TaifexMarketDataConfig cfg) {
LOG(md, Error,
"MarketDataGateway::_start_taifex starting t_id:{} t_name:{}. "
"cfg:\n{}",
os::get_thread_id(), os::get_thread_name(), cfg.DebugString());
bts::md::run_taifex(cfg, &me_->sec_id_store);
}
// deribit ////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
+6
View File
@@ -1,6 +1,8 @@
#pragma once
#include "lib/api/md/GlbxMarketDataConfig.pb.h"
#include "lib/api/md/CboeMarketDataConfig.pb.h"
#include "lib/api/md/TaifexMarketDataConfig.pb.h"
#include "server/sparkd/md/MarketDataListenerID.h"
#include <memory>
@@ -36,6 +38,10 @@ class MarketDataGateway {
static void _start_onix_glbx(
bts::api::md::GlbxMarketDataConfig cfg);
void _start_replays(const bts::api::md::MarketDataConfig &cfg);
void _start_cboe(
bts::api::md::CboeMarketDataConfig cfg);
void _start_taifex(
bts::api::md::TaifexMarketDataConfig cfg);
};
} // namespace bts::md