mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-07 23:16:53 +00:00
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:
@@ -17,7 +17,7 @@ import (
|
||||
"github.com/thrasher-corp/gocryptotrader/database"
|
||||
"github.com/thrasher-corp/gocryptotrader/database/drivers"
|
||||
"github.com/thrasher-corp/gocryptotrader/encoding/json"
|
||||
"github.com/thrasher-corp/gocryptotrader/exchanges/account"
|
||||
"github.com/thrasher-corp/gocryptotrader/exchange/accounts"
|
||||
"github.com/thrasher-corp/gocryptotrader/exchanges/asset"
|
||||
"github.com/thrasher-corp/gocryptotrader/exchanges/kline"
|
||||
)
|
||||
@@ -855,7 +855,7 @@ func TestGenerateConfigForDCALiveCandles(t *testing.T) {
|
||||
ExchangeCredentials: []Credentials{
|
||||
{
|
||||
Exchange: mainExchange,
|
||||
Keys: account.Credentials{
|
||||
Keys: accounts.Credentials{
|
||||
Key: "",
|
||||
Secret: "",
|
||||
},
|
||||
@@ -1388,7 +1388,7 @@ func TestGenerateConfigForLiveCashAndCarry(t *testing.T) {
|
||||
ExchangeCredentials: []Credentials{
|
||||
{
|
||||
Exchange: mainExchange,
|
||||
Keys: account.Credentials{
|
||||
Keys: accounts.Credentials{
|
||||
Key: "",
|
||||
Secret: "",
|
||||
SubAccount: "",
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"github.com/shopspring/decimal"
|
||||
"github.com/thrasher-corp/gocryptotrader/currency"
|
||||
"github.com/thrasher-corp/gocryptotrader/database"
|
||||
"github.com/thrasher-corp/gocryptotrader/exchanges/account"
|
||||
"github.com/thrasher-corp/gocryptotrader/exchange/accounts"
|
||||
"github.com/thrasher-corp/gocryptotrader/exchanges/asset"
|
||||
"github.com/thrasher-corp/gocryptotrader/exchanges/kline"
|
||||
)
|
||||
@@ -201,6 +201,6 @@ type LiveData struct {
|
||||
|
||||
// Credentials holds each exchanges credentials
|
||||
type Credentials struct {
|
||||
Exchange string `json:"exchange"`
|
||||
Keys account.Credentials `json:"credentials"`
|
||||
Exchange string `json:"exchange"`
|
||||
Keys accounts.Credentials `json:"credentials"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user