mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-03 15:10:49 +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:
@@ -673,7 +673,7 @@ func (e *Exchange) ConfirmEmail(ctx context.Context, token string) (ConfirmEmail
|
||||
&confirmation)
|
||||
}
|
||||
|
||||
// ConfirmTwoFactorAuth confirms 2FA for this account.
|
||||
// ConfirmTwoFactorAuth confirms 2FA for this account
|
||||
func (e *Exchange) ConfirmTwoFactorAuth(ctx context.Context, token, typ string) (bool, error) {
|
||||
var working bool
|
||||
|
||||
@@ -966,12 +966,14 @@ func calculateTradingFee(purchasePrice, amount float64, isMaker bool) float64 {
|
||||
return fee * purchasePrice * amount
|
||||
}
|
||||
|
||||
var xbtCurr = currency.NewCode("XBt")
|
||||
|
||||
// normalizeWalletInfo converts any non-standard currencies (eg. XBt -> BTC)
|
||||
func normalizeWalletInfo(w *WalletInfo) {
|
||||
if w.Currency != "XBt" {
|
||||
if !w.Currency.Equal(xbtCurr) {
|
||||
return
|
||||
}
|
||||
|
||||
w.Currency = "BTC"
|
||||
w.Currency = currency.BTC
|
||||
w.Amount *= constSatoshiBTC
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user