From 33400f9fe3c6805fe1542490e68013a8cd2bb0b4 Mon Sep 17 00:00:00 2001 From: Jkorf Date: Thu, 12 Dec 2024 16:25:39 +0100 Subject: [PATCH] Added restClient.V5Api.Account.GetTransferableAsync endpoint --- .../Clients/V5/BybitRestClientApiAccount.cs | 13 ++++++++++++ .../Clients/V5/IBybitRestClientApiAccount.cs | 9 ++++++++ .../Objects/Models/V5/BybitTransferable.cs | 21 +++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 ByBit.Net/Objects/Models/V5/BybitTransferable.cs diff --git a/ByBit.Net/Clients/V5/BybitRestClientApiAccount.cs b/ByBit.Net/Clients/V5/BybitRestClientApiAccount.cs index 7bc8994c..209bc4bc 100644 --- a/ByBit.Net/Clients/V5/BybitRestClientApiAccount.cs +++ b/ByBit.Net/Clients/V5/BybitRestClientApiAccount.cs @@ -1149,5 +1149,18 @@ public async Task>> GetConver } #endregion + + #region Get Transferable + + /// + public async Task> GetTransferableAsync(string asset, CancellationToken ct = default) + { + var parameters = new ParameterCollection(); + parameters.Add("coinName", asset.ToUpperInvariant()); + + return await _baseClient.SendRequestAsync(_baseClient.GetUrl("v5/account/withdrawal"), HttpMethod.Get, ct, parameters, true).ConfigureAwait(false); + } + + #endregion } } diff --git a/ByBit.Net/Interfaces/Clients/V5/IBybitRestClientApiAccount.cs b/ByBit.Net/Interfaces/Clients/V5/IBybitRestClientApiAccount.cs index 7a07c470..030ff3bd 100644 --- a/ByBit.Net/Interfaces/Clients/V5/IBybitRestClientApiAccount.cs +++ b/ByBit.Net/Interfaces/Clients/V5/IBybitRestClientApiAccount.cs @@ -674,5 +674,14 @@ Task> AddOrReduceMarginAsync( /// Cancellation token /// Task>> GetConvertHistoryAsync(ConvertAccountType? accountType = null, int? page = null, int? pageSize = null, CancellationToken ct = default); + + /// + /// Get quantity available for withdrawal/transfer from unified wallet + /// + /// + /// Asset name + /// Cancellation token + /// + Task> GetTransferableAsync(string asset, CancellationToken ct = default); } } \ No newline at end of file diff --git a/ByBit.Net/Objects/Models/V5/BybitTransferable.cs b/ByBit.Net/Objects/Models/V5/BybitTransferable.cs new file mode 100644 index 00000000..8b2f13f5 --- /dev/null +++ b/ByBit.Net/Objects/Models/V5/BybitTransferable.cs @@ -0,0 +1,21 @@ +using CryptoExchange.Net.Attributes; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Text; +using System.Text.Json.Serialization; + +namespace Bybit.Net.Objects.Models.V5 +{ + /// + /// Transferable + /// + public record BybitTransferable + { + /// + /// Available transferable quantity + /// + [JsonProperty("availableWithdrawal")] + public decimal Available { get; set; } + } +}