Skip to content

Commit

Permalink
test(integration): get wallet balance
Browse files Browse the repository at this point in the history
  • Loading branch information
hirokisan committed Feb 19, 2023
1 parent f1cc649 commit 0f5c9d9
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ import (

func TestGetWalletBalance(t *testing.T) {
client := bybit.NewTestClient().WithAuthFromEnv()
symbol := bybit.SymbolV5BTCUSDT
res, err := client.V5().Account().GetWalletBalance(bybit.UnifiedAccount, "")
require.NoError(t, err)
{
goldenFilename := "./testdata/v5-account-get-wallet-balance.json" // TODO
goldenFilename := "./testdata/v5-account-get-wallet-balance.json"
testhelper.Compare(t, goldenFilename, testhelper.ConvertToJSON(res.Result))
testhelper.UpdateFile(t, goldenFilename, testhelper.ConvertToJSON(res.Result))
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"list": [
{
"totalEquity": "30587.3509045",
"accountIMRate": "0",
"totalMarginBalance": "30587.3509045",
"totalInitialMargin": "0",
"accountType": "UNIFIED",
"totalAvailableBalance": "30587.3509045",
"accountMMRate": "0",
"totalPerpUPL": "0",
"totalWalletBalance": "30587.3509045",
"totalMaintenanceMargin": "0",
"coin": [
{
"availableToBorrow": "2.5",
"accruedInterest": "0",
"availableToWithdraw": "1.258926",
"totalOrderIM": "0",
"equity": "1.258926",
"totalPositionMM": "0",
"usdValue": "29579.89105993",
"unrealisedPnl": "0",
"borrowAmount": "0.0",
"totalPositionIM": "0",
"walletBalance": "1.258926",
"cumRealisedPnl": "0",
"coin": "BTC"
},
{
"availableToBorrow": "2500000",
"accruedInterest": "0",
"availableToWithdraw": "912.35705796",
"totalOrderIM": "0",
"equity": "1012.35705796",
"totalPositionMM": "0",
"usdValue": "1007.45984457",
"unrealisedPnl": "0",
"borrowAmount": "0.0",
"totalPositionIM": "0",
"walletBalance": "1012.35705796",
"cumRealisedPnl": "0",
"coin": "USDT"
}
]
}
]
}
2 changes: 1 addition & 1 deletion v5_account_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type V5WalletBalanceResult struct {
List []V5WalletBalanceList `json:"list"`
}

// VV5WalletBalanceCoin :
// V5WalletBalanceCoin :
type V5WalletBalanceCoin struct {
AvailableToBorrow string `json:"availableToBorrow"`
AccruedInterest string `json:"accruedInterest"`
Expand Down

0 comments on commit 0f5c9d9

Please sign in to comment.