500 lines
15 KiB
Protocol Buffer
500 lines
15 KiB
Protocol Buffer
syntax="proto3";
|
|
package bts.api.admin;
|
|
option csharp_namespace="bts.api.admin";
|
|
import "lib/api/apioptions.proto";
|
|
import "lib/api/apicore.proto";
|
|
//import "google/protobuf/timestamp.proto";
|
|
import "lib/domain_model/Security.proto";
|
|
import "lib/api/services/OrderService.proto";
|
|
|
|
/************************************************************************/
|
|
/********************************Gen (temp)******************************/
|
|
/************************************************************************/
|
|
|
|
message ProductScope{
|
|
api.Venue exchange = 10;
|
|
api.SecurityType security_type = 20;
|
|
string security_symbol = 30;
|
|
}
|
|
|
|
message SecurityScope{
|
|
api.Venue exchange = 10;
|
|
api.SecurityType security_type = 20;
|
|
string security_symbol = 30;
|
|
uint32 security_id = 40;
|
|
}
|
|
|
|
/************************************************************************/
|
|
/*******************************Full Data********************************/
|
|
/************************************************************************/
|
|
|
|
message AdminData{
|
|
int32 id = 1 [(bts.api.key)=true];
|
|
repeated BTSUserGroup user_groups = 10;
|
|
repeated BTSUser users = 20;
|
|
repeated BTSAccount accounts = 30;
|
|
repeated ExchangeConnection connections = 40;
|
|
}
|
|
|
|
/************************************************************************/
|
|
/********************************BTS User********************************/
|
|
/************************************************************************/
|
|
|
|
message BTSUserGroup{
|
|
uint32 id = 10;
|
|
// 0 for top level groups
|
|
uint32 parent_group_id = 20;
|
|
string name = 30;
|
|
BTSUserDerivableData user_data = 40;
|
|
}
|
|
|
|
message BTSUser{
|
|
bool is_present = 1;
|
|
uint32 id = 10;
|
|
uint32 parent_group_id = 20;
|
|
string name = 30;
|
|
string password = 40;
|
|
string full_name = 42;
|
|
string company = 44;
|
|
bool is_active = 50;
|
|
bool can_create = 55;
|
|
LicenseData license_data = 60;
|
|
LicenseEntitlements license_entitlements = 70;
|
|
|
|
BTSUserDerivableData user_data = 80;
|
|
}
|
|
|
|
message BTSUserDerivableData{
|
|
// this is the user, account association. all accounts
|
|
// that the user is interested in are here. what the
|
|
// user can do to the account is in UserPermissions
|
|
// (for example whether a user can trade into an account
|
|
// or not, or can the user administer an account)
|
|
|
|
// all the values below follow this :
|
|
// a. if not set, they derive it from the parent group (which
|
|
// can also derive it from its parent)
|
|
// b. else its overridden at the user level
|
|
UserAccountPermissions account_permissions = 70;
|
|
ExchangeUserData exchange_user_data = 80;
|
|
reserved 90; reserved "exchange_md_entitlement_data"; //ExchangeUserMarketDataEntitlementData exchange_md_entitlement_data = 90;
|
|
}
|
|
|
|
message LicenseData{
|
|
int64 create_date = 10;
|
|
int64 renew_date = 20;
|
|
int64 expiry_date = 30;
|
|
}
|
|
|
|
message LicenseEntitlements{
|
|
bool client_side_api = 10;
|
|
bool server_side_api = 20;
|
|
bool spreader = 30;
|
|
}
|
|
|
|
// message AlgoTradingPermissionsUnit{
|
|
// bool submit_iceberg_orders = 10; //unused
|
|
// bool submit_time_box_orders = 20; //unused
|
|
// bool submit_spreader_orders = 30; //unused
|
|
// }
|
|
|
|
message TradingPermissionUnit{
|
|
reserved 10; reserved "submit_market_orders"; //bool submit_market_orders = 10; //unused
|
|
reserved 20; reserved "submit_gtc_orders"; //bool submit_gtc_orders = 20; //unused
|
|
reserved 30; reserved "algo_trading_permission"; //AlgoTradingPermissionsUnit algo_trading_permission = 30; //unused
|
|
|
|
bool has_permissions = 5;
|
|
}
|
|
|
|
message AdminPermissionUnit{
|
|
// TODO: needs to be more ellaborate (account writing,
|
|
// reading etc, routing etc)
|
|
bool has_permissions = 10;
|
|
bool has_md_permissions = 20;
|
|
}
|
|
|
|
// this is the functionality permissions
|
|
message UserAccountPermissionUnit{
|
|
TradingPermissionUnit trading_permission = 10;
|
|
AdminPermissionUnit admin_permission = 20;
|
|
}
|
|
|
|
message UserAccountPermissions{
|
|
//uint32 = account_id
|
|
map<uint32, UserAccountPermissionUnit> account_permissions = 10;
|
|
}
|
|
|
|
// // unused now
|
|
// message UserSecurityTradingLimit{
|
|
// SecurityScope security = 10;
|
|
// uint32 clip_size = 20;
|
|
// bool can_trade = 30;
|
|
// }
|
|
|
|
/************************************************************************/
|
|
/********************************BTS Account*****************************/
|
|
/************************************************************************/
|
|
|
|
message BTSAccount{
|
|
bool is_present = 1;
|
|
uint32 id = 10;
|
|
uint32 parent_account_id = 20;
|
|
string name = 30;
|
|
string description = 40;
|
|
// is this inherited by sub-accounts ?
|
|
bool is_active = 50;
|
|
repeated AccountProductPositionLimitUnit product_position_limits = 60;
|
|
repeated AccountSecurityPositionLimitUnit security_position_limits = 70;
|
|
AccountMarginLimit margin_limit = 80;
|
|
AccountSecurityClipLimits security_clip_limits = 90;
|
|
AccountExchangeConnections connections = 100;
|
|
ExchangeAccountData exchange_account_data = 110;
|
|
// extra parameters for risk enforcement
|
|
RiskLimitEnforcement risk_limit_enforcement=120;
|
|
AccountLossLimit account_loss_limit = 130;
|
|
}
|
|
|
|
message RiskLimitEnforcement{
|
|
bool product_limit_in_net_terms = 10;
|
|
bool ignore_spread_position_limits = 20;
|
|
}
|
|
|
|
message AccountProductPositionLimitUnit{
|
|
ProductScope product = 10;
|
|
uint32 long_position_limit = 20;
|
|
uint32 short_position_limit = 30;
|
|
uint32 net_position_limit = 40;
|
|
}
|
|
|
|
message AccountSecurityPositionLimitUnit{
|
|
SecurityScope security = 10;
|
|
uint32 long_position_limit = 20;
|
|
uint32 short_position_limit = 30;
|
|
uint32 net_position_limit = 40;
|
|
}
|
|
|
|
message AccountMarginLimit{
|
|
bool enforce_margin = 10;
|
|
double cash_balance = 20;
|
|
double leverage_factor_percentage = 30;
|
|
}
|
|
|
|
message AccountSecurityClipLimitUnit{
|
|
SecurityScope security = 10;
|
|
uint32 clip_size = 20;
|
|
}
|
|
|
|
message AccountSecurityClipLimits{
|
|
repeated AccountSecurityClipLimitUnit limit = 10;
|
|
}
|
|
|
|
message AccountExchangeConnections{
|
|
// unused
|
|
repeated uint32 exchange_connections = 10;
|
|
repeated string exchange_connection_names = 20;
|
|
}
|
|
|
|
message AccountLossLimit{
|
|
bool enforce = 10;
|
|
uint32 total_loss_limit = 20;
|
|
// if we need per product we can add it here
|
|
}
|
|
/************************************************************************/
|
|
/***************************Exchange Data********************************/
|
|
/************************************************************************/
|
|
|
|
message CMEMicData{
|
|
api.CMEMics mic=10;
|
|
bool enabled=20;
|
|
// there are other things here
|
|
}
|
|
|
|
message ICEMicData{
|
|
api.ICEMics mic=10;
|
|
bool enabled=20;
|
|
}
|
|
|
|
|
|
message ExchangeUserData{
|
|
CMEUserData cme_data = 10;
|
|
ICEUserData ice_data = 20;
|
|
SIMUserData sim_data = 30;
|
|
|
|
enum AdminDisplay { All = 0; MD = 1; Routing = 2; None = 100; }
|
|
AdminDisplay admin_display_flag = 120;
|
|
}
|
|
|
|
message ExchangeAccountData{
|
|
CMEAccountData cme_account_data = 10;
|
|
ICEAccountData ice_account_data = 20;
|
|
SIMAccountData sim_account_data = 30;
|
|
}
|
|
|
|
|
|
message ExchangeConnection{
|
|
uint32 id = 10;
|
|
string name = 20;
|
|
oneof connection{
|
|
CMEConnection cme_connection = 30;
|
|
ICEConnection ice_connection = 40;
|
|
SIMConnection sim_connection = 50;
|
|
}
|
|
}
|
|
|
|
/********************************CME Data*********************************/
|
|
|
|
message CMEConnection{
|
|
oneof connection {
|
|
CMECGWConnection cgw_connection = 10;
|
|
CMEMSGWConnection msgw_connection = 20;
|
|
}
|
|
}
|
|
|
|
message CMECGWConnection{
|
|
string primary_ip = 10;
|
|
uint32 primary_port = 20;
|
|
string session_and_firm_id = 30;
|
|
string password = 40;
|
|
string secret_key = 50;
|
|
string access_secret_key = 60;
|
|
string backup_id = 70;
|
|
}
|
|
|
|
message SIMConnection {
|
|
}
|
|
|
|
message CMEMSGWConnection{
|
|
uint32 port = 10;
|
|
string session_and_firm_id = 20;
|
|
string password = 30;
|
|
string secret_key = 40;
|
|
string access_key_id = 50;
|
|
uint32 market_segment_id = 60;
|
|
}
|
|
|
|
message CMEAccountData {
|
|
reserved 30; reserved "takeup_member_code"; //string takeup_member_code = 30;
|
|
reserved 50; reserved "direct_electronic_access"; //string direct_electronic_access = 50;
|
|
reserved 60; reserved "trading_capacity"; //string trading_capacity = 60;
|
|
reserved 70; reserved "liquidity_provision"; //string liquidity_provision = 70;
|
|
reserved 80; reserved "commodity_derivative_indicator"; //string commodity_derivative_indicator = 80;
|
|
reserved 90; reserved "investment_decision_id"; //string investment_decision_id = 90;
|
|
reserved 100; reserved "execution_decision_id"; //string execution_decision_id = 100;
|
|
reserved 110; reserved "client_id"; //string client_id = 110;
|
|
|
|
api.orderman.CTICode cti = 10;
|
|
api.orderman.CustomerOrFirm origin = 20;
|
|
string clearing_account = 40;
|
|
map<string, string> misc_tags = 120;
|
|
}
|
|
|
|
message SIMAccountData {
|
|
api.orderman.CTICode cti = 10;
|
|
api.orderman.CustomerOrFirm origin = 20;
|
|
string clearing_account = 40;
|
|
}
|
|
|
|
enum ProfessionalDesignation
|
|
{
|
|
PROFESSIONALDESIGNATION_PRO = 0;
|
|
PROFESSIONALDESIGNATION_NONPRO = 1;
|
|
}
|
|
|
|
enum DisplayDesignation
|
|
{
|
|
DISPLAYDESIGNATION_DISPLAY = 0;
|
|
DISPLAYDESIGNATION_NONDISPLAY = 1;
|
|
}
|
|
|
|
message CMEUserData{
|
|
reserved 20; reserved "ats_operator_id"; //string ats_operator_id = 20;
|
|
reserved 40; reserved "text_a"; //string text_a = 40;
|
|
reserved 50; reserved "text_b"; //string text_b = 50;
|
|
reserved 80; reserved "max_order_rate_per_connection"; //string max_order_rate_per_connection = 80;
|
|
//enum AdminDisplay { All = 0; MD = 1; Routing = 2; None = 100; }
|
|
reserved 120; reserved "admin_display_flag"; //AdminDisplay admin_display_flag = 120;
|
|
repeated CMEMicData md_permissions = 1000;
|
|
|
|
string operator_id = 10;
|
|
string smp_id = 30;
|
|
map<string, string> misc_tags = 60;
|
|
string smp_instruction = 70;
|
|
|
|
string location = 90;
|
|
ProfessionalDesignation pro_nonpro = 100;
|
|
DisplayDesignation display_nondisplay = 110;
|
|
}
|
|
|
|
message SIMUserData {
|
|
string operator_id = 10;
|
|
string location = 90;
|
|
}
|
|
|
|
/********************************ICE Data*********************************/
|
|
|
|
message ICEConnection {
|
|
string sender_compid = 10;
|
|
}
|
|
|
|
message ICEAccountData {
|
|
reserved 10; reserved "nybit_house"; //string nybit_house = 10;
|
|
reserved 20; reserved "wce_house"; //int32 wce_house = 20;
|
|
reserved 30; reserved "clearing_account_override"; //string clearing_account_override = 30;
|
|
reserved 40; reserved "direct_electronic_access"; //bool direct_electronic_access = 40;
|
|
reserved 50; reserved "trading_capacity"; //string trading_capacity = 50;
|
|
reserved 60; reserved "liquidity_provision"; //bool liquidity_provision = 60;
|
|
reserved 70; reserved "commodity_derivative_indicator"; //bool commodity_derivative_indicator = 70;
|
|
reserved 80; reserved "investment_decision_id"; //string investment_decision_id = 80;
|
|
reserved 90; reserved "execution_decision_id"; //string execution_decision_id = 90;
|
|
reserved 100; reserved "client_id"; //string client_id = 100;
|
|
reserved 110; reserved "mfid_id"; //string mfid_id = 110;
|
|
|
|
api.orderman.CTICode cti = 3;
|
|
api.orderman.CustomerOrFirm origin = 5;
|
|
string clearing_firm = 200;
|
|
string clearing_account = 210;
|
|
string customer_account_ref_id = 220;
|
|
string account_code = 230;
|
|
map<string, string> misc_tags = 500;
|
|
}
|
|
|
|
message ICEUserData {
|
|
reserved 20; reserved "memo_field"; //string memo_field = 20;
|
|
reserved 30; reserved "text_b"; //string text_b = 30;
|
|
reserved 40; reserved "max_order_rate"; //uint32 max_order_rate = 40;
|
|
|
|
int32 company_id = 3; //tag 109 clientid
|
|
string operator_id = 5; //tag 50
|
|
string authorized_trader = 10; //tag 553 user_name
|
|
string authorized_group = 15; //tag 553 user_name
|
|
string password = 21; //tag 96 raw data
|
|
string cust_order_handing_inst = 25;
|
|
|
|
//mifid
|
|
int32 mifid_direct_electronic_access = 500;
|
|
int32 mifid_trading_capacity = 510;
|
|
int32 mifid_liquidity_provision = 520;
|
|
int32 mifid_commodity_deriv_indicator = 530;
|
|
int64 mifid_investment_decision = 540;
|
|
int64 mifid_execution_decision = 550;
|
|
int64 mifid_client_id_code = 560;
|
|
int64 mifid_id = 570;
|
|
|
|
map<string, string> misc_tags = 60;
|
|
ProfessionalDesignation pro_nonpro = 100;
|
|
DisplayDesignation display_nondisplay = 110;
|
|
|
|
repeated ICEMicData md_permissions = 1000;
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////
|
|
// Order Auxiliary Service ////////////////////////////////
|
|
|
|
message OrdersSummaryUnit{
|
|
string account = 10;
|
|
string user = 20;
|
|
uint32 total_orders = 30;
|
|
uint32 total_contracts = 40;
|
|
}
|
|
message OrdersSummary{
|
|
repeated OrdersSummaryUnit units = 10;
|
|
}
|
|
message OrderSummaryRequest{
|
|
}
|
|
// top level orders that have account
|
|
// and user that are present here, will
|
|
// be cancelled. wild cards are not
|
|
// supported.
|
|
message OrderCancelRequest{
|
|
repeated string accounts = 10;
|
|
repeated string users = 20;
|
|
}
|
|
///////////////////////////////////////////////////////////
|
|
// Reporting //////////////////////////////////////////////
|
|
message MDEntitlementReportUnit{
|
|
string record_id = 1 [(bts.api.key)=true];
|
|
string user = 10;
|
|
uint32 user_id=11;
|
|
string exchange = 20;
|
|
string mic = 30;
|
|
bool enabled = 40;
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////
|
|
// Misc ///////////////////////////////////////////////////
|
|
message UserSymbolMDPermissionUnit{
|
|
string record_id = 1 [(bts.api.key)=true];
|
|
uint32 user_id=11;
|
|
api.Venue exchange=20;
|
|
string symbol=30;
|
|
bool enabled=40;
|
|
}
|
|
|
|
/************************************************************************/
|
|
/************************************************************************/
|
|
/************************************************************************/
|
|
|
|
message AccountCreateAPIArgument{
|
|
uint32 parent_account_id = 10;
|
|
string account_name = 20;
|
|
string description = 30;
|
|
string creator_user = 40;
|
|
}
|
|
message AccountUpdateAPIArgument{
|
|
BTSAccount complete_data=10;
|
|
}
|
|
message UserCreateAPIArgument{
|
|
uint32 parent_group_id = 20;
|
|
string name = 30;
|
|
string password = 40;
|
|
string full_name = 42;
|
|
string company = 44;
|
|
LicenseData license_data = 50;
|
|
LicenseEntitlements license_entitlements = 70;
|
|
}
|
|
message UserUpdateAPIArgument{
|
|
BTSUser complete_data=10;
|
|
}
|
|
message IDAPIArgument{
|
|
uint32 id = 10;
|
|
}
|
|
|
|
message AdminServiceOperationResult{
|
|
bool is_success = 10;
|
|
string error_text = 20;
|
|
}
|
|
message AdminServiceCreateEntityResult {
|
|
bool is_success = 10;
|
|
string error_text = 20;
|
|
uint32 new_id = 30;
|
|
}
|
|
message AdminServiceCreateAccountResult {
|
|
bool is_success = 10;
|
|
string error_text = 20;
|
|
uint32 new_id = 30;
|
|
}
|
|
|
|
message FilteredAdminDataRequest { }
|
|
|
|
service AdminService {
|
|
option (bts.api.service_description) = "Provides a management interface to the user model";
|
|
// account
|
|
rpc create_account (AccountCreateAPIArgument) returns (AdminServiceCreateAccountResult);
|
|
rpc update_account (AccountUpdateAPIArgument) returns (AdminServiceOperationResult);
|
|
rpc delete_account(IDAPIArgument) returns (AdminServiceOperationResult);
|
|
// users
|
|
rpc create_user(UserCreateAPIArgument) returns (AdminServiceCreateEntityResult);
|
|
rpc update_user(UserUpdateAPIArgument) returns (AdminServiceOperationResult);
|
|
rpc delete_user(IDAPIArgument) returns (AdminServiceOperationResult);
|
|
// subscription
|
|
rpc admin_data(bts.api.VoidMessage) returns (stream AdminData);
|
|
rpc get_admin_data(bts.api.VoidMessage) returns (AdminData);
|
|
rpc get_filtered_admin_data(FilteredAdminDataRequest) returns (AdminData);
|
|
// orders
|
|
rpc get_order_summary(bts.api.VoidMessage) returns (OrdersSummary);
|
|
rpc cancel_orders(OrderCancelRequest) returns (bts.api.VoidMessage);
|
|
// reports
|
|
rpc md_entitlement_data(bts.api.VoidMessage) returns (stream MDEntitlementReportUnit);
|
|
// misc
|
|
rpc md_permissions_data(bts.api.VoidMessage) returns (stream UserSymbolMDPermissionUnit);
|
|
} |