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

@@ -1064,14 +1064,14 @@
]
}
},
"/v1/getaccountinfo": {
"/v1/getaccountbalances": {
"get": {
"operationId": "GoCryptoTraderService_GetAccountInfo",
"operationId": "GoCryptoTraderService_GetAccountBalances",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/gctrpcGetAccountInfoResponse"
"$ref": "#/definitions/gctrpcGetAccountBalancesResponse"
}
},
"default": {
@@ -1100,9 +1100,9 @@
]
}
},
"/v1/getaccountinfostream": {
"/v1/getaccountbalancesstream": {
"get": {
"operationId": "GoCryptoTraderService_GetAccountInfoStream",
"operationId": "GoCryptoTraderService_GetAccountBalancesStream",
"responses": {
"200": {
"description": "A successful response.(streaming responses)",
@@ -1110,13 +1110,13 @@
"type": "object",
"properties": {
"result": {
"$ref": "#/definitions/gctrpcGetAccountInfoResponse"
"$ref": "#/definitions/gctrpcGetAccountBalancesResponse"
},
"error": {
"$ref": "#/definitions/rpcStatus"
}
},
"title": "Stream result of gctrpcGetAccountInfoResponse"
"title": "Stream result of gctrpcGetAccountBalancesResponse"
}
},
"default": {
@@ -4283,14 +4283,14 @@
]
}
},
"/v1/updateaccountinfo": {
"/v1/updateaccountbalances": {
"get": {
"operationId": "GoCryptoTraderService_UpdateAccountInfo",
"operationId": "GoCryptoTraderService_UpdateAccountBalances",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/gctrpcGetAccountInfoResponse"
"$ref": "#/definitions/gctrpcGetAccountBalancesResponse"
}
},
"default": {
@@ -5852,7 +5852,7 @@
}
}
},
"gctrpcGetAccountInfoResponse": {
"gctrpcGetAccountBalancesResponse": {
"type": "object",
"properties": {
"exchange": {