From 021717672282198a6b6891f737170e6ec3633d69 Mon Sep 17 00:00:00 2001 From: scotcowley Date: Mon, 18 Dec 2017 16:18:47 +0200 Subject: [PATCH 1/2] Added support for deposit and withdrawal history --- src/Bittrex.Api.Client/BittrexClient.cs | 45 +++++++++++++++++++ .../Models/DepositHistory.cs | 19 ++++++++ .../Models/WithdrawalHistory.cs | 18 ++++++++ 3 files changed, 82 insertions(+) create mode 100644 src/Bittrex.Api.Client/Models/DepositHistory.cs create mode 100644 src/Bittrex.Api.Client/Models/WithdrawalHistory.cs diff --git a/src/Bittrex.Api.Client/BittrexClient.cs b/src/Bittrex.Api.Client/BittrexClient.cs index b845642..3509768 100644 --- a/src/Bittrex.Api.Client/BittrexClient.cs +++ b/src/Bittrex.Api.Client/BittrexClient.cs @@ -338,6 +338,51 @@ public async Task> GetOrder(Guid uuid) return JsonConvert.DeserializeObject>(json); } + /// + /// Used to retrieve your deposit history. + /// + /// Optional a string literal for the currency (ie. BTC). If omitted, will return for all currencies + /// + public async Task> GetDepositHistory(String currencyName = null) + { + var nonce = GenerateNonce(); + + var url = $"{_accountBaseUrl}/getdeposithistory?apiKey={_apiKey}&nonce={nonce}"; + + if (currencyName != null) + { + url += $"¤cy={currencyName}"; + } + + var json = await GetPrivateAsync(url, _apiSecret) + .ConfigureAwait(false); + + + return JsonConvert.DeserializeObject>(json); + } + + /// + /// Used to retrieve your withdrawal history. + /// + /// Optional a string literal for the currency (ie. BTC). If omitted, will return for all currencies + /// + public async Task> GetWithdrawalHistory(String currencyName = null) + { + var nonce = GenerateNonce(); + + var url = $"{_accountBaseUrl}/getwithdrawalhistory?apiKey={_apiKey}&nonce={nonce}"; + + if (currencyName != null) + { + url += $"¤cy={currencyName}"; + } + + var json = await GetPrivateAsync(url, _apiSecret) + .ConfigureAwait(false); + + return JsonConvert.DeserializeObject>(json); + } + /// /// Execute a GET request for a public api end point /// diff --git a/src/Bittrex.Api.Client/Models/DepositHistory.cs b/src/Bittrex.Api.Client/Models/DepositHistory.cs new file mode 100644 index 0000000..989ab4b --- /dev/null +++ b/src/Bittrex.Api.Client/Models/DepositHistory.cs @@ -0,0 +1,19 @@ +using Newtonsoft.Json; +using System; + +namespace Bittrex.Api.Client.Models +{ + /// + /// An open order result from the /market/getopenorders end point + /// + public class DepositHistory + { + public int Id { get; set; } + public Decimal Amount { get; set; } + public String Currency { get; set; } + public int Confirmations { get; set; } + public DateTime LastUpdated { get; set; } + public String TxId { get; set; } + public String CryptoAddress { get; set; } + } +} diff --git a/src/Bittrex.Api.Client/Models/WithdrawalHistory.cs b/src/Bittrex.Api.Client/Models/WithdrawalHistory.cs new file mode 100644 index 0000000..5e4a800 --- /dev/null +++ b/src/Bittrex.Api.Client/Models/WithdrawalHistory.cs @@ -0,0 +1,18 @@ +using System; + +namespace Bittrex.Api.Client.Models +{ + /// + /// An open order result from the /market/getopenorders end point + /// + public class WithdrawalHistory + { + public int Id { get; set; } + public Decimal Amount { get; set; } + public String Currency { get; set; } + public int Confirmations { get; set; } + public DateTime LastUpdated { get; set; } + public String TxId { get; set; } + public String CryptoAddress { get; set; } + } +} From bd4ca07b2b2654bdc5af2c01bd5736065155ddb2 Mon Sep 17 00:00:00 2001 From: scotcowley Date: Mon, 18 Dec 2017 16:20:40 +0200 Subject: [PATCH 2/2] Removed incorrect comments --- src/Bittrex.Api.Client/Models/DepositHistory.cs | 3 --- src/Bittrex.Api.Client/Models/WithdrawalHistory.cs | 3 --- 2 files changed, 6 deletions(-) diff --git a/src/Bittrex.Api.Client/Models/DepositHistory.cs b/src/Bittrex.Api.Client/Models/DepositHistory.cs index 989ab4b..128fada 100644 --- a/src/Bittrex.Api.Client/Models/DepositHistory.cs +++ b/src/Bittrex.Api.Client/Models/DepositHistory.cs @@ -3,9 +3,6 @@ namespace Bittrex.Api.Client.Models { - /// - /// An open order result from the /market/getopenorders end point - /// public class DepositHistory { public int Id { get; set; } diff --git a/src/Bittrex.Api.Client/Models/WithdrawalHistory.cs b/src/Bittrex.Api.Client/Models/WithdrawalHistory.cs index 5e4a800..b3e5d57 100644 --- a/src/Bittrex.Api.Client/Models/WithdrawalHistory.cs +++ b/src/Bittrex.Api.Client/Models/WithdrawalHistory.cs @@ -2,9 +2,6 @@ namespace Bittrex.Api.Client.Models { - /// - /// An open order result from the /market/getopenorders end point - /// public class WithdrawalHistory { public int Id { get; set; }