1
0
mirror of https://github.com/JKorf/CryptoExchange.Net.git synced 2026-10-26 04:51:00 +00:00
This commit is contained in:
JKorf
2026-09-05 20:28:11 +02:00
parent 431ef93611
commit f215b729ed
263 changed files with 1313 additions and 391 deletions
@@ -12,11 +12,20 @@ namespace CryptoExchange.Net.SharedApis
/// <inheritdoc />
public override string Description => "Retrieve historical funding rates for a futures symbol";
private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
{
RequestParameterRule<GetFundingRateHistoryRequest>.Required(x => x.Symbol, "The symbol to retrieve funding rate history for", new SharedSymbol(TradingMode.PerpetualLinear, "ETH", "USDT")),
RequestParameterRule<GetFundingRateHistoryRequest>.Optional(x => x.StartTime, "Filter the result set by start time", DateTime.UtcNow.AddDays(-1)),
RequestParameterRule<GetFundingRateHistoryRequest>.Optional(x => x.EndTime, "Filter the result set by end time", DateTime.UtcNow.AddHours(-1)),
RequestParameterRule<GetFundingRateHistoryRequest>.Optional(x => x.Limit, "Limit the result set to a maximum number of items", 100),
RequestParameterRule<GetFundingRateHistoryRequest>.Optional(x => x.Direction, "The direction in which to retrieve the results", DataDirection.Descending),
};
/// <summary>
/// ctor
/// </summary>
public GetFundingRateHistoryOptions(string exchange, bool supportsAscending, bool supportsDescending, bool timeFilterSupported, int maxLimit, bool needsAuthentication)
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, needsAuthentication, nameof(IGetFundingRateHistoryRest.GetFundingRateHistoryAsync))
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, needsAuthentication, nameof(IGetFundingRateHistoryRest.GetFundingRateHistoryAsync), _defaultParameterRules)
{
}
@@ -0,0 +1,44 @@
using System;
namespace CryptoExchange.Net.SharedApis
{
/// <summary>
/// Request to retrieve funding rate history data
/// </summary>
public record GetFundingRateHistoryRequest : SharedSymbolRequest
{
/// <summary>
/// Filter by start time
/// </summary>
public DateTime? StartTime { get; set; }
/// <summary>
/// Filter by end time
/// </summary>
public DateTime? EndTime { get; set; }
/// <summary>
/// Max number of results
/// </summary>
public int? Limit { get; set; }
/// <summary>
/// Data direction
/// </summary>
public DataDirection? Direction { get; set; }
/// <summary>
/// ctor
/// </summary>
/// <param name="symbol">Symbol to request klines for</param>
/// <param name="startTime">Filter by start time</param>
/// <param name="endTime">Filter by end time</param>
/// <param name="limit">Max number of results</param>
/// <param name="direction">Data direction</param>
/// <param name="exchangeParameters">Exchange specific parameters</param>
public GetFundingRateHistoryRequest(SharedSymbol symbol, DateTime? startTime = null, DateTime? endTime = null, int? limit = null, DataDirection? direction = null, ExchangeParameters? exchangeParameters = null) : base(symbol, exchangeParameters)
{
StartTime = startTime;
EndTime = endTime;
Limit = limit;
Direction = direction;
}
}
}
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
/// <summary>
/// Funding rate request options.<br />
/// Use <see cref="CapabilityOptions.RequiredRequestParameters"/>, <see cref="CapabilityOptions.RequiredExchangeParameters"/> and <see cref="CapabilityOptions.OptionalExchangeParameters"/> to check for required and optional parameters for the request. <br />
/// Use <see cref="CapabilityOptions.RequestParameterRules"/> and <see cref="CapabilityOptions.ExchangeParameterRules"/> to check for required and optional parameters for the request. <br />
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
/// </summary>
GetFundingRateHistoryOptions GetFundingRateHistoryOptions { get; }