SPARK-1013 (moving files)
This commit is contained in:
1 parent
d104a6b3b7
commit
eaf6e27c56
4 files changed
+2
-662
No files matched your search
@@ -2,380 +2,7 @@ syntax="proto3";
|
||||
package bts.api.account;
|
||||
option csharp_namespace="bts.api.account";
|
||||
import "lib/api/apioptions.proto";
|
||||
import "lib/api/apicore.proto";
|
||||
import "lib/api/services/UserService.proto";
|
||||
//import "google/protobuf/timestamp.proto";
|
||||
import "lib/domain_model/Security.proto";
|
||||
|
||||
/************************************************************************/
|
||||
/********************************Gen (temp)******************************/
|
||||
/************************************************************************/
|
||||
|
||||
message NullableID{
|
||||
int32 id = 10;
|
||||
}
|
||||
|
||||
message ProductResolution{
|
||||
api.Venue exchange = 10;
|
||||
api.SecurityType security_type = 20;
|
||||
string security_symbol = 30;
|
||||
}
|
||||
|
||||
message SecurityResolution{
|
||||
api.Venue exchange = 10;
|
||||
api.SecurityType security_type = 20;
|
||||
string security_symbol = 30;
|
||||
NullableID 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{
|
||||
int32 id = 10;
|
||||
// null for top level groups
|
||||
NullableID parent_group_id = 20;
|
||||
string name = 30;
|
||||
BTSUserDerivableData user_data = 40;
|
||||
}
|
||||
|
||||
message BTSUser{
|
||||
int32 id = 10;
|
||||
int32 parent_group_id = 20;
|
||||
string name = 30;
|
||||
string password = 40;
|
||||
bool is_active = 50;
|
||||
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)
|
||||
|
||||
// if account_permission_map is null, its derived
|
||||
// from the parent group
|
||||
map<int32, UserPermissions> account_permission_map = 70;
|
||||
// absent of internal data in this means it has to be
|
||||
// resolved from the parent group
|
||||
ExchangeUserData exchange_user_data = 80;
|
||||
ExchangeUserMarketDataEntitlementData exchange_md_entitlement_data = 90;
|
||||
}
|
||||
|
||||
message UserAccountPermission{
|
||||
bool is_derived = 10;
|
||||
map<int32, UserPermissions> account_permission_map = 20;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
// this is the functionality permissions
|
||||
message UserPermissions{
|
||||
message TradingPermissions{
|
||||
bool submit_market_orders = 10;
|
||||
bool submit_gtc_orders = 20;
|
||||
bool submit_spreader_orders = 30;
|
||||
message AlgoOrderPermissions{
|
||||
bool submit_iceberg_orders = 10;
|
||||
bool submit_time_box_orders = 20;
|
||||
}
|
||||
}
|
||||
message AdminPersmission{
|
||||
bool has_permissions = 10;
|
||||
}
|
||||
}
|
||||
|
||||
// unused now
|
||||
message UserSecurityTradingLimit{
|
||||
SecurityResolution security = 10;
|
||||
uint32 clip_size = 20;
|
||||
bool can_trade = 30;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/********************************BTS Account*****************************/
|
||||
/************************************************************************/
|
||||
|
||||
message BTSAccount{
|
||||
int32 id = 10;
|
||||
NullableID parent_account_id = 20;
|
||||
string name = 30;
|
||||
string description = 40;
|
||||
// is this inherited by sub-accounts ?
|
||||
bool is_active = 50;
|
||||
repeated AccountProductPositionLimit product_position_limits = 60;
|
||||
repeated AccountSecurityPositionLimit security_position_limits = 70;
|
||||
AccountMarginLimit margin_limit = 80;
|
||||
AccountSecurityClipLimit security_clips = 90;
|
||||
AccountExchangeConnection connections = 100;
|
||||
ExchangeAccountData exchange_account_data = 110;
|
||||
}
|
||||
|
||||
message AccountProductPositionLimit{
|
||||
ProductResolution product = 10;
|
||||
uint32 long_position_limit = 20;
|
||||
uint32 short_position_limit = 30;
|
||||
uint32 net_position_limit = 40;
|
||||
}
|
||||
|
||||
message AccountSecurityPositionLimit{
|
||||
SecurityResolution 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{
|
||||
SecurityResolution security = 10;
|
||||
uint32 clip_size = 20;
|
||||
}
|
||||
|
||||
message AccountSecurityClipLimit{
|
||||
bool is_derived = 10;
|
||||
repeated AccountSecurityClipLimitUnit limit = 20;
|
||||
}
|
||||
|
||||
message AccountExchangeConnection{
|
||||
bool is_derived = 10;
|
||||
repeated int32 exchange_connections = 20;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/***************************Exchange Data********************************/
|
||||
/************************************************************************/
|
||||
|
||||
message ExchangeUserMarketDataEntitlementData{
|
||||
CMEUserMarketDataEntitlementData cme_data = 10;
|
||||
ICEUserMarketDataEntitlementData ice_data = 20;
|
||||
}
|
||||
|
||||
message ExchangeUserData{
|
||||
CMEUserData cme_data = 10;
|
||||
ICEUserData ice_data = 20;
|
||||
}
|
||||
|
||||
message ExchangeAccountData{
|
||||
CMEAccountData cme_account_data = 10;
|
||||
ICEAccountData ice_account_data = 20;
|
||||
}
|
||||
|
||||
message MarketDataEntitlement{
|
||||
bool can_view = 10;
|
||||
}
|
||||
|
||||
message ExchangeConnection{
|
||||
int32 connection_id = 10;
|
||||
string connection_name = 20;
|
||||
oneof connection{
|
||||
CMEConnection cme_connection = 30;
|
||||
ICEConnection ice_connection = 40;
|
||||
}
|
||||
}
|
||||
|
||||
/********************************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 CMEMSGWConnection{
|
||||
uint32 port = 10;
|
||||
string session_and_firm_id = 20;
|
||||
string password = 30;
|
||||
string secret_key = 40;
|
||||
string access_key_id = 50;
|
||||
}
|
||||
|
||||
message CMEAccountData{
|
||||
// should perhaps be an enum
|
||||
string cti = 10;
|
||||
string origin = 20;
|
||||
string takeup_member_code = 30;
|
||||
string clearing_account = 40;
|
||||
string direct_electronic_access = 50;
|
||||
string trading_capacity = 60;
|
||||
string liquidity_provision = 70;
|
||||
string commodity_derivative_indicator = 80;
|
||||
string investment_decision_id = 90;
|
||||
string execution_decision_id = 100;
|
||||
string client_id = 110;
|
||||
}
|
||||
|
||||
message CMEUserData{
|
||||
string operator_id = 10;
|
||||
string ats_operator_id = 20;
|
||||
string smp_id = 30;
|
||||
string text_a = 40;
|
||||
string text_b = 50;
|
||||
}
|
||||
|
||||
message CMEUserMarketDataEntitlementData{
|
||||
MarketDataEntitlement cbot_entitlement = 10;
|
||||
MarketDataEntitlement cme_entitlement = 20;
|
||||
MarketDataEntitlement nymex_entitlement = 30;
|
||||
MarketDataEntitlement bmandf_entitlement = 40;
|
||||
MarketDataEntitlement comex_entitlement = 50;
|
||||
MarketDataEntitlement cme_europe_entitlement = 60;
|
||||
}
|
||||
|
||||
/********************************ICE Data*********************************/
|
||||
|
||||
message ICEConnection{
|
||||
string authorized_member_id = 10;
|
||||
string sender_company_id = 20;
|
||||
string sender_sub_id = 30;
|
||||
string session_id = 40;
|
||||
string session_password = 50;
|
||||
string host_ip = 60;
|
||||
string port = 70;
|
||||
string default_routing_trader = 80;
|
||||
string routing_trader_password = 90;
|
||||
int32 max_order_rate = 100;
|
||||
}
|
||||
|
||||
message ICEAccountData{
|
||||
string nybit_house = 10;
|
||||
int32 wce_house = 20;
|
||||
string clearing_account_override = 30;
|
||||
bool direct_electronic_access = 40;
|
||||
string trading_capacity = 50;
|
||||
bool liquidity_provision = 60;
|
||||
bool commodity_derivative_indicator = 70;
|
||||
string investment_decision_id = 80;
|
||||
string execution_decision_id = 90;
|
||||
string client_id = 100;
|
||||
string mfid_id = 110;
|
||||
}
|
||||
|
||||
message ICEUserData{
|
||||
string authorized_trader = 10;
|
||||
string memo_field = 20;
|
||||
string text_b = 30;
|
||||
uint32 max_order_rate = 40;
|
||||
}
|
||||
|
||||
message ICEUserMarketDataEntitlementData{
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
|
||||
|
||||
message AccountCreateAPIArgument{
|
||||
NullableID parent_account_id = 10;
|
||||
string account_name = 20;
|
||||
string description = 30;
|
||||
}
|
||||
message AccountSecurityClipLimitsAPIArgument{
|
||||
int32 account_id = 10;
|
||||
// for all derivable data setting it to null will
|
||||
// derive the values from the parents
|
||||
AccountSecurityClipLimit complete_data = 20;
|
||||
}
|
||||
message AccountProductPositionLimitsAPIArgument{
|
||||
int32 account_id = 10;
|
||||
repeated AccountProductPositionLimit complete_data = 20;
|
||||
}
|
||||
message AccountSecurityPositionLimitsAPIArgument{
|
||||
int32 account_id = 10;
|
||||
repeated AccountSecurityPositionLimit complete_data = 20;
|
||||
}
|
||||
message AccountMarginLimitAPIArgument{
|
||||
int32 account_id = 10;
|
||||
AccountMarginLimit complete_data = 20;
|
||||
}
|
||||
message AccountConnectionsAPIArgument{
|
||||
int32 account_id = 10;
|
||||
AccountExchangeConnection complete_data = 20;
|
||||
}
|
||||
message AccountExchangeDataAPIArgument{
|
||||
int32 account_id = 10;
|
||||
ExchangeAccountData complete_data = 20;
|
||||
}
|
||||
message UserCreateAPIArgument{
|
||||
int32 parent_group_id = 20;
|
||||
string name = 30;
|
||||
string password = 40;
|
||||
LicenseEntitlements license_entitlements = 70;
|
||||
}
|
||||
message UserAccountAssociationAPIArgument{
|
||||
int32 user_id = 10;
|
||||
map<int32, UserPermissions> complete_data = 20;
|
||||
}
|
||||
message CMEUserMarketDataEntitlementDataAPIArgument{
|
||||
int32 user_id = 10;
|
||||
CMEUserMarketDataEntitlementData complete_data = 20;
|
||||
}
|
||||
message CMEUserDataAPIArgument{
|
||||
int32 user_id = 10;
|
||||
CMEUserData complete_data = 20;
|
||||
}
|
||||
service UserModelService {
|
||||
option (bts.api.service_description) = "Provides a management interface to the user model";
|
||||
// account
|
||||
rpc create_account (AccountCreateAPIArgument) returns (bts.api.VoidMessage);
|
||||
rpc set_account_clip_limits(AccountSecurityClipLimitsAPIArgument) returns (bts.api.VoidMessage);
|
||||
rpc set_account_product_position_limits(AccountProductPositionLimitsAPIArgument) returns (bts.api.VoidMessage);
|
||||
rpc set_account_security_position_limits(AccountSecurityPositionLimitsAPIArgument) returns (bts.api.VoidMessage);
|
||||
rpc set_account_margin_limits(AccountMarginLimitAPIArgument) returns (bts.api.VoidMessage);
|
||||
rpc set_account_connections(AccountConnectionsAPIArgument) returns (bts.api.VoidMessage);
|
||||
rpc set_account_exchange_data(AccountExchangeDataAPIArgument) returns (bts.api.VoidMessage);
|
||||
// users
|
||||
rpc create_user(UserCreateAPIArgument) returns (bts.api.VoidMessage);
|
||||
rpc set_user_account_association(UserAccountAssociationAPIArgument) returns (bts.api.VoidMessage);
|
||||
rpc set_user_cme_md_entitlement_data(CMEUserMarketDataEntitlementDataAPIArgument) returns (bts.api.VoidMessage);
|
||||
rpc set_user_cme_routing_data(CMEUserDataAPIArgument) returns (bts.api.VoidMessage);
|
||||
// subscription
|
||||
rpc subscribe_user_model(bts.api.VoidMessage) returns (stream AdminData);
|
||||
rpc get_user_model(bts.api.VoidMessage) returns (AdminData);
|
||||
}
|
||||
|
||||
message RiskLimit {
|
||||
uint32 max_order_size = 10;
|
||||
@@ -402,8 +29,6 @@ message Account {
|
||||
map<string, RiskLimit> spread_limits = 120;
|
||||
}
|
||||
|
||||
|
||||
|
||||
message GetAccountsRequest {}
|
||||
message GetAccountsResponse {repeated Account accounts = 1;}
|
||||
message AddOrUpdateAccountRequest {bts.api.user.AuthToken token = 1; Account account = 2;}
|
||||
|
||||
@@ -356,7 +356,7 @@ message CMEUserDataAPIArgument{
|
||||
int32 user_id = 10;
|
||||
CMEUserData complete_data = 20;
|
||||
}
|
||||
service UserModelService {
|
||||
service AdminService {
|
||||
option (bts.api.service_description) = "Provides a management interface to the user model";
|
||||
// account
|
||||
rpc create_account (AccountCreateAPIArgument) returns (bts.api.VoidMessage);
|
||||
@@ -374,4 +374,4 @@ service UserModelService {
|
||||
// subscription
|
||||
rpc subscribe_user_model(bts.api.VoidMessage) returns (stream AdminData);
|
||||
rpc get_user_model(bts.api.VoidMessage) returns (AdminData);
|
||||
}
|
||||
}
|
||||
@@ -1,203 +0,0 @@
|
||||
#include "UserModelServiceServer.h"
|
||||
|
||||
#include "server/sparkd/persistence/SqliteStore.h"
|
||||
#include "lib/logging/logging.h"
|
||||
#include "lib/api/services/AccountService.pb.h"
|
||||
#include "lib/utils/PBUtils.h"
|
||||
|
||||
#include <boost/tokenizer.hpp>
|
||||
#include <fmt/format.h>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <utility>
|
||||
|
||||
namespace bts {
|
||||
namespace account{
|
||||
|
||||
UserModelServiceServer::UserModelServiceServer(bts::api::ServiceContext& context)
|
||||
:
|
||||
bts::api::account::UserModelServiceBase (context),
|
||||
_table_name("users"),
|
||||
_unique_key("0"),
|
||||
_state(),
|
||||
_store(new bts::persistence::SqliteStore("user_model"))
|
||||
{
|
||||
LOG(Gen, Info, "UserModelServiceServer created");
|
||||
std::map<std::string,std::map<std::string,std::string>> all_data = _store->retrieve_all();
|
||||
if (all_data.size()==0)
|
||||
// write the first row
|
||||
_update_and_publish();
|
||||
else
|
||||
{
|
||||
auto table = all_data.find(_table_name);
|
||||
bool data_found = false;
|
||||
if (table != all_data.end())
|
||||
{
|
||||
auto row = table->second.find(_unique_key);
|
||||
if (row != table->second.end())
|
||||
{
|
||||
std::string& ser_data = row->second;
|
||||
if (_state.ParseFromString(ser_data))
|
||||
{
|
||||
data_found = true;
|
||||
_update_and_publish();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!data_found)
|
||||
LOG(Gen, Error, "Could not locate user data");
|
||||
}
|
||||
}
|
||||
|
||||
UserModelServiceServer::~UserModelServiceServer() {}
|
||||
|
||||
void UserModelServiceServer::create_account(const api::account::AccountCreateAPIArgument& acct_create_arg,
|
||||
const api::Response<::bts::api::VoidMessage>&)
|
||||
{
|
||||
if (_find_account(acct_create_arg.account_name())==nullptr){
|
||||
bts::api::account::BTSAccount* new_account = _state.add_accounts();
|
||||
new_account->set_id(_find_curr_acct_id()+1);
|
||||
new_account->set_name(acct_create_arg.account_name());
|
||||
new_account->set_description(acct_create_arg.description());
|
||||
new_account->set_is_active(false);
|
||||
_update_and_publish();
|
||||
}
|
||||
}
|
||||
|
||||
void UserModelServiceServer::set_account_clip_limits(const api::account::AccountSecurityClipLimitsAPIArgument& acct_clips_arg,
|
||||
const api::Response<::bts::api::VoidMessage>&)
|
||||
{
|
||||
bts::api::account::BTSAccount* account = _find_account(acct_clips_arg.account_id());
|
||||
if (account != nullptr)
|
||||
{
|
||||
// if(!account->has_account_data())
|
||||
// {
|
||||
// account->mutable_account_data()->mutable_security_clip_limits()->mutable_limit()->Clear();
|
||||
// }
|
||||
}
|
||||
else{
|
||||
// TODO: return error
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void UserModelServiceServer::set_account_product_position_limits(const api::account::AccountProductPositionLimitsAPIArgument&,
|
||||
const api::Response<::bts::api::VoidMessage>&)
|
||||
{
|
||||
}
|
||||
|
||||
void UserModelServiceServer::set_account_security_position_limits(const api::account::AccountSecurityPositionLimitsAPIArgument&,
|
||||
const api::Response<::bts::api::VoidMessage>&)
|
||||
{
|
||||
}
|
||||
|
||||
void UserModelServiceServer::set_account_margin_limits(const api::account::AccountMarginLimitAPIArgument&,
|
||||
const api::Response<::bts::api::VoidMessage>&)
|
||||
{
|
||||
}
|
||||
|
||||
void UserModelServiceServer::set_account_connections(const api::account::AccountConnectionsAPIArgument&,
|
||||
const api::Response<::bts::api::VoidMessage>&)
|
||||
{
|
||||
}
|
||||
|
||||
void UserModelServiceServer::set_account_exchange_data(const api::account::AccountExchangeDataAPIArgument&,
|
||||
const api::Response<::bts::api::VoidMessage>&)
|
||||
{
|
||||
}
|
||||
|
||||
void UserModelServiceServer::create_user(const api::account::UserCreateAPIArgument&,
|
||||
const api::Response<::bts::api::VoidMessage>&)
|
||||
{
|
||||
}
|
||||
|
||||
void UserModelServiceServer::set_user_account_association(const api::account::UserAccountAssociationAPIArgument&,
|
||||
const api::Response<::bts::api::VoidMessage>&)
|
||||
{
|
||||
}
|
||||
|
||||
void UserModelServiceServer::set_user_cme_md_entitlement_data(const api::account::CMEUserMarketDataEntitlementDataAPIArgument&,
|
||||
const api::Response<::bts::api::VoidMessage>&)
|
||||
{
|
||||
}
|
||||
|
||||
void UserModelServiceServer::set_user_cme_routing_data(const api::account::CMEUserDataAPIArgument&,
|
||||
const api::Response<::bts::api::VoidMessage>&)
|
||||
{
|
||||
}
|
||||
|
||||
void UserModelServiceServer::get_user_model(const bts::api::VoidMessage&,
|
||||
const api::Response<::bts::api::account::AdminData>&)
|
||||
{
|
||||
}
|
||||
|
||||
void UserModelServiceServer::_update_and_publish()
|
||||
{
|
||||
std::string ser_state;
|
||||
if (_state.SerializeToString(&ser_state))
|
||||
{
|
||||
LOG(Gen, Info, "Could not save user data");
|
||||
_store->update(_table_name, _unique_key, ser_state);
|
||||
// publish it
|
||||
}
|
||||
else
|
||||
LOG(Gen, Error, "Could not save user data");
|
||||
}
|
||||
|
||||
bts::api::account::BTSAccount* UserModelServiceServer::_find_account (const std::string& acct_name){
|
||||
for(int i=0; i<_state.accounts_size(); i++){
|
||||
bts::api::account::BTSAccount* acct = _state.mutable_accounts(i);
|
||||
if(acct_name==acct->name())
|
||||
return acct;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bts::api::account::BTSAccount* UserModelServiceServer::_find_account (int id){
|
||||
for(int i=0; i<_state.accounts_size(); i++){
|
||||
bts::api::account::BTSAccount* acct = _state.mutable_accounts(i);
|
||||
if(id == acct->id())
|
||||
return acct;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bts::api::account::BTSUser* UserModelServiceServer::_find_user (const std::string& user_name){
|
||||
for(int i=0; i<_state.users_size(); i++){
|
||||
bts::api::account::BTSUser* user = _state.mutable_users(i);
|
||||
if(user_name==user->name())
|
||||
return user;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bts::api::account::BTSUser* UserModelServiceServer::_find_user (const int id){
|
||||
for(int i=0; i<_state.users_size(); i++){
|
||||
bts::api::account::BTSUser* user = _state.mutable_users(i);
|
||||
if(id == user->id())
|
||||
return user;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int UserModelServiceServer::_find_curr_acct_id (){
|
||||
int rv = 0;
|
||||
for(int i=0; i<_state.accounts_size(); i++){
|
||||
bts::api::account::BTSAccount* acct = _state.mutable_accounts(i);
|
||||
if (acct->id() > rv)
|
||||
rv = acct->id();
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
int UserModelServiceServer::_find_curr_user_id (){
|
||||
int rv = 0;
|
||||
for(int i=0; i<_state.users_size(); i++){
|
||||
bts::api::account::BTSUser* user = _state.mutable_users(i);
|
||||
if (user->id() > rv)
|
||||
rv = user->id();
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
}}
|
||||
@@ -1,82 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include "lib/api/services/AccountService.server.pb.h"
|
||||
#include "lib/utils/bts_no_copy.h"
|
||||
#include "server/sparkd/persistence/IStore.h"
|
||||
#include "lib/api/public/ServiceContext.h"
|
||||
|
||||
namespace bts {
|
||||
namespace account{
|
||||
|
||||
class UserModelServiceServer : public api::account::UserModelServiceBase
|
||||
{
|
||||
private:
|
||||
const std::string _table_name;
|
||||
const std::string _unique_key;
|
||||
bts::api::account::AdminData _state;
|
||||
std::unique_ptr<bts::persistence::IStore> _store;
|
||||
public:
|
||||
//BTS_NO_COPY(UserModelServiceServer);
|
||||
UserModelServiceServer(bts::api::ServiceContext& context);
|
||||
~UserModelServiceServer();
|
||||
|
||||
void create_account(
|
||||
const api::account::AccountCreateAPIArgument& request,
|
||||
const api::Response<::bts::api::VoidMessage>& reply) override;
|
||||
|
||||
void set_account_clip_limits(
|
||||
const api::account::AccountSecurityClipLimitsAPIArgument& request,
|
||||
const api::Response<::bts::api::VoidMessage>& reply) override;
|
||||
|
||||
|
||||
void set_account_product_position_limits(
|
||||
const api::account::AccountProductPositionLimitsAPIArgument& request,
|
||||
const api::Response<::bts::api::VoidMessage>& reply) override;
|
||||
|
||||
void set_account_security_position_limits(
|
||||
const api::account::AccountSecurityPositionLimitsAPIArgument& request,
|
||||
const api::Response<::bts::api::VoidMessage>& reply) override;
|
||||
|
||||
void set_account_margin_limits(
|
||||
const api::account::AccountMarginLimitAPIArgument& request,
|
||||
const api::Response<::bts::api::VoidMessage>& reply) override;
|
||||
|
||||
void set_account_connections(
|
||||
const api::account::AccountConnectionsAPIArgument& request,
|
||||
const api::Response<::bts::api::VoidMessage>& reply) override;
|
||||
|
||||
void set_account_exchange_data(
|
||||
const api::account::AccountExchangeDataAPIArgument& request,
|
||||
const api::Response<::bts::api::VoidMessage>& reply) override;
|
||||
|
||||
void create_user(
|
||||
const api::account::UserCreateAPIArgument& request,
|
||||
const api::Response<::bts::api::VoidMessage>& reply) override;
|
||||
|
||||
void set_user_account_association(
|
||||
const api::account::UserAccountAssociationAPIArgument& request,
|
||||
const api::Response<::bts::api::VoidMessage>& reply) override;
|
||||
|
||||
void set_user_cme_md_entitlement_data(
|
||||
const api::account::CMEUserMarketDataEntitlementDataAPIArgument& request,
|
||||
const api::Response<::bts::api::VoidMessage>& reply) override;
|
||||
|
||||
void set_user_cme_routing_data(
|
||||
const api::account::CMEUserDataAPIArgument& request,
|
||||
const api::Response<::bts::api::VoidMessage>& reply) override;
|
||||
|
||||
void get_user_model(
|
||||
const bts::api::VoidMessage& request,
|
||||
const api::Response<::bts::api::account::AdminData>& reply) override;
|
||||
private:
|
||||
void _update_and_publish ();
|
||||
// returns nullptr if not found
|
||||
bts::api::account::BTSAccount* _find_account (const std::string& acct_name);
|
||||
bts::api::account::BTSAccount* _find_account (int id);
|
||||
bts::api::account::BTSUser* _find_user (const std::string& user_name);
|
||||
bts::api::account::BTSUser* _find_user (int id);
|
||||
int _find_curr_acct_id ();
|
||||
int _find_curr_user_id ();
|
||||
};
|
||||
}}
|
||||
Reference in new issue
Block a user