Skip to content

Commit

Permalink
Added startTime/endTime params to restClient.V5Api.ExchangeData.GetLo…
Browse files Browse the repository at this point in the history
…ngShortRatioAsync endpoint
  • Loading branch information
JKorf committed Nov 25, 2024
1 parent 2fb0421 commit a3e5d13
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
10 changes: 9 additions & 1 deletion ByBit.Net/Clients/V5/BybitRestClientApiExchangeData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -447,14 +447,22 @@ public async Task<WebCallResult<BybitLeverageTokenMarket>> GetLeverageTokenMarke
#region Get Long Short Ratio

/// <inheritdoc />
public async Task<WebCallResult<IEnumerable<BybitLongShortRatio>>> GetLongShortRatioAsync(Category category, string symbol, DataPeriod period, int? limit = null, CancellationToken ct = default)
public async Task<WebCallResult<IEnumerable<BybitLongShortRatio>>> GetLongShortRatioAsync(
Category category,
string symbol,
DataPeriod period,
DateTime? startTime = null,
DateTime? endTime = null,
int? limit = null, CancellationToken ct = default)
{
var parameters = new ParameterCollection()
{
{ "symbol", symbol }
};
parameters.AddEnum("category", category);
parameters.AddEnum("period", period);
parameters.AddOptionalMillisecondsString("startTime", startTime);
parameters.AddOptionalMillisecondsString("endTime", endTime);
parameters.AddOptional("limit", limit);

var result = await _baseClient.SendRequestAsync<BybitList<BybitLongShortRatio>>(_baseClient.GetUrl("v5/market/account-ratio"), HttpMethod.Get, ct, parameters).ConfigureAwait(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,11 @@ Task<WebCallResult<BybitResponse<BybitLinearInverseSymbol>>> GetLinearInverseSym
/// <param name="category">Category</param>
/// <param name="symbol">Symbol, for example `ETHUSDT`</param>
/// <param name="period">Data recording period</param>
/// <param name="startTime">Filter by start time</param>
/// <param name="endTime">Filter by end time</param>
/// <param name="limit">Limit for data size per page</param>
/// <param name="ct">Cancellation token</param>
/// <returns></returns>
Task<WebCallResult<IEnumerable<BybitLongShortRatio>>> GetLongShortRatioAsync(Category category, string symbol, DataPeriod period, int? limit = null, CancellationToken ct = default);
Task<WebCallResult<IEnumerable<BybitLongShortRatio>>> GetLongShortRatioAsync(Category category, string symbol, DataPeriod period, DateTime? startTime = null, DateTime? endTime = null, int? limit = null, CancellationToken ct = default);
}
}
2 changes: 1 addition & 1 deletion Bybit.UnitTests/BybitRestIntegrationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public async Task TestV5ExchangeData()
await RunAndCheckResult(client => client.V5Api.ExchangeData.GetDeliveryPriceAsync(Enums.Category.Linear, default, default, default, default, default), false);
await RunAndCheckResult(client => client.V5Api.ExchangeData.GetLeverageTokensAsync(default, default), false);
await RunAndCheckResult(client => client.V5Api.ExchangeData.GetLeverageTokenMarketAsync("BTC3L", default), false);
await RunAndCheckResult(client => client.V5Api.ExchangeData.GetLongShortRatioAsync(Enums.Category.Linear, "ETHUSDT", Enums.DataPeriod.OneDay, default, default), false);
await RunAndCheckResult(client => client.V5Api.ExchangeData.GetLongShortRatioAsync(Enums.Category.Linear, "ETHUSDT", Enums.DataPeriod.OneDay, default, default, default, default), false);
}

[Test]
Expand Down

0 comments on commit a3e5d13

Please sign in to comment.