burakoner / Bybit.Api

Bybit API Wrapper. Up-to-date, most-complete, well-organized, well-documented, easy-to-use, multi-task and multi-thread compatible Bybit Cryptocurrency Exchange Rest and Websocket Api Wrapper
MIT License
1 stars 1 forks source link

Object reference not set to an instance of an object when calling GetBalancesAsync #8

Open ThomasJaeger opened 4 months ago

ThomasJaeger commented 4 months ago

I'm getting the following error when I call GetBalancesAsync. No changes where made on my side, this happened after upgrading from 1.3.0 to 2.4.0:

at Bybit.Api.Clients.RestApi.BybitRestApiBaseClient.GetServerTimestampAsync() in E:\Github\Bybit.Api\Bybit.Api\Clients\RestApi\BybitRestApiBaseClient.cs:line 45 at ApiSharp.RestApiClient.SyncTimeAsync() in E:\Github\ApiSharp\ApiSharp\RestApiClient.cs:line 494 at ApiSharp.RestApiClient.PrepareRequestAsync(Uri uri, HttpMethod method, CancellationToken cancellationToken, Boolean signed, Dictionary2 queryParameters, Dictionary2 bodyParameters, Dictionary2 headerParameters, Nullable1 serialization, JsonSerializer deserializer, Boolean ignoreRatelimit, Int32 requestWeight) in E:\Github\ApiSharp\ApiSharp\RestApiClient.cs:line 140 at ApiSharp.RestApiClient.SendRequestAsync[T](Uri uri, HttpMethod method, CancellationToken cancellationToken, Boolean signed, Dictionary2 queryParameters, Dictionary2 bodyParameters, Dictionary2 headerParameters, Nullable1 serialization, JsonSerializer deserializer, Boolean ignoreRatelimit, Int32 requestWeight) in E:\Github\ApiSharp\ApiSharp\RestApiClient.cs:line 98 at Bybit.Api.Clients.RestApi.BybitRestApiBaseClient.SendBybitRequest[T](Uri uri, HttpMethod method, CancellationToken cancellationToken, Boolean signed, Dictionary2 queryParameters, Dictionary2 bodyParameters, Dictionary2 headerParameters, Nullable1 arraySerialization, JsonSerializer deserializer, Boolean ignoreRatelimit, Int32 requestWeight) in E:\Github\Bybit.Api\Bybit.Api\Clients\RestApi\BybitRestApiBaseClient.cs:line 100 at Bybit.Api.Clients.RestApi.BybitRestApiAccountClient.GetBalancesAsync(BybitAccountType account, String asset, CancellationToken ct) in E:\Github\Bybit.Api\Bybit.Api\Clients\RestApi\BybitRestApiAccountClient.cs:line 54 at ExchangeBybit.Api.GetWalletBalanceAsync(String accountType, String coin) in /home/hampelman/source/jtrading/ExchangeBybit/Api.cs:line 69

The call I make is this:

var response = await _client.Account.GetBalancesAsync(type, coin);

where type is BybitAccountType.Contract and coin is USDT

Looks like Bybit.Api.Clients.RestApi.BybitRestApiBaseClient.GetServerTimestampAsync() is failing.

Please help!