57 lines
2.1 KiB
Protocol Buffer
57 lines
2.1 KiB
Protocol Buffer
syntax="proto3";
|
|
package bts.api.account;
|
|
option csharp_namespace="bts.api.account";
|
|
import "lib/api/apioptions.proto";
|
|
import "lib/api/services/UserService.proto";
|
|
|
|
message RiskLimit {
|
|
uint32 max_order_size = 10;
|
|
uint32 max_position_long = 20;
|
|
uint32 max_position_short = 30;
|
|
uint32 max_position_net = 40;
|
|
}
|
|
|
|
message AccountBalance {
|
|
// call it balance
|
|
double cash_position = 10;
|
|
double leverage_factor = 20;
|
|
}
|
|
|
|
message Account {
|
|
string name = 5 [(bts.api.key)=true];
|
|
string tag1 = 10;
|
|
bool can_trade = 20;
|
|
AccountBalance balance = 30;
|
|
|
|
bool enforce_margin = 40;
|
|
repeated bts.api.user.OperatorID allowed_operators = 100;
|
|
map<string, RiskLimit> future_limits = 110;
|
|
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;}
|
|
message RemoveAccountRequest {bts.api.user.AuthToken token = 1; string name = 2;}
|
|
message UpdateAccountBalanceRequest {string name = 2; AccountBalance new_balance = 3;}
|
|
message AccountOperationResponse {bool is_valid = 1; string reason = 2; }
|
|
|
|
service AccountService {
|
|
option (bts.api.service_description) = "Provides a management interface to the system account list";
|
|
|
|
rpc get_accounts(GetAccountsRequest) returns (GetAccountsResponse)
|
|
{option (bts.api.method_description)="Returns list of valid accounts";}
|
|
|
|
rpc accounts(GetAccountsRequest) returns (stream Account)
|
|
{option (bts.api.method_description)="Returns stream of valid accounts";}
|
|
|
|
rpc add_or_update_account(AddOrUpdateAccountRequest) returns (AccountOperationResponse)
|
|
{option (bts.api.method_description)="Adds or Updates an Account";}
|
|
|
|
rpc remove_account(RemoveAccountRequest) returns (AccountOperationResponse)
|
|
{option (bts.api.method_description)="Removes an Account";}
|
|
|
|
rpc update_account_balance(UpdateAccountBalanceRequest) returns (AccountOperationResponse)
|
|
{option (bts.api.method_description)="Updates account balance without affecting limits or registered operators";}
|
|
}
|