USDT Derivatives balance empty
Nitradamus opened this issue · comments
Hello,
Thanks for this module! I was trying to get the balance for my USDT derivatives wallet on bybit, but it seems I always get an empty response. Can you point me in the right direction?
package main
import (
"fmt"
"github.com/hirokisan/bybit"
)
func main() {
client := bybit.NewClient().WithAuth("xxxxx", "xxxxxxx")
res, err := client.Wallet().Balance(bybit.CoinUSDT)
if err != nil {
fmt.Println(err)
}
if client.HasAuth() {
fmt.Println(res.Result)
}
}
thanks in advance!
Thanks for your comment.
Your API key may have expired, please check it on the admin page.
Otherwise, I think you can find other reason inside CommonResponse
like below
fmt.Println(res.CommonResponse)
Lines 4 to 13 in b119d59
Ah, it seems my key expired just that day. Thanks a lot :)
I am trying to get my wallet balance and unrealised PNL from the result, but it seems I can't query it directly from the res.Result. Is there any way I can access these? like res.Equity, res.UnrealisedPnl
Thanks again :)
You can access these like below
res.Result.Balance[bybit.CoinUSDT].Equity
res.Result.Balance[bybit.CoinUSDT].UnrealisedPnl
Thanks alot for the instructions, all is working fine now. Thanks again for this module!