Skip to content

Commit

Permalink
Added SpotApi.Account.GetWalletBalancesAsync endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
JKorf committed Apr 2, 2024
1 parent 87b707e commit 44404f8
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 1 deletion.
32 changes: 32 additions & 0 deletions Binance.Net/Binance.Net.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1086,6 +1086,9 @@
<member name="M:Binance.Net.Clients.SpotApi.BinanceRestClientSpotApiAccount.GetBalancesAsync(System.String,System.Nullable{System.Boolean},System.Nullable{System.Int32},System.Threading.CancellationToken)">
<inheritdoc />
</member>
<member name="M:Binance.Net.Clients.SpotApi.BinanceRestClientSpotApiAccount.GetWalletBalancesAsync(System.Nullable{System.Int32},System.Threading.CancellationToken)">
<inheritdoc />
</member>
<member name="M:Binance.Net.Clients.SpotApi.BinanceRestClientSpotApiAccount.GetAssetDividendRecordsAsync(System.String,System.Nullable{System.DateTime},System.Nullable{System.DateTime},System.Nullable{System.Int32},System.Nullable{System.Int32},System.Threading.CancellationToken)">
<inheritdoc />
</member>
Expand Down Expand Up @@ -7841,6 +7844,15 @@
<param name="ct">Cancellation token</param>
<returns></returns>
</member>
<member name="M:Binance.Net.Interfaces.Clients.SpotApi.IBinanceRestClientSpotApiAccount.GetWalletBalancesAsync(System.Nullable{System.Int32},System.Threading.CancellationToken)">
<summary>
Receive balances of the different user wallets
<para><a href="https://binance-docs.github.io/apidocs/spot/en/#query-user-wallet-balance-user_data" /></para>
</summary>
<param name="receiveWindow">The receive window for which this request is active. When the request takes longer than this to complete the server will reject the request</param>
<param name="ct">Cancellation token</param>
<returns></returns>
</member>
<member name="M:Binance.Net.Interfaces.Clients.SpotApi.IBinanceRestClientSpotApiAccount.GetAssetDividendRecordsAsync(System.String,System.Nullable{System.DateTime},System.Nullable{System.DateTime},System.Nullable{System.Int32},System.Nullable{System.Int32},System.Threading.CancellationToken)">
<summary>
Get asset dividend records
Expand Down Expand Up @@ -16502,6 +16514,26 @@
Value in btc
</summary>
</member>
<member name="T:Binance.Net.Objects.Models.Spot.BinanceWalletBalance">
<summary>
Wallet balance
</summary>
</member>
<member name="P:Binance.Net.Objects.Models.Spot.BinanceWalletBalance.Active">
<summary>
Is the wallet activated
</summary>
</member>
<member name="P:Binance.Net.Objects.Models.Spot.BinanceWalletBalance.Balance">
<summary>
Balance
</summary>
</member>
<member name="P:Binance.Net.Objects.Models.Spot.BinanceWalletBalance.WalletName">
<summary>
Name of the wallet
</summary>
</member>
<member name="T:Binance.Net.Objects.Models.Spot.BinanceWithdrawal">
<summary>
Information about a withdrawal
Expand Down
10 changes: 10 additions & 0 deletions Binance.Net/Clients/SpotApi/BinanceRestClientSpotApiAccount.cs
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,16 @@ public async Task<WebCallResult<IEnumerable<BinanceUserBalance>>> GetBalancesAsy
}
#endregion

#region Get Wallet Balances
/// <inheritdoc />
public async Task<WebCallResult<IEnumerable<BinanceWalletBalance>>> GetWalletBalancesAsync(int? receiveWindow = null, CancellationToken ct = default)
{
var parameters = new Dictionary<string, object>();
parameters.AddOptionalParameter("recvWindow", receiveWindow?.ToString(CultureInfo.InvariantCulture) ?? _baseClient.ClientOptions.ReceiveWindow.TotalMilliseconds.ToString(CultureInfo.InvariantCulture));
return await _baseClient.SendRequestInternal<IEnumerable<BinanceWalletBalance>>(_baseClient.GetUrl("asset/wallet/balance", "sapi", "1"), HttpMethod.Get, ct, parameters, true, weight: 5).ConfigureAwait(false);
}
#endregion

#region Asset Dividend Records
/// <inheritdoc />
public async Task<WebCallResult<BinanceQueryRecords<BinanceDividendRecord>>> GetAssetDividendRecordsAsync(string? asset = null, DateTime? startTime = null, DateTime? endTime = null, int? limit = null, int? receiveWindow = null, CancellationToken ct = default)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,16 @@ Task<WebCallResult<IEnumerable<BinanceFuturesAccountSnapshot>>> GetDailyFutureAc
/// <param name="ct">Cancellation token</param>
/// <returns></returns>
Task<WebCallResult<IEnumerable<BinanceUserBalance>>> GetBalancesAsync(string? asset = null, bool? needBtcValuation = null, int? receiveWindow = null, CancellationToken ct = default);


/// <summary>
/// Receive balances of the different user wallets
/// <para><a href="https://binance-docs.github.io/apidocs/spot/en/#query-user-wallet-balance-user_data" /></para>
/// </summary>
/// <param name="receiveWindow">The receive window for which this request is active. When the request takes longer than this to complete the server will reject the request</param>
/// <param name="ct">Cancellation token</param>
/// <returns></returns>
Task<WebCallResult<IEnumerable<BinanceWalletBalance>>> GetWalletBalancesAsync(int? receiveWindow = null, CancellationToken ct = default);

/// <summary>
/// Get asset dividend records
/// <para><a href="https://binance-docs.github.io/apidocs/spot/en/#asset-dividend-record-user_data" /></para>
Expand Down
24 changes: 24 additions & 0 deletions Binance.Net/Objects/Models/Spot/BinanceWalletBalance.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
namespace Binance.Net.Objects.Models.Spot
{
/// <summary>
/// Wallet balance
/// </summary>
public class BinanceWalletBalance
{
/// <summary>
/// Is the wallet activated
/// </summary>
[JsonProperty("activate")]
public bool Active { get; set; }
/// <summary>
/// Balance
/// </summary>
[JsonProperty("balance")]
public decimal Balance { get; set; }
/// <summary>
/// Name of the wallet
/// </summary>
[JsonProperty("walletName")]
public string WalletName { get; set; } = string.Empty;
}
}

0 comments on commit 44404f8

Please sign in to comment.