Skip to content

Commit

Permalink
Added futures GetFundingInfoAsync endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
JKorf committed Jan 5, 2024
1 parent 151b637 commit 9b54c27
Show file tree
Hide file tree
Showing 8 changed files with 132 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"symbol": "BLZUSDT",
"adjustedFundingRateCap": "0.02500000",
"adjustedFundingRateFloor": "-0.02500000",
"fundingIntervalHours": 8
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"symbol": "BLZUSDT",
"adjustedFundingRateCap": "0.02500000",
"adjustedFundingRateFloor": "-0.02500000",
"fundingIntervalHours": 8
}
]
47 changes: 47 additions & 0 deletions Binance.Net/Binance.Net.xml
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,9 @@
<member name="M:Binance.Net.Clients.CoinFuturesApi.BinanceRestClientCoinFuturesApiExchangeData.GetFundingRatesAsync(System.String,System.Nullable{System.DateTime},System.Nullable{System.DateTime},System.Nullable{System.Int32},System.Threading.CancellationToken)">
<inheritdoc />
</member>
<member name="M:Binance.Net.Clients.CoinFuturesApi.BinanceRestClientCoinFuturesApiExchangeData.GetFundingInfoAsync(System.Threading.CancellationToken)">
<inheritdoc />
</member>
<member name="M:Binance.Net.Clients.CoinFuturesApi.BinanceRestClientCoinFuturesApiExchangeData.GetTopLongShortAccountRatioAsync(System.String,Binance.Net.Enums.PeriodInterval,System.Nullable{System.Int32},System.Nullable{System.DateTime},System.Nullable{System.DateTime},System.Threading.CancellationToken)">
<inheritdoc />
</member>
Expand Down Expand Up @@ -2019,6 +2022,9 @@
<member name="M:Binance.Net.Clients.UsdFuturesApi.BinanceRestClientUsdFuturesApiExchangeData.GetAggregatedTradeHistoryAsync(System.String,System.Nullable{System.Int64},System.Nullable{System.DateTime},System.Nullable{System.DateTime},System.Nullable{System.Int32},System.Threading.CancellationToken)">
<inheritdoc />
</member>
<member name="M:Binance.Net.Clients.UsdFuturesApi.BinanceRestClientUsdFuturesApiExchangeData.GetFundingInfoAsync(System.Threading.CancellationToken)">
<inheritdoc />
</member>
<member name="M:Binance.Net.Clients.UsdFuturesApi.BinanceRestClientUsdFuturesApiExchangeData.GetFundingRatesAsync(System.String,System.Nullable{System.DateTime},System.Nullable{System.DateTime},System.Nullable{System.Int32},System.Threading.CancellationToken)">
<inheritdoc />
</member>
Expand Down Expand Up @@ -5256,6 +5262,14 @@
<param name="ct">Cancellation token</param>
<returns>The candlestick data for the provided symbol</returns>
</member>
<member name="M:Binance.Net.Interfaces.Clients.CoinFuturesApi.IBinanceRestClientCoinFuturesApiExchangeData.GetFundingInfoAsync(System.Threading.CancellationToken)">
<summary>
Get funding rate info for symbols that had FundingRateCap/ FundingRateFloor / fundingIntervalHours adjustment
<para><a href="https://binance-docs.github.io/apidocs/delivery/en/#get-funding-rate-info" /></para>
</summary>
<param name="ct"></param>
<returns></returns>
</member>
<member name="M:Binance.Net.Interfaces.Clients.CoinFuturesApi.IBinanceRestClientCoinFuturesApiExchangeData.GetFundingRatesAsync(System.String,System.Nullable{System.DateTime},System.Nullable{System.DateTime},System.Nullable{System.Int32},System.Threading.CancellationToken)">
<summary>
Get funding rate history for the provided symbol
Expand Down Expand Up @@ -10899,6 +10913,14 @@
<param name="ct">Cancellation token</param>
<returns></returns>
</member>
<member name="M:Binance.Net.Interfaces.Clients.UsdFuturesApi.IBinanceRestClientUsdFuturesApiExchangeData.GetFundingInfoAsync(System.Threading.CancellationToken)">
<summary>
Get funding rate info for symbols that had FundingRateCap/ FundingRateFloor / fundingIntervalHours adjustment
<para><a href="https://binance-docs.github.io/apidocs/futures/en/#get-funding-rate-info" /></para>
</summary>
<param name="ct"></param>
<returns></returns>
</member>
<member name="M:Binance.Net.Interfaces.Clients.UsdFuturesApi.IBinanceRestClientUsdFuturesApiExchangeData.GetFundingRatesAsync(System.String,System.Nullable{System.DateTime},System.Nullable{System.DateTime},System.Nullable{System.Int32},System.Threading.CancellationToken)">
<summary>
Get funding rate history for the provided symbol
Expand Down Expand Up @@ -24532,6 +24554,31 @@
All symbols supported
</summary>
</member>
<member name="T:Binance.Net.Objects.Models.Futures.BinanceFuturesFundingInfo">
<summary>
Funding rate information for Futures trading
</summary>
</member>
<member name="P:Binance.Net.Objects.Models.Futures.BinanceFuturesFundingInfo.Symbol">
<summary>
The symbol the information is about
</summary>
</member>
<member name="P:Binance.Net.Objects.Models.Futures.BinanceFuturesFundingInfo.AdjustedFundingRateCap">
<summary>
Adjusted funding rate cap
</summary>
</member>
<member name="P:Binance.Net.Objects.Models.Futures.BinanceFuturesFundingInfo.AdjustedFundingRateFloor">
<summary>
Adjusted funding rate floor
</summary>
</member>
<member name="P:Binance.Net.Objects.Models.Futures.BinanceFuturesFundingInfo.FundingIntervalHours">
<summary>
Funding interval in hours
</summary>
</member>
<member name="T:Binance.Net.Objects.Models.Futures.BinanceFuturesFundingRateHistory">
<summary>
Funding rate information for Futures trading
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,16 @@ public async Task<WebCallResult<IEnumerable<BinanceFuturesFundingRateHistory>>>
return await _baseClient.SendRequestInternal<IEnumerable<BinanceFuturesFundingRateHistory>>(_baseClient.GetUrl(fundingRateHistoryEndpoint, api, publicVersion), HttpMethod.Get, ct, parameters).ConfigureAwait(false);
}

#endregion

#region Get Funding Info

/// <inheritdoc />
public async Task<WebCallResult<IEnumerable<BinanceFuturesFundingInfo>>> GetFundingInfoAsync(CancellationToken ct = default)
{
return await _baseClient.SendRequestInternal<IEnumerable<BinanceFuturesFundingInfo>>(_baseClient.GetUrl("fundingInfo", api, publicVersion), HttpMethod.Get, ct).ConfigureAwait(false);
}

#endregion

#region Top Trader Long/Short Ratio (Accounts)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,16 @@ public async Task<WebCallResult<IEnumerable<BinanceAggregatedTrade>>> GetAggrega

#endregion

#region Get Funding Info

/// <inheritdoc />
public async Task<WebCallResult<IEnumerable<BinanceFuturesFundingInfo>>> GetFundingInfoAsync(CancellationToken ct = default)
{
return await _baseClient.SendRequestInternal<IEnumerable<BinanceFuturesFundingInfo>>(_baseClient.GetUrl("fundingInfo", api, publicVersion), HttpMethod.Get, ct).ConfigureAwait(false);
}

#endregion

#region Get Funding Rate History

/// <inheritdoc />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,14 @@ public interface IBinanceRestClientCoinFuturesApiExchangeData
Task<WebCallResult<IEnumerable<IBinanceKline>>> GetKlinesAsync(string symbol, KlineInterval interval,
DateTime? startTime = null, DateTime? endTime = null, int? limit = null, CancellationToken ct = default);

/// <summary>
/// Get funding rate info for symbols that had FundingRateCap/ FundingRateFloor / fundingIntervalHours adjustment
/// <para><a href="https://binance-docs.github.io/apidocs/delivery/en/#get-funding-rate-info" /></para>
/// </summary>
/// <param name="ct"></param>
/// <returns></returns>
Task<WebCallResult<IEnumerable<BinanceFuturesFundingInfo>>> GetFundingInfoAsync(CancellationToken ct = default);

/// <summary>
/// Get funding rate history for the provided symbol
/// <para><a href="https://binance-docs.github.io/apidocs/delivery/en/#index-price-and-mark-price" /></para>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ public interface IBinanceRestClientUsdFuturesApiExchangeData
/// <returns></returns>
Task<WebCallResult<IEnumerable<IBinanceKline>>> GetKlinesAsync(string symbol, KlineInterval interval, DateTime? startTime = null, DateTime? endTime = null, int? limit = null, CancellationToken ct = default);

/// <summary>
/// Get funding rate info for symbols that had FundingRateCap/ FundingRateFloor / fundingIntervalHours adjustment
/// <para><a href="https://binance-docs.github.io/apidocs/futures/en/#get-funding-rate-info" /></para>
/// </summary>
/// <param name="ct"></param>
/// <returns></returns>
Task<WebCallResult<IEnumerable<BinanceFuturesFundingInfo>>> GetFundingInfoAsync(CancellationToken ct = default);

/// <summary>
/// Get funding rate history for the provided symbol
/// <para><a href="https://binance-docs.github.io/apidocs/futures/en/#get-funding-rate-history" /></para>
Expand Down
33 changes: 33 additions & 0 deletions Binance.Net/Objects/Models/Futures/BinanceFuturesFundingInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System;
using CryptoExchange.Net.Converters;
using Newtonsoft.Json;

namespace Binance.Net.Objects.Models.Futures
{
/// <summary>
/// Funding rate information for Futures trading
/// </summary>
public class BinanceFuturesFundingInfo
{
/// <summary>
/// The symbol the information is about
/// </summary>
[JsonProperty("symbol")]
public string Symbol { get; set; } = string.Empty;
/// <summary>
/// Adjusted funding rate cap
/// </summary>
[JsonProperty("adjustedFundingRateCap")]
public decimal AdjustedFundingRateCap { get; set; }
/// <summary>
/// Adjusted funding rate floor
/// </summary>
[JsonProperty("adjustedFundingRateFloor")]
public decimal AdjustedFundingRateFloor { get; set; }
/// <summary>
/// Funding interval in hours
/// </summary>
[JsonProperty("fundingIntervalHours")]
public int FundingIntervalHours { get; set; }
}
}

0 comments on commit 9b54c27

Please sign in to comment.