Add protos for gateio
This commit is contained in:
1 parent
a245bc8610
commit
679ea671c9
15 files changed
+84
No files matched your search
@@ -24,6 +24,7 @@ EnumOptionNames<api::Venue> VenueOption::names() {
|
||||
NAME_PAIR(api::VENUE_TAIFEX),
|
||||
NAME_PAIR(api::VENUE_TWSE),
|
||||
NAME_PAIR(api::VENUE_BYBIT),
|
||||
NAME_PAIR(api::VENUE_GATEIO),
|
||||
NAME_PAIR(api::VENUE_OKX)};
|
||||
}
|
||||
|
||||
@@ -63,6 +64,8 @@ std::string VenueOption::name(api::Venue venue) {
|
||||
return "twse";
|
||||
case api::VENUE_BYBIT:
|
||||
return "bybit";
|
||||
case api::VENUE_GATEIO:
|
||||
return "gateio";
|
||||
default:
|
||||
return std::to_string(static_cast<int32_t>(venue));
|
||||
}
|
||||
|
||||
@@ -129,6 +129,7 @@ namespace bts.api {
|
||||
Security.ExchangeDataOneofCase.Twse => security.Twse.SecurityDesc,
|
||||
Security.ExchangeDataOneofCase.None => security.Synthetic.Name,
|
||||
Security.ExchangeDataOneofCase.Bybit => security.Bybit.SecurityDesc,
|
||||
Security.ExchangeDataOneofCase.Gateio => security.Gateio.SecurityDesc,
|
||||
_ => throw new NotImplementedException("security_desc not implemented for exchange")
|
||||
};
|
||||
|
||||
@@ -181,6 +182,7 @@ namespace bts.api {
|
||||
domain.Venue.Taifex => Venue.Taifex,
|
||||
domain.Venue.Twse => Venue.Twse,
|
||||
domain.Venue.Bybit => Venue.Bybit,
|
||||
domain.Venue.Gateio => Venue.Gateio,
|
||||
domain.Venue.Unspecified => Venue.Unset,
|
||||
_ => throw new NotImplementedException(),
|
||||
};
|
||||
@@ -202,6 +204,7 @@ namespace bts.api {
|
||||
Venue.Taifex => domain.Venue.Taifex,
|
||||
Venue.Twse => domain.Venue.Twse,
|
||||
Venue.Bybit => domain.Venue.Bybit,
|
||||
Venue.Gateio => domain.Venue.Gateio,
|
||||
Venue.Unset => domain.Venue.Unspecified,
|
||||
_ => throw new NotImplementedException(),
|
||||
};
|
||||
|
||||
@@ -29,4 +29,5 @@ enum Venue {
|
||||
VENUE_CBOE = 17;
|
||||
VENUE_TWSE = 18;
|
||||
VENUE_BYBIT = 19;
|
||||
VENUE_GATEIO = 20;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
syntax = "proto3";
|
||||
|
||||
import "spark/api/domain/SecurityCriteria.proto";
|
||||
|
||||
package bts.api.md;
|
||||
|
||||
option csharp_namespace = "bts.api.md";
|
||||
option cc_enable_arenas = true;
|
||||
|
||||
message GateioMarketDataConfig {
|
||||
uint32 num_depth_levels = 1;
|
||||
uint32 depth_throttle_ms = 2;
|
||||
bts.api.domain.SecurityCriteria security_criteria = 3;
|
||||
string url_rest_base = 4;
|
||||
string url_ws_base = 5;
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import "spark/api/md/GlbxMarketDataConfig.proto";
|
||||
import "spark/api/md/TaifexMarketDataConfig.proto";
|
||||
import "spark/api/md/TwseMarketDataConfig.proto";
|
||||
import "spark/api/md/BybitMarketDataConfig.proto";
|
||||
import "spark/api/md/GateioMarketDataConfig.proto";
|
||||
import "spark/api/md/CboeMarketDataConfig.proto";
|
||||
import "spark/api/md/PyMarketDataProviderConfig.proto";
|
||||
|
||||
@@ -36,6 +37,7 @@ message MarketDataConfig {
|
||||
repeated TaifexMarketDataConfig taifex =10;
|
||||
repeated TwseMarketDataConfig twse = 12;
|
||||
repeated BybitMarketDataConfig bybit = 13;
|
||||
repeated GateioMarketDataConfig gateio = 14;
|
||||
// Add an entry here for all the exchanges that need their market data to be recorded
|
||||
|
||||
repeated EmumbaDeribitMarketDataConfig emumba_deribit = 100;
|
||||
|
||||
@@ -30,6 +30,9 @@ std::set<bts::api::Venue> MarketDataConfigUtils::get_live_exchanges(
|
||||
if (cfg.bybit_size() > 0) {
|
||||
rv.insert(bts::api::VENUE_BYBIT);
|
||||
}
|
||||
if (cfg.gateio_size() > 0) {
|
||||
rv.insert(bts::api::VENUE_GATEIO);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
@@ -76,6 +76,7 @@ bool AdminServiceUtils::has_exchange(
|
||||
case api::Venue::VENUE_TWSE:
|
||||
case api::Venue::VENUE_TAIFEX:
|
||||
case api::Venue::VENUE_BYBIT:
|
||||
case api::Venue::VENUE_GATEIO:
|
||||
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_:
|
||||
@@ -194,6 +195,7 @@ AdminServiceUtils::resolve_connection(
|
||||
case api::Venue::VENUE_TWSE:
|
||||
case api::Venue::VENUE_TAIFEX:
|
||||
case api::Venue::VENUE_BYBIT:
|
||||
case api::Venue::VENUE_GATEIO:
|
||||
case api::Venue::VENUE_CBOE:
|
||||
case api::Venue::VENUE_BINANCE_USDS_FUTURES: {
|
||||
if (account.has_connections())
|
||||
@@ -470,6 +472,7 @@ std::string AdminServiceUtils::find_account_exchange_account(
|
||||
case api::Venue::VENUE_TWSE:
|
||||
case api::Venue::VENUE_TAIFEX:
|
||||
case api::Venue::VENUE_BYBIT:
|
||||
case api::Venue::VENUE_GATEIO:
|
||||
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_:
|
||||
@@ -794,6 +797,13 @@ bts::api::orderman::RoutingRecord AdminServiceUtils::get_routing_record(
|
||||
out_result.set_is_success(true);
|
||||
return rv;
|
||||
}
|
||||
case api::VENUE_GATEIO: {
|
||||
rv.set_session("gateio_1");
|
||||
rv.set_account(account_ptr->name());
|
||||
rv.set_operator_id(user_ptr->name());
|
||||
out_result.set_is_success(true);
|
||||
return rv;
|
||||
}
|
||||
case api::VENUE_FTX: // TODO
|
||||
case api::VENUE_BINANCE_COIN_FUTURES:
|
||||
case api::VENUE_BINANCE_US:
|
||||
@@ -1200,6 +1210,7 @@ std::string AdminServiceUtils::find_user_exchange_id(
|
||||
case api::Venue::VENUE_TWSE:
|
||||
case api::Venue::VENUE_TAIFEX:
|
||||
case api::Venue::VENUE_BYBIT:
|
||||
case api::Venue::VENUE_GATEIO:
|
||||
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_:
|
||||
@@ -1241,6 +1252,7 @@ std::string AdminServiceUtils::find_user_company_id(
|
||||
case api::Venue::VENUE_TWSE:
|
||||
case api::Venue::VENUE_TAIFEX:
|
||||
case api::Venue::VENUE_BYBIT:
|
||||
case api::Venue::VENUE_GATEIO:
|
||||
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_:
|
||||
|
||||
@@ -4059,6 +4059,11 @@ JetFIX {
|
||||
max_order_msgs_per_window: 300
|
||||
venue: VENUE_BYBIT
|
||||
}
|
||||
connection {
|
||||
name: "gateio_1"
|
||||
max_order_msgs_per_window: 300
|
||||
venue: VENUE_GATEIO
|
||||
}
|
||||
# CME EXECUTION NEEDS TO BE UPDATED, probably below
|
||||
# connection {
|
||||
# name: "onixs_sim"
|
||||
|
||||
@@ -67,6 +67,11 @@ SymbolLists {
|
||||
symbol: "BTC"
|
||||
symbol: "ETH"
|
||||
}
|
||||
list {
|
||||
key: "GATEIO"
|
||||
symbol: "BTC"
|
||||
symbol: "ETH"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,5 +203,9 @@ Symbols {
|
||||
name: "VENUE_BYBIT"
|
||||
spot: @SymbolLists.list[BYBIT].symbol
|
||||
}
|
||||
venues {
|
||||
name: "VENUE_GATEIO"
|
||||
spot: @SymbolLists.list[GATEIO].symbol
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -47,6 +47,8 @@ api::domain::Venue DomainSecurityUtils::convert(bts::api::Venue venue) {
|
||||
return DOMAIN_VENUE(OKX);
|
||||
case bts::api::VENUE_BYBIT:
|
||||
return DOMAIN_VENUE(BYBIT);
|
||||
case bts::api::VENUE_GATEIO:
|
||||
return DOMAIN_VENUE(GATEIO);
|
||||
default: {
|
||||
LOG(md, Error, "convert unknown venue: {}", static_cast<int>(venue));
|
||||
break;
|
||||
@@ -81,6 +83,8 @@ bts::api::Venue DomainSecurityUtils::convert(api::domain::Venue venue) {
|
||||
return api::Venue::VENUE_OKX;
|
||||
case DOMAIN_VENUE(BYBIT):
|
||||
return api::Venue::VENUE_BYBIT;
|
||||
case DOMAIN_VENUE(GATEIO):
|
||||
return api::Venue::VENUE_GATEIO;
|
||||
case DOMAIN_VENUE(SIM):
|
||||
return api::Venue::VENUE_SIM;
|
||||
case DOMAIN_VENUE(COINBASE):
|
||||
|
||||
@@ -23,6 +23,7 @@ enum Venue {
|
||||
VENUE_TAIFEX = 500;
|
||||
VENUE_TWSE = 600;
|
||||
VENUE_BYBIT = 610;
|
||||
VENUE_GATEIO = 620;
|
||||
}
|
||||
|
||||
enum SecurityType {
|
||||
@@ -144,6 +145,11 @@ message BybitExchangeData {
|
||||
string security_desc = 20;
|
||||
}
|
||||
|
||||
message GateioExchangeData {
|
||||
int64 exchange_id = 10;
|
||||
string security_desc = 20;
|
||||
}
|
||||
|
||||
message CBOECFEExchangeData {
|
||||
int64 exchange_id = 10;
|
||||
string security_desc = 20;
|
||||
@@ -274,6 +280,7 @@ message Security {
|
||||
TAIFEXExchangeData taifex = 400;
|
||||
TWSEExchangeData twse = 500;
|
||||
BybitExchangeData bybit = 510;
|
||||
GateioExchangeData gateio = 520;
|
||||
}
|
||||
}
|
||||
message SecurityList {
|
||||
|
||||
@@ -238,6 +238,10 @@ void convert_security(const FixedSecurity &source, Security *presult) {
|
||||
dest.mutable_bybit()->set_security_desc(source.security_desc());
|
||||
dest.mutable_bybit()->set_exchange_id(source.numeric_id);
|
||||
break;
|
||||
case Venue::VENUE_GATEIO:
|
||||
dest.mutable_gateio()->set_security_desc(source.security_desc());
|
||||
dest.mutable_gateio()->set_exchange_id(source.numeric_id);
|
||||
break;
|
||||
case Venue::VENUE_BTS:
|
||||
break;
|
||||
default:
|
||||
@@ -348,6 +352,8 @@ uint64_t exchange_id(const Security &security) {
|
||||
return security.taifex().exchange_id();
|
||||
case Security::ExchangeDataCase::kBybit:
|
||||
return security.bybit().exchange_id();
|
||||
case Security::ExchangeDataCase::kGateio:
|
||||
return security.gateio().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.
|
||||
@@ -443,6 +449,10 @@ void convert_security(
|
||||
dest.numeric_id = src.bybit().exchange_id();
|
||||
dest.security_desc(src.bybit().security_desc());
|
||||
break;
|
||||
case Security::ExchangeDataCase::kGateio:
|
||||
dest.numeric_id = src.gateio().exchange_id();
|
||||
dest.security_desc(src.gateio().security_desc());
|
||||
break;
|
||||
case Security::ExchangeDataCase::EXCHANGEDATA_NOT_SET:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -206,6 +206,9 @@ struct MDConsumerGroup {
|
||||
case api::VENUE_BYBIT:
|
||||
this->mic = "BYBIT";
|
||||
break;
|
||||
case api::VENUE_GATEIO:
|
||||
this->mic = "GATEIO";
|
||||
break;
|
||||
case api::VENUE_CBOECFE:
|
||||
case api::Venue_INT_MIN_SENTINEL_DO_NOT_USE_:
|
||||
case api::Venue_INT_MAX_SENTINEL_DO_NOT_USE_:
|
||||
|
||||
@@ -23,6 +23,7 @@ class VenueIndex {
|
||||
std::optional<T> taifex;
|
||||
std::optional<T> coinbase;
|
||||
std::optional<T> bybit;
|
||||
std::optional<T> gateio;
|
||||
|
||||
public:
|
||||
std::optional<T> &get(api::Venue venue) { return get_(*this, venue); }
|
||||
@@ -70,6 +71,8 @@ class VenueIndex {
|
||||
return self.taifex;
|
||||
case api::VENUE_BYBIT:
|
||||
return self.bybit;
|
||||
case api::VENUE_GATEIO:
|
||||
return self.gateio;
|
||||
case api::VENUE_BTS:
|
||||
return self.bts;
|
||||
case api::VENUE_FTX:
|
||||
|
||||
@@ -529,6 +529,9 @@ OrderOpResult EMNativeOrder::_on_activate(
|
||||
case api::VENUE_BYBIT:
|
||||
session_name = "bybit_1";
|
||||
break;
|
||||
case api::VENUE_GATEIO:
|
||||
session_name = "gateio_1";
|
||||
break;
|
||||
default:
|
||||
session_name ="deribit_1";
|
||||
|
||||
|
||||
Reference in new issue
Block a user