Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions Binance.API.Csharp.Client.Domain/Interfaces/IBinanceClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,17 @@ public interface IBinanceClient
Task<IEnumerable<Candlestick>> GetCandleSticks(string symbol, TimeInterval interval, DateTime? startTime = null, DateTime? endTime = null, int limit = 500);

/// <summary>
/// 24 hour price change statistics.
/// Single 24 hour price change statistics.
/// </summary>
/// <param name="symbol">Ticker symbol.</param>
/// <returns></returns>
Task<IEnumerable<PriceChangeInfo>> GetPriceChange24H(string symbol);
Task<PriceChangeInfo> GetPriceChange24H(string symbol);

/// <summary>
/// All 24 hour price change statistics.
/// </summary>
/// <returns></returns>
Task<IEnumerable<PriceChangeInfo>> GetAllPriceChanges24H();

/// <summary>
/// Latest price for all symbols.
Expand Down
10 changes: 8 additions & 2 deletions Binance.API.Csharp.Client.Test/BinanceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,15 @@ public void GetAggregateTrades()
}

[TestMethod]
public void GetPriceChange24H()
public void GetAllPriceChanges24H()
{
var priceChangeInfo = binanceClient.GetPriceChange24H().Result;
var priceChangeInfo = binanceClient.GetAllPriceChanges24H().Result;
}

[TestMethod]
public void GetSinglePriceChanges24H()
{
var priceChangeInfo = binanceClient.GetPriceChange24H("ethbtc").Result;
}

[TestMethod]
Expand Down
17 changes: 13 additions & 4 deletions Binance.API.Csharp.Client/BinanceClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,21 @@ public async Task<IEnumerable<Candlestick>> GetCandleSticks(string symbol, TimeI
/// </summary>
/// <param name="symbol">Ticker symbol.</param>
/// <returns></returns>
public async Task<IEnumerable<PriceChangeInfo>> GetPriceChange24H(string symbol = "")
public async Task<PriceChangeInfo> GetPriceChange24H(string symbol)
{
var args = string.IsNullOrWhiteSpace(symbol) ? "" : $"symbol={symbol.ToUpper()}";

var result = await _apiClient.CallAsync<IEnumerable< PriceChangeInfo>>(ApiMethod.GET, EndPoints.TickerPriceChange24H, false, args);
var args = $"symbol={symbol.ToUpper()}";
var result = await _apiClient.CallAsync<PriceChangeInfo>(ApiMethod.GET, EndPoints.TickerPriceChange24H, false, args);
return result;
}

/// <summary>
/// All 24 hour price change statistics.
/// </summary>
/// <param name="symbol">Ticker symbol.</param>
/// <returns></returns>
public async Task<IEnumerable<PriceChangeInfo>> GetAllPriceChanges24H()
{
var result = await _apiClient.CallAsync<IEnumerable<PriceChangeInfo>>(ApiMethod.GET, EndPoints.TickerPriceChange24H, false);
return result;
}

Expand Down