accounts: Move to instance methods, fix races and isolate tests (#1923)

* Bybit: Fix race in TestUpdateAccountInfo and  TestWSHandleData

* DriveBy rename TestWSHandleData
* This doesn't address running with -race=2+ due to the singleton

* Accounts: Add account.GetService()

* exchange: Assertify TestSetupDefaults

* Exchanges: Add account.Service override for testing

* Exchanges: Remove duplicate IsWebsocketEnabled test from TestSetupDefaults

* Dispatch: Replace nil checks with NilGuard

* Engine: Remove deprecated printAccountHoldingsChangeSummary

* Dispatcher: Add EnsureRunning method

* Accounts: Move singleton accounts service to exchange Accounts

* Move singleton accounts service to exchange Accounts

This maintains the concept of a global store, whilst allowing exchanges
to override it when needed, particularly for testing.

APIServer:

* Remove getAllActiveAccounts from apiserver

Deprecated apiserver only thing using this, so remove it instead of
updating it

* Update comment for UpdateAccountBalances everywhere

* Docs: Add punctuation to function comments

* Bybit: Coverage for wsProcessWalletPushData Save
This commit is contained in:
Gareth Kirwan
2025-10-28 09:52:45 +07:00
committed by GitHub
parent bda9bbec66
commit 73e200e4e7
140 changed files with 3515 additions and 4025 deletions

View File

@@ -164,7 +164,7 @@ message GetOrderbooksResponse {
repeated Orderbooks orderbooks = 1;
}
message GetAccountInfoRequest {
message GetAccountBalancesRequest {
string exchange = 1;
string asset_type = 2;
}
@@ -184,7 +184,7 @@ message AccountCurrencyInfo {
google.protobuf.Timestamp updated_at = 7;
}
message GetAccountInfoResponse {
message GetAccountBalancesResponse {
string exchange = 1;
repeated Account accounts = 2;
}
@@ -1608,16 +1608,16 @@ service GoCryptoTraderService {
option (google.api.http) = {get: "/v1/getorderbooks"};
}
rpc GetAccountInfo(GetAccountInfoRequest) returns (GetAccountInfoResponse) {
option (google.api.http) = {get: "/v1/getaccountinfo"};
rpc GetAccountBalances(GetAccountBalancesRequest) returns (GetAccountBalancesResponse) {
option (google.api.http) = {get: "/v1/getaccountbalances"};
}
rpc UpdateAccountInfo(GetAccountInfoRequest) returns (GetAccountInfoResponse) {
option (google.api.http) = {get: "/v1/updateaccountinfo"};
rpc UpdateAccountBalances(GetAccountBalancesRequest) returns (GetAccountBalancesResponse) {
option (google.api.http) = {get: "/v1/updateaccountbalances"};
}
rpc GetAccountInfoStream(GetAccountInfoRequest) returns (stream GetAccountInfoResponse) {
option (google.api.http) = {get: "/v1/getaccountinfostream"};
rpc GetAccountBalancesStream(GetAccountBalancesRequest) returns (stream GetAccountBalancesResponse) {
option (google.api.http) = {get: "/v1/getaccountbalancesstream"};
}
rpc GetConfig(GetConfigRequest) returns (GetConfigResponse) {