bybit: Add protected subtype for account checking to reduce outbound requests (#1739)

* bybit: Add protected sub type for account checking to reduce outbound requests

* add type and string method plus fix linter with comment

* linter: fix

* whoops

* Update exchanges/bybit/bybit.go

Co-authored-by: Scott <gloriousCode@users.noreply.github.com>

* Update exchanges/bybit/bybit.go

Co-authored-by: Scott <gloriousCode@users.noreply.github.com>

* glorious: nits

---------

Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
This commit is contained in:
Ryan O'Hara-Reid
2025-01-07 12:03:32 +11:00
committed by GitHub
parent 5ae149a063
commit fcd78add96
5 changed files with 101 additions and 33 deletions

View File

@@ -562,7 +562,7 @@ func (by *Bybit) UpdateAccountInfo(ctx context.Context, assetType asset.Item) (a
var acc account.SubAccount
var accountType string
info.Exchange = by.Name
err := by.RetrieveAndSetAccountType(ctx)
at, err := by.FetchAccountType(ctx)
if err != nil {
return info, err
}
@@ -570,7 +570,7 @@ func (by *Bybit) UpdateAccountInfo(ctx context.Context, assetType asset.Item) (a
case asset.Spot, asset.Options,
asset.USDCMarginedFutures,
asset.USDTMarginedFutures:
switch by.AccountType {
switch at {
case accountTypeUnified:
accountType = "UNIFIED"
case accountTypeNormal: