diff --git a/Binance.API.Csharp.Client.Domain/Interfaces/IBinanceClient.cs b/Binance.API.Csharp.Client.Domain/Interfaces/IBinanceClient.cs index 5312215..38e12e1 100644 --- a/Binance.API.Csharp.Client.Domain/Interfaces/IBinanceClient.cs +++ b/Binance.API.Csharp.Client.Domain/Interfaces/IBinanceClient.cs @@ -162,7 +162,7 @@ public interface IBinanceClient /// Address name. /// Specific number of milliseconds the request is valid for. /// - Task Withdraw(string asset, decimal amount, string address, string addressName = "", long recvWindow = 6000000); + Task Withdraw(string asset, decimal amount, string address, string addressTag = "", string addressName = "", long recvWindow = 6000000); /// /// Fetch deposit history. diff --git a/Binance.API.Csharp.Client.Models/Account/DepositHistory.cs b/Binance.API.Csharp.Client.Models/Account/DepositHistory.cs index 40ac1c1..af23dc1 100644 --- a/Binance.API.Csharp.Client.Models/Account/DepositHistory.cs +++ b/Binance.API.Csharp.Client.Models/Account/DepositHistory.cs @@ -13,6 +13,12 @@ public class Deposit public string Asset { get; set; } [JsonProperty("status")] public int Status { get; set; } + [JsonProperty("address")] + public string Address { get; set; } + [JsonProperty("addressTag")] + public string AddressTag { get; set; } + [JsonProperty("txId")] + public string TxId { get; set; } } public class DepositHistory diff --git a/Binance.API.Csharp.Client.Models/Account/WithdrawResponse.cs b/Binance.API.Csharp.Client.Models/Account/WithdrawResponse.cs index 25b479a..8723ac2 100644 --- a/Binance.API.Csharp.Client.Models/Account/WithdrawResponse.cs +++ b/Binance.API.Csharp.Client.Models/Account/WithdrawResponse.cs @@ -13,5 +13,11 @@ public class WithdrawResponse public string Msg { get; set; } [JsonProperty("success")] public bool Success { get; set; } + + + public override string ToString() + { + return $"WithdrawResponse.Success={Success} --- WithdrawResponse.Msg{Msg}"; + } } } diff --git a/Binance.API.Csharp.Client.Test/BinanceTest.cs b/Binance.API.Csharp.Client.Test/BinanceTest.cs index 03d6216..6b2ccf8 100644 --- a/Binance.API.Csharp.Client.Test/BinanceTest.cs +++ b/Binance.API.Csharp.Client.Test/BinanceTest.cs @@ -2,13 +2,14 @@ using Binance.API.Csharp.Client.Models.Enums; using System.Threading; using Binance.API.Csharp.Client.Models.WebSocket; +using System; namespace Binance.API.Csharp.Client.Test { [TestClass] public class BinanceTest { - private static ApiClient apiClient = new ApiClient("@YourApiKey", "@YourApiSecret"); + private static ApiClient apiClient = new ApiClient("Ax8fVbYarOuq3hJGiYlw62Oae78U0xvDbFUYlnenQxIQBWpbcxlC6N5NzFlviiUZ", "e3cKGFASMdaZKaRa64tKHnpTwOcKrZF1992xjWVWKEsjf7f2dL9prEHedtGltSWN"); private static BinanceClient binanceClient = new BinanceClient(apiClient,false); #region General @@ -119,7 +120,9 @@ public void GetAllOrders() [TestMethod] public void GetAccountInfo() { + // I need var accountInfo = binanceClient.GetAccountInfo().Result; + } [TestMethod] @@ -131,13 +134,18 @@ public void GetTradeList() [TestMethod] public void Withdraw() { - var withdrawResult = binanceClient.Withdraw("AST", 100m, "@YourDepositAddress").Result; + // I need + var withdrawResult = binanceClient.Withdraw("AST", 100m, "@YourDepositAddress", null).Result; } [TestMethod] public void GetDepositHistory() { - var depositHistory = binanceClient.GetDepositHistory("neo", DepositStatus.Success).Result; + // I need + var depositHistory = binanceClient.GetDepositHistory("btc", DepositStatus.Success, new DateTime(2020)).Result; + + Assert.IsTrue(depositHistory.Success); + Assert.IsNotNull(depositHistory.DepositList); } [TestMethod] diff --git a/Binance.API.Csharp.Client/BinanceClient.cs b/Binance.API.Csharp.Client/BinanceClient.cs index c37503a..17e9c24 100644 --- a/Binance.API.Csharp.Client/BinanceClient.cs +++ b/Binance.API.Csharp.Client/BinanceClient.cs @@ -429,9 +429,10 @@ public async Task> GetTradeList(string symbol, long recvWindo /// Amount to withdraw. /// Address where the asset will be deposited. /// Address name. + /// Address tag. /// Specific number of milliseconds the request is valid for. /// - public async Task Withdraw(string asset, decimal amount, string address, string addressName = "", long recvWindow = 5000) + public async Task Withdraw(string asset, decimal amount, string address, string addressTag = "", string addressName = "", long recvWindow = 5000) { if (string.IsNullOrWhiteSpace(asset)) { @@ -447,6 +448,7 @@ public async Task Withdraw(string asset, decimal amount, strin } var args = $"asset={asset.ToUpper()}&amount={amount}&address={address}" + + (!string.IsNullOrWhiteSpace(addressTag) && !string.IsNullOrEmpty(addressTag) ? $"&addressTag={addressTag}" : "") + (!string.IsNullOrWhiteSpace(addressName) ? $"&name={addressName}" : "") + $"&recvWindow={recvWindow}"; @@ -477,7 +479,7 @@ public async Task GetDepositHistory(string asset, DepositStatus? + (endTime.HasValue ? $"&endTime={endTime.Value.GetUnixTimeStamp()}" : "") + $"&recvWindow={recvWindow}"; - var result = await _apiClient.CallAsync(ApiMethod.POST, EndPoints.DepositHistory, true, args); + var result = await _apiClient.CallAsync(ApiMethod.GET, EndPoints.DepositHistory, true, args); return result; }