diff --git a/Kraken.Net/Interfaces/IKrakenClient.cs b/Kraken.Net/Interfaces/IKrakenClient.cs
index 31bd359..54a474d 100644
--- a/Kraken.Net/Interfaces/IKrakenClient.cs
+++ b/Kraken.Net/Interfaces/IKrakenClient.cs
@@ -35,7 +35,7 @@ public interface IKrakenClient: IRestClient
/// Filter list for specific assets
/// Cancellation token
/// Dictionary of asset info
- Task>> GetAssetsAsync(CancellationToken ct = default, params string[] assets);
+ Task>> GetAssetsAsync(IEnumerable? assets = null, CancellationToken ct = default);
///
/// Get a list of symbols and info about them
@@ -43,7 +43,15 @@ public interface IKrakenClient: IRestClient
/// Filter list for specific symbols
/// Cancellation token
/// Dictionary of symbol info
- Task>> GetSymbolsAsync(CancellationToken ct = default, params string[] symbols);
+ Task>> GetSymbolsAsync(IEnumerable? symbols = null, CancellationToken ct = default);
+
+ ///
+ /// Get tickers for symbol
+ ///
+ /// Symbol to get tickers for
+ /// Cancellation token
+ /// Dictionary with ticker info
+ Task>> GetTickersAsync(string symbol, CancellationToken ct = default);
///
/// Get tickers for symbols
@@ -51,7 +59,7 @@ public interface IKrakenClient: IRestClient
/// Symbols to get tickers for
/// Cancellation token
/// Dictionary with ticker info
- Task>> GetTickersAsync(CancellationToken ct = default, params string[] symbols);
+ Task>> GetTickersAsync(IEnumerable symbols, CancellationToken ct = default);
///
/// Gets kline data for a symbol
@@ -79,7 +87,7 @@ public interface IKrakenClient: IRestClient
/// Return trades since a specific time
/// Cancellation token
/// Recent trades
- Task> GetRecentTradesAsync(string symbol, DateTime? since = null, CancellationToken ct = default);
+ Task> GetTradeHistoryAsync(string symbol, DateTime? since = null, CancellationToken ct = default);
///
/// Get spread data for a symbol
@@ -128,6 +136,16 @@ public interface IKrakenClient: IRestClient
/// Closed orders page
Task> GetClosedOrdersAsync(string? clientOrderId = null, DateTime? startTime = null, DateTime? endTime = null, int? resultOffset = null, string? twoFactorPassword = null, CancellationToken ct = default);
+ ///
+ /// Get info on specific order
+ ///
+ /// Get orders by clientOrderId
+ /// Get order by its order id
+ /// Password or authentication app code if enabled
+ /// Cancellation token
+ /// Dictionary with order info
+ Task>> GetOrderAsync(string? orderId = null, string? clientOrderId = null, string? twoFactorPassword = null, CancellationToken ct = default);
+
///
/// Get info on specific orders
///
@@ -136,7 +154,7 @@ public interface IKrakenClient: IRestClient
/// Password or authentication app code if enabled
/// Cancellation token
/// Dictionary with order info
- Task>> GetOrdersAsync(string? clientOrderId = null, string? twoFactorPassword = null, CancellationToken ct = default, params string[] orderIds);
+ Task>> GetOrdersAsync(IEnumerable? orderIds = null, string? clientOrderId = null, string? twoFactorPassword = null, CancellationToken ct = default);
///
/// Get trade history
@@ -147,7 +165,16 @@ public interface IKrakenClient: IRestClient
/// Password or authentication app code if enabled
/// Cancellation token
/// Trade history page
- Task> GetTradeHistoryAsync(DateTime? startTime = null, DateTime? endTime = null, int? resultOffset = null, string? twoFactorPassword = null, CancellationToken ct = default);
+ Task> GetUserTradeHistoryAsync(DateTime? startTime = null, DateTime? endTime = null, int? resultOffset = null, string? twoFactorPassword = null, CancellationToken ct = default);
+
+ ///
+ /// Get info on specific trades
+ ///
+ /// The trade to get info on
+ /// Password or authentication app code if enabled
+ /// Cancellation token
+ /// Dictionary with trade info
+ Task>> GetUserTradeDetailsAsync(string tradeId, string? twoFactorPassword = null, CancellationToken ct = default);
///
/// Get info on specific trades
@@ -156,7 +183,7 @@ public interface IKrakenClient: IRestClient
/// Password or authentication app code if enabled
/// Cancellation token
/// Dictionary with trade info
- Task>> GetTradesAsync(string? twoFactorPassword = null, CancellationToken ct = default, params string[] tradeIds);
+ Task>> GetUserTradeDetailsAsync(IEnumerable tradeIds, string? twoFactorPassword = null, CancellationToken ct = default);
///
/// Get a list of open positions
@@ -165,7 +192,7 @@ public interface IKrakenClient: IRestClient
/// Password or authentication app code if enabled
/// Cancellation token
/// Dictionary with position info
- Task>> GetOpenPositionsAsync(string? twoFactorPassword = null, CancellationToken ct = default, params string[] transactionIds);
+ Task>> GetOpenPositionsAsync(IEnumerable? transactionIds = null, string? twoFactorPassword = null, CancellationToken ct = default);
///
/// Get ledger entries info
@@ -187,7 +214,7 @@ public interface IKrakenClient: IRestClient
/// Password or authentication app code if enabled
/// Cancellation token
/// Dictionary with ledger entry info
- Task>> GetLedgersEntryAsync(string? twoFactorPassword = null, CancellationToken ct = default, params string[] ledgerIds);
+ Task>> GetLedgersEntryAsync(IEnumerable? ledgerIds = null, string? twoFactorPassword = null, CancellationToken ct = default);
///
/// Get trade volume
@@ -196,7 +223,7 @@ public interface IKrakenClient: IRestClient
/// Password or authentication app code if enabled
/// Cancellation token
/// Trade fee info
- Task> GetTradeVolumeAsync(string? twoFactorPassword = null, CancellationToken ct = default, params string[] symbols);
+ Task> GetTradeVolumeAsync(IEnumerable? symbols = null, string? twoFactorPassword = null, CancellationToken ct = default);
///
/// Get deposit methods
@@ -305,7 +332,7 @@ Task> GetWithdrawInfoAsync(string asset, strin
/// Password or authentication app code if enabled
/// Cancellation token
/// Withdraw reference id
- Task> WithdrawFundsAsync(string asset, string key, decimal amount, string? twoFactorPassword = null, CancellationToken ct = default);
+ Task> WithdrawAsync(string asset, string key, decimal amount, string? twoFactorPassword = null, CancellationToken ct = default);
///
/// Get the token to connect to the private websocket streams
diff --git a/Kraken.Net/Kraken.Net.csproj b/Kraken.Net/Kraken.Net.csproj
index d4f70c2..ea1fe5a 100644
--- a/Kraken.Net/Kraken.Net.csproj
+++ b/Kraken.Net/Kraken.Net.csproj
@@ -49,7 +49,7 @@
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/Kraken.Net/KrakenClient.cs b/Kraken.Net/KrakenClient.cs
index 22df7ad..9d97bbf 100644
--- a/Kraken.Net/KrakenClient.cs
+++ b/Kraken.Net/KrakenClient.cs
@@ -99,10 +99,10 @@ public async Task> GetServerTimeAsync(CancellationToken
/// Filter list for specific assets
/// Cancellation token
/// Dictionary of asset info
- public async Task>> GetAssetsAsync(CancellationToken ct = default, params string[] assets)
+ public async Task>> GetAssetsAsync(IEnumerable? assets = null, CancellationToken ct = default)
{
var parameters = new Dictionary();
- if(assets.Any())
+ if(assets?.Any() == true)
parameters.AddOptionalParameter("asset", string.Join(",", assets));
return await Execute>(GetUri("0/public/Assets"), HttpMethod.Get, ct, parameters).ConfigureAwait(false);
@@ -114,22 +114,31 @@ public async Task>> GetAssetsA
/// Filter list for specific symbols
/// Cancellation token
/// Dictionary of symbol info
- public async Task>> GetSymbolsAsync(CancellationToken ct = default, params string[] symbols)
+ public async Task>> GetSymbolsAsync(IEnumerable? symbols = null, CancellationToken ct = default)
{
var parameters = new Dictionary();
- if (symbols.Any())
+ if (symbols?.Any() == true)
parameters.AddOptionalParameter("pair", string.Join(",", symbols));
return await Execute>(GetUri("0/public/AssetPairs"), HttpMethod.Get, ct, parameters).ConfigureAwait(false);
}
+ ///
+ /// Get tickers for symbol
+ ///
+ /// Symbol to get tickers for
+ /// Cancellation token
+ /// Dictionary with ticker info
+ public Task>> GetTickersAsync(string symbol, CancellationToken ct = default)
+ => GetTickersAsync(new string[] {symbol}, ct);
+
///
/// Get tickers for symbols
///
/// Symbols to get tickers for
/// Cancellation token
/// Dictionary with ticker info
- public async Task>> GetTickersAsync(CancellationToken ct = default, params string[] symbols)
+ public async Task>> GetTickersAsync(IEnumerable symbols, CancellationToken ct = default)
{
if (!symbols.Any())
throw new ArgumentException("No symbols defined to get ticker data for");
@@ -195,7 +204,7 @@ public async Task> GetOrderBookAsync(string symbo
/// Return trades since a specific time
/// Cancellation token
/// Recent trades
- public async Task> GetRecentTradesAsync(string symbol, DateTime? since = null, CancellationToken ct = default)
+ public async Task> GetTradeHistoryAsync(string symbol, DateTime? since = null, CancellationToken ct = default)
{
symbol.ValidateKrakenSymbol();
var parameters = new Dictionary()
@@ -291,6 +300,17 @@ public async Task> GetClosedOrdersAsync(st
return await Execute(GetUri("0/private/ClosedOrders"), HttpMethod.Post, ct, parameters, true).ConfigureAwait(false);
}
+ ///
+ /// Get info on specific order
+ ///
+ /// Get orders by clientOrderId
+ /// Get order by its order id
+ /// Password or authentication app code if enabled
+ /// Cancellation token
+ /// Dictionary with order info
+ public Task>> GetOrderAsync(string? orderId = null, string? clientOrderId = null, string? twoFactorPassword = null, CancellationToken ct = default)
+ => GetOrdersAsync(orderId == null? null: new[] { orderId }, clientOrderId, twoFactorPassword, ct);
+
///
/// Get info on specific orders
///
@@ -299,7 +319,7 @@ public async Task> GetClosedOrdersAsync(st
/// Password or authentication app code if enabled
/// Cancellation token
/// Dictionary with order info
- public async Task>> GetOrdersAsync(string? clientOrderId = null, string? twoFactorPassword = null, CancellationToken ct = default, params string[] orderIds)
+ public async Task>> GetOrdersAsync(IEnumerable? orderIds = null, string? clientOrderId = null, string? twoFactorPassword = null, CancellationToken ct = default)
{
if((string.IsNullOrEmpty(clientOrderId) && !orderIds.Any()) || (!string.IsNullOrEmpty(clientOrderId) && orderIds.Any()))
throw new ArgumentException("Either clientOrderId or ordersIds should be provided");
@@ -307,7 +327,7 @@ public async Task>> GetOrdersAsync
var parameters = new Dictionary();
parameters.AddOptionalParameter("trades", true);
parameters.AddOptionalParameter("userref", clientOrderId);
- parameters.AddOptionalParameter("txid", orderIds.Any() ? string.Join(",", orderIds): null);
+ parameters.AddOptionalParameter("txid", orderIds?.Any() == true ? string.Join(",", orderIds): null);
parameters.AddOptionalParameter("otp", twoFactorPassword ?? _otp);
return await Execute>(GetUri("0/private/QueryOrders"), HttpMethod.Post, ct, parameters, true).ConfigureAwait(false);
}
@@ -321,7 +341,7 @@ public async Task>> GetOrdersAsync
/// Password or authentication app code if enabled
/// Cancellation token
/// Trade history page
- public async Task> GetTradeHistoryAsync(DateTime? startTime = null, DateTime? endTime = null, int? resultOffset = null, string? twoFactorPassword = null, CancellationToken ct = default)
+ public async Task> GetUserTradeHistoryAsync(DateTime? startTime = null, DateTime? endTime = null, int? resultOffset = null, string? twoFactorPassword = null, CancellationToken ct = default)
{
var parameters = new Dictionary();
parameters.AddOptionalParameter("trades", true);
@@ -339,6 +359,17 @@ public async Task> GetTradeHistoryAsync(Date
return result;
}
+ ///
+ /// Get info on specific trades
+ ///
+ /// The trade to get info on
+ /// Password or authentication app code if enabled
+ /// Cancellation token
+ /// Dictionary with trade info
+ public Task>> GetUserTradeDetailsAsync(string tradeId, string? twoFactorPassword = null, CancellationToken ct = default)
+ => GetUserTradeDetailsAsync(new string[] { tradeId }, twoFactorPassword, ct);
+
+
///
/// Get info on specific trades
///
@@ -346,11 +377,11 @@ public async Task> GetTradeHistoryAsync(Date
/// Password or authentication app code if enabled
/// Cancellation token
/// Dictionary with trade info
- public async Task>> GetTradesAsync(string? twoFactorPassword = null, CancellationToken ct = default, params string[] tradeIds)
+ public async Task>> GetUserTradeDetailsAsync(IEnumerable tradeIds, string? twoFactorPassword = null, CancellationToken ct = default)
{
var parameters = new Dictionary();
parameters.AddOptionalParameter("trades", true);
- parameters.AddOptionalParameter("txid", tradeIds.Any() ? string.Join(",", tradeIds) : null);
+ parameters.AddOptionalParameter("txid", tradeIds?.Any() == true ? string.Join(",", tradeIds) : null);
parameters.AddOptionalParameter("otp", twoFactorPassword ?? _otp);
return await Execute>(GetUri("0/private/QueryTrades"), HttpMethod.Post, ct, parameters, true).ConfigureAwait(false);
}
@@ -362,11 +393,11 @@ public async Task>> GetTradesA
/// Password or authentication app code if enabled
/// Cancellation token
/// Dictionary with position info
- public async Task>> GetOpenPositionsAsync(string? twoFactorPassword = null, CancellationToken ct = default, params string[] transactionIds)
+ public async Task>> GetOpenPositionsAsync(IEnumerable? transactionIds = null, string? twoFactorPassword = null, CancellationToken ct = default)
{
var parameters = new Dictionary();
parameters.AddOptionalParameter("docalcs", true);
- parameters.AddOptionalParameter("txid", transactionIds.Any() ? string.Join(",", transactionIds) : null);
+ parameters.AddOptionalParameter("txid", transactionIds?.Any() == true ? string.Join(",", transactionIds) : null);
parameters.AddOptionalParameter("otp", twoFactorPassword ?? _otp);
return await Execute>(GetUri("0/private/OpenPositions"), HttpMethod.Post, ct, parameters, true).ConfigureAwait(false);
}
@@ -401,10 +432,10 @@ public async Task> GetLedgerInfoAsync(IEnumerabl
/// Password or authentication app code if enabled
/// Cancellation token
/// Dictionary with ledger entry info
- public async Task>> GetLedgersEntryAsync(string? twoFactorPassword = null, CancellationToken ct = default, params string[] ledgerIds)
+ public async Task>> GetLedgersEntryAsync(IEnumerable? ledgerIds = null, string? twoFactorPassword = null, CancellationToken ct = default)
{
var parameters = new Dictionary();
- parameters.AddOptionalParameter("id", ledgerIds.Any() ? string.Join(",", ledgerIds) : null);
+ parameters.AddOptionalParameter("id", ledgerIds?.Any() == true ? string.Join(",", ledgerIds) : null);
parameters.AddOptionalParameter("otp", twoFactorPassword ?? _otp);
return await Execute>(GetUri("0/private/QueryLedgers"), HttpMethod.Post, ct, parameters, true).ConfigureAwait(false);
}
@@ -416,11 +447,11 @@ public async Task>> GetLedge
/// Password or authentication app code if enabled
/// Cancellation token
/// Trade fee info
- public async Task> GetTradeVolumeAsync(string? twoFactorPassword = null, CancellationToken ct = default, params string[] symbols)
+ public async Task> GetTradeVolumeAsync(IEnumerable? symbols = null, string? twoFactorPassword = null, CancellationToken ct = default)
{
var parameters = new Dictionary();
parameters.AddOptionalParameter("fee-info", true);
- parameters.AddOptionalParameter("pair", symbols.Any() ? string.Join(",", symbols) : null);
+ parameters.AddOptionalParameter("pair", symbols?.Any() == true ? string.Join(",", symbols) : null);
parameters.AddOptionalParameter("otp", twoFactorPassword ?? _otp);
return await Execute(GetUri("0/private/TradeVolume"), HttpMethod.Post, ct, parameters, true).ConfigureAwait(false);
}
@@ -611,7 +642,7 @@ public async Task> GetWithdrawInfoAsync(string
}
///
- /// Withdraw funds
+ /// Place a withdraw request
///
/// The asset being withdrawn
/// The withdrawal key name, as set up on your account
@@ -619,7 +650,7 @@ public async Task> GetWithdrawInfoAsync(string
/// Password or authentication app code if enabled
/// Cancellation token
/// Withdraw reference id
- public async Task> WithdrawFundsAsync(string asset, string key, decimal amount, string? twoFactorPassword = null, CancellationToken ct = default)
+ public async Task> WithdrawAsync(string asset, string key, decimal amount, string? twoFactorPassword = null, CancellationToken ct = default)
{
asset.ValidateNotNull(nameof(asset));
key.ValidateNotNull(nameof(key));
@@ -660,7 +691,7 @@ async Task>> IExchangeClient.GetSymbols
async Task> IExchangeClient.GetTickerAsync(string symbol)
{
- var ticker = await GetTickersAsync(default, symbol).ConfigureAwait(false);
+ var ticker = await GetTickersAsync(symbol, default).ConfigureAwait(false);
return ticker.As(ticker.Data?.Select(d => d.Value).FirstOrDefault());
}
@@ -670,7 +701,7 @@ async Task>> IExchangeClient.GetTickers
if(!assets)
return new WebCallResult>(assets.ResponseStatusCode, assets.ResponseHeaders, null, assets.Error);
- var ticker = await GetTickersAsync(default, assets.Data.Select(d => d.Key).ToArray()).ConfigureAwait(false);
+ var ticker = await GetTickersAsync(assets.Data.Select(d => d.Key).ToArray(), default).ConfigureAwait(false);
return ticker.As>(ticker.Data?.Select(d => d.Value));
}
@@ -698,7 +729,7 @@ async Task> IExchangeClient.GetOrderBookAsync(st
async Task>> IExchangeClient.GetRecentTradesAsync(string symbol)
{
- var tradesResult = await GetRecentTradesAsync(symbol, null).ConfigureAwait(false);
+ var tradesResult = await GetTradeHistoryAsync(symbol, null).ConfigureAwait(false);
if (!tradesResult.Success)
return WebCallResult>.CreateErrorResult(tradesResult.ResponseStatusCode, tradesResult.ResponseHeaders, tradesResult.Error!);
@@ -713,13 +744,13 @@ async Task> IExchangeClient.PlaceOrderAsync(string
async Task> IExchangeClient.GetOrderAsync(string orderId, string? symbol)
{
- var result = await GetOrdersAsync(orderIds: orderId).ConfigureAwait(false);
+ var result = await GetOrderAsync(orderId).ConfigureAwait(false);
return result.As (result.Data?.FirstOrDefault().Value);
}
async Task>> IExchangeClient.GetTradesAsync(string orderId, string? symbol = null)
{
- var result = await GetTradeHistoryAsync().ConfigureAwait(false);
+ var result = await GetUserTradeHistoryAsync().ConfigureAwait(false);
return result.As>(result.Data?.Trades.Where(t => t.Value.OrderId == orderId).Select(o => (ICommonTrade)o.Value));
}