Skip to content

Commit

Permalink
Added newAssetNameResponse parameter to restClient.SpotApi.ExchangeDa…
Browse files Browse the repository at this point in the history
…ta.GetSymbolsAsync and restClient.SpotApi.ExchangeData.GetAssetsAsync
  • Loading branch information
JKorf committed Nov 19, 2024
1 parent 794b9a1 commit 5da47f4
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 22 deletions.
4 changes: 2 additions & 2 deletions Kraken.Net.UnitTests/KrakenRestIntegrationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ public async Task TestSpotExchangeData()
{
await RunAndCheckResult(client => client.SpotApi.ExchangeData.GetServerTimeAsync(default), false);
await RunAndCheckResult(client => client.SpotApi.ExchangeData.GetSystemStatusAsync(default), false);
await RunAndCheckResult(client => client.SpotApi.ExchangeData.GetAssetsAsync(default, default), false);
await RunAndCheckResult(client => client.SpotApi.ExchangeData.GetSymbolsAsync(default, default, default), false);
await RunAndCheckResult(client => client.SpotApi.ExchangeData.GetAssetsAsync(default, default, default), false);
await RunAndCheckResult(client => client.SpotApi.ExchangeData.GetSymbolsAsync(default, default, default, default), false);
await RunAndCheckResult(client => client.SpotApi.ExchangeData.GetTickerAsync("ETHUSDT", default), false);
await RunAndCheckResult(client => client.SpotApi.ExchangeData.GetTickersAsync(default, default), false);
await RunAndCheckResult(client => client.SpotApi.ExchangeData.GetKlinesAsync("ETHUSDT", Enums.KlineInterval.OneDay, default, default), false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ public async Task<WebCallResult<KrakenSystemStatus>> GetSystemStatusAsync(Cancel
#region Get Assets

/// <inheritdoc />
public async Task<WebCallResult<Dictionary<string, KrakenAssetInfo>>> GetAssetsAsync(IEnumerable<string>? assets = null, CancellationToken ct = default)
public async Task<WebCallResult<Dictionary<string, KrakenAssetInfo>>> GetAssetsAsync(IEnumerable<string>? assets = null, bool? newAssetNameResponse = null, CancellationToken ct = default)
{
var parameters = new ParameterCollection();
parameters.AddOptional("assetVersion", newAssetNameResponse);
if (assets?.Any() == true)
parameters.AddOptionalParameter("asset", string.Join(",", assets));

Expand All @@ -59,10 +60,11 @@ public async Task<WebCallResult<Dictionary<string, KrakenAssetInfo>>> GetAssetsA
#region Get Symbols

/// <inheritdoc />
public async Task<WebCallResult<Dictionary<string, KrakenSymbol>>> GetSymbolsAsync(IEnumerable<string>? symbols = null, string? countryCode = null, CancellationToken ct = default)
public async Task<WebCallResult<Dictionary<string, KrakenSymbol>>> GetSymbolsAsync(IEnumerable<string>? symbols = null, string? countryCode = null, bool? newAssetNameResponse = null, CancellationToken ct = default)
{
var parameters = new ParameterCollection();
parameters.AddOptionalParameter("country_code", countryCode);
parameters.AddOptional("assetVersion", newAssetNameResponse);
if (symbols?.Any() == true)
parameters.AddOptionalParameter("pair", string.Join(",", symbols));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,21 @@ public interface IKrakenRestClientSpotApiExchangeData
/// <para><a href="https://docs.kraken.com/api/docs/rest-api/get-asset-info" /></para>
/// </summary>
/// <param name="assets">Filter list for specific assets, for example `ETH`</param>
/// <param name="newAssetNameResponse">When set to true the asset names will be in the new format, for example `BTC` instead of `XBT`. Default is false.</param>
/// <param name="ct">Cancellation token</param>
/// <returns>Dictionary of asset info</returns>
Task<WebCallResult<Dictionary<string, KrakenAssetInfo>>> GetAssetsAsync(IEnumerable<string>? assets = null, CancellationToken ct = default);
Task<WebCallResult<Dictionary<string, KrakenAssetInfo>>> GetAssetsAsync(IEnumerable<string>? assets = null, bool? newAssetNameResponse = null, CancellationToken ct = default);

/// <summary>
/// Get a list of symbols and info about them
/// <para><a href="https://docs.kraken.com/api/docs/rest-api/get-tradable-asset-pairs" /></para>
/// </summary>
/// <param name="countryCode">Filter whats available for a specific country/region</param>
/// <param name="symbols">Filter list for specific symbols, for example `ETHUSDT`</param>
/// <param name="newAssetNameResponse">When set to true the asset names will be in the new format, for example `BTC` instead of `XBT`. Default is false.</param>
/// <param name="ct">Cancellation token</param>
/// <returns>Dictionary of symbol info</returns>
Task<WebCallResult<Dictionary<string, KrakenSymbol>>> GetSymbolsAsync(IEnumerable<string>? symbols = null, string? countryCode = null, CancellationToken ct = default);
Task<WebCallResult<Dictionary<string, KrakenSymbol>>> GetSymbolsAsync(IEnumerable<string>? symbols = null, string? countryCode = null, bool? newAssetNameResponse = null, CancellationToken ct = default);

/// <summary>
/// Get tickers for symbol
Expand Down
Loading

0 comments on commit 5da47f4

Please sign in to comment.