mirror of
https://github.com/JKorf/CryptoExchange.Net.git
synced 2026-08-21 13:23:07 +00:00
Shared exchange functionality (#214)
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
/// <summary>
|
||||
/// Client for request funding rate records
|
||||
/// </summary>
|
||||
public interface IFundingRateRestClient : ISharedClient
|
||||
{
|
||||
/// <summary>
|
||||
/// Funding rate request options
|
||||
/// </summary>
|
||||
GetFundingRateHistoryOptions GetFundingRateHistoryOptions { get; }
|
||||
/// <summary>
|
||||
/// Get funding rate records
|
||||
/// </summary>
|
||||
/// <param name="request">Request info</param>
|
||||
/// <param name="nextPageToken">The pagination token from the previous request to continue pagination</param>
|
||||
/// <param name="ct">Cancellation token</param>
|
||||
Task<ExchangeWebResult<IEnumerable<SharedFundingRate>>> GetFundingRateHistoryAsync(GetFundingRateHistoryRequest request, INextPageToken? nextPageToken = null, CancellationToken ct = default);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
/// <summary>
|
||||
/// Client for placing and managing futures orders
|
||||
/// </summary>
|
||||
public interface IFuturesOrderRestClient : ISharedClient
|
||||
{
|
||||
/// <summary>
|
||||
/// How the trading fee is deducted
|
||||
/// </summary>
|
||||
SharedFeeDeductionType FuturesFeeDeductionType { get; }
|
||||
/// <summary>
|
||||
/// How the asset is determined in which the trading fee is paid
|
||||
/// </summary>
|
||||
SharedFeeAssetType FuturesFeeAssetType { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Supported order types
|
||||
/// </summary>
|
||||
IEnumerable<SharedOrderType> FuturesSupportedOrderTypes { get; }
|
||||
/// <summary>
|
||||
/// Supported time in force
|
||||
/// </summary>
|
||||
IEnumerable<SharedTimeInForce> FuturesSupportedTimeInForce { get; }
|
||||
/// <summary>
|
||||
/// Quantity types support
|
||||
/// </summary>
|
||||
SharedQuantitySupport FuturesSupportedOrderQuantity { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Futures place order request options
|
||||
/// </summary>
|
||||
PlaceFuturesOrderOptions PlaceFuturesOrderOptions { get; }
|
||||
/// <summary>
|
||||
/// Place a new futures order
|
||||
/// </summary>
|
||||
/// <param name="request">Request info</param>
|
||||
/// <param name="ct">Cancellation token</param>
|
||||
Task<ExchangeWebResult<SharedId>> PlaceFuturesOrderAsync(PlaceFuturesOrderRequest request, CancellationToken ct = default);
|
||||
|
||||
/// <summary>
|
||||
/// Futures get order request options
|
||||
/// </summary>
|
||||
EndpointOptions<GetOrderRequest> GetFuturesOrderOptions { get; }
|
||||
/// <summary>
|
||||
/// Get info on a specific futures order
|
||||
/// </summary>
|
||||
/// <param name="request">Request info</param>
|
||||
/// <param name="ct">Cancellation token</param>
|
||||
Task<ExchangeWebResult<SharedFuturesOrder>> GetFuturesOrderAsync(GetOrderRequest request, CancellationToken ct = default);
|
||||
|
||||
/// <summary>
|
||||
/// Futures get open orders request options
|
||||
/// </summary>
|
||||
EndpointOptions<GetOpenOrdersRequest> GetOpenFuturesOrdersOptions { get; }
|
||||
/// <summary>
|
||||
/// Get info on a open futures orders
|
||||
/// </summary>
|
||||
/// <param name="request">Request info</param>
|
||||
/// <param name="ct">Cancellation token</param>
|
||||
Task<ExchangeWebResult<IEnumerable<SharedFuturesOrder>>> GetOpenFuturesOrdersAsync(GetOpenOrdersRequest request, CancellationToken ct = default);
|
||||
|
||||
/// <summary>
|
||||
/// Spot get closed orders request options
|
||||
/// </summary>
|
||||
PaginatedEndpointOptions<GetClosedOrdersRequest> GetClosedFuturesOrdersOptions { get; }
|
||||
/// <summary>
|
||||
/// Get info on closed futures orders
|
||||
/// </summary>
|
||||
/// <param name="request">Request info</param>
|
||||
/// <param name="nextPageToken">The pagination token from the previous request to continue pagination</param>
|
||||
/// <param name="ct">Cancellation token</param>
|
||||
Task<ExchangeWebResult<IEnumerable<SharedFuturesOrder>>> GetClosedFuturesOrdersAsync(GetClosedOrdersRequest request, INextPageToken? nextPageToken = null, CancellationToken ct = default);
|
||||
|
||||
/// <summary>
|
||||
/// Futures get order trades request options
|
||||
/// </summary>
|
||||
EndpointOptions<GetOrderTradesRequest> GetFuturesOrderTradesOptions { get; }
|
||||
/// <summary>
|
||||
/// Get trades for a specific futures order
|
||||
/// </summary>
|
||||
/// <param name="request">Request info</param>
|
||||
/// <param name="ct">Cancellation token</param>
|
||||
Task<ExchangeWebResult<IEnumerable<SharedUserTrade>>> GetFuturesOrderTradesAsync(GetOrderTradesRequest request, CancellationToken ct = default);
|
||||
|
||||
/// <summary>
|
||||
/// Futures user trades request options
|
||||
/// </summary>
|
||||
PaginatedEndpointOptions<GetUserTradesRequest> GetFuturesUserTradesOptions { get; }
|
||||
/// <summary>
|
||||
/// Get futures user trade records
|
||||
/// </summary>
|
||||
/// <param name="request">Request info</param>
|
||||
/// <param name="nextPageToken">The pagination token from the previous request to continue pagination</param>
|
||||
/// <param name="ct">Cancellation token</param>
|
||||
Task<ExchangeWebResult<IEnumerable<SharedUserTrade>>> GetFuturesUserTradesAsync(GetUserTradesRequest request, INextPageToken? nextPageToken = null, CancellationToken ct = default);
|
||||
|
||||
/// <summary>
|
||||
/// Futures cancel order request options
|
||||
/// </summary>
|
||||
EndpointOptions<CancelOrderRequest> CancelFuturesOrderOptions { get; }
|
||||
/// <summary>
|
||||
/// Cancel a futures order
|
||||
/// </summary>
|
||||
/// <param name="request">Request info</param>
|
||||
/// <param name="ct">Cancellation token</param>
|
||||
Task<ExchangeWebResult<SharedId>> CancelFuturesOrderAsync(CancelOrderRequest request, CancellationToken ct = default);
|
||||
|
||||
/// <summary>
|
||||
/// Positions request options
|
||||
/// </summary>
|
||||
EndpointOptions<GetPositionsRequest> GetPositionsOptions { get; }
|
||||
/// <summary>
|
||||
/// Get open position info
|
||||
/// </summary>
|
||||
/// <param name="request">Request info</param>
|
||||
/// <param name="ct">Cancellation token</param>
|
||||
Task<ExchangeWebResult<IEnumerable<SharedPosition>>> GetPositionsAsync(GetPositionsRequest request, CancellationToken ct = default);
|
||||
|
||||
/// <summary>
|
||||
/// Close position order request options
|
||||
/// </summary>
|
||||
EndpointOptions<ClosePositionRequest> ClosePositionOptions { get; }
|
||||
/// <summary>
|
||||
/// Close a currently open position
|
||||
/// </summary>
|
||||
/// <param name="request">Request info</param>
|
||||
/// <param name="ct">Cancellation token</param>
|
||||
/// <returns></returns>
|
||||
Task<ExchangeWebResult<SharedId>> ClosePositionAsync(ClosePositionRequest request, CancellationToken ct = default);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
/// <summary>
|
||||
/// Client for request futures symbol info
|
||||
/// </summary>
|
||||
public interface IFuturesSymbolRestClient : ISharedClient
|
||||
{
|
||||
/// <summary>
|
||||
/// Futures symbol request options
|
||||
/// </summary>
|
||||
EndpointOptions<GetSymbolsRequest> GetFuturesSymbolsOptions { get; }
|
||||
/// <summary>
|
||||
/// Get info on all futures symbols supported on the exchagne
|
||||
/// </summary>
|
||||
/// <param name="request">Request info</param>
|
||||
/// <param name="ct">Cancellation token</param>
|
||||
Task<ExchangeWebResult<IEnumerable<SharedFuturesSymbol>>> GetFuturesSymbolsAsync(GetSymbolsRequest request, CancellationToken ct = default);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
/// <summary>
|
||||
/// Client for requesting ticker info for futures symbols
|
||||
/// </summary>
|
||||
public interface IFuturesTickerRestClient : ISharedClient
|
||||
{
|
||||
/// <summary>
|
||||
/// Futures get ticker request options
|
||||
/// </summary>
|
||||
EndpointOptions<GetTickerRequest> GetFuturesTickerOptions { get; }
|
||||
/// <summary>
|
||||
/// Get ticker info for a specific futures symbol
|
||||
/// </summary>
|
||||
/// <param name="request">Request info</param>
|
||||
/// <param name="ct">Cancellation token</param>
|
||||
Task<ExchangeWebResult<SharedFuturesTicker>> GetFuturesTickerAsync(GetTickerRequest request, CancellationToken ct = default);
|
||||
|
||||
/// <summary>
|
||||
/// Futures get tickers request options
|
||||
/// </summary>
|
||||
EndpointOptions<GetTickersRequest> GetFuturesTickersOptions { get; }
|
||||
/// <summary>
|
||||
/// Get ticker info for aall futures symbols
|
||||
/// </summary>
|
||||
/// <param name="request">Request info</param>
|
||||
/// <param name="ct">Cancellation token</param>
|
||||
Task<ExchangeWebResult<IEnumerable<SharedFuturesTicker>>> GetFuturesTickersAsync(GetTickersRequest request, CancellationToken ct = default);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
/// <summary>
|
||||
/// Client for getting the index price klines for a symbol
|
||||
/// </summary>
|
||||
public interface IIndexPriceKlineRestClient : ISharedClient
|
||||
{
|
||||
/// <summary>
|
||||
/// Index price klines request options
|
||||
/// </summary>
|
||||
GetKlinesOptions GetIndexPriceKlinesOptions { get; }
|
||||
/// <summary>
|
||||
/// Get index price kline/candlestick data
|
||||
/// </summary>
|
||||
/// <param name="request">Request info</param>
|
||||
/// <param name="nextPageToken">The pagination token from the previous request to continue pagination</param>
|
||||
/// <param name="ct">Cancellation token</param>
|
||||
Task<ExchangeWebResult<IEnumerable<SharedFuturesKline>>> GetIndexPriceKlinesAsync(GetKlinesRequest request, INextPageToken? nextPageToken = null, CancellationToken ct = default);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
/// <summary>
|
||||
/// Client for managing the leverage of a symbol
|
||||
/// </summary>
|
||||
public interface ILeverageRestClient : ISharedClient
|
||||
{
|
||||
/// <summary>
|
||||
/// How the leverage setting is configured on the exchange
|
||||
/// </summary>
|
||||
SharedLeverageSettingMode LeverageSettingType { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Leverage request options
|
||||
/// </summary>
|
||||
EndpointOptions<GetLeverageRequest> GetLeverageOptions { get; }
|
||||
/// <summary>
|
||||
/// Get the current leverage setting for a symbol
|
||||
/// </summary>
|
||||
/// <param name="request">Request info</param>
|
||||
/// <param name="ct">Cancellation token</param>
|
||||
Task<ExchangeWebResult<SharedLeverage>> GetLeverageAsync(GetLeverageRequest request, CancellationToken ct = default);
|
||||
|
||||
/// <summary>
|
||||
/// Leverage set request options
|
||||
/// </summary>
|
||||
SetLeverageOptions SetLeverageOptions { get; }
|
||||
/// <summary>
|
||||
/// Set the leverage for a symbol
|
||||
/// </summary>
|
||||
/// <param name="request">Request info</param>
|
||||
/// <param name="ct">Cancellation token</param>
|
||||
Task<ExchangeWebResult<SharedLeverage>> SetLeverageAsync(SetLeverageRequest request, CancellationToken ct = default);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
/// <summary>
|
||||
/// Client for getting the mark price klines for a symbol
|
||||
/// </summary>
|
||||
public interface IMarkPriceKlineRestClient : ISharedClient
|
||||
{
|
||||
/// <summary>
|
||||
/// Mark price klines request options
|
||||
/// </summary>
|
||||
GetKlinesOptions GetMarkPriceKlinesOptions { get; }
|
||||
/// <summary>
|
||||
/// Get mark price kline/candlestick data
|
||||
/// </summary>
|
||||
/// <param name="request">Request info</param>
|
||||
/// <param name="nextPageToken">The pagination token from the previous request to continue pagination</param>
|
||||
/// <param name="ct">Cancellation token</param>
|
||||
Task<ExchangeWebResult<IEnumerable<SharedFuturesKline>>> GetMarkPriceKlinesAsync(GetKlinesRequest request, INextPageToken? nextPageToken = null, CancellationToken ct = default);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
/// <summary>
|
||||
/// Client for getting the open interest for a symbol
|
||||
/// </summary>
|
||||
public interface IOpenInterestRestClient : ISharedClient
|
||||
{
|
||||
/// <summary>
|
||||
/// Open interest request options
|
||||
/// </summary>
|
||||
EndpointOptions<GetOpenInterestRequest> GetOpenInterestOptions { get; }
|
||||
/// <summary>
|
||||
/// Get the open interest for a symbol
|
||||
/// </summary>
|
||||
/// <param name="request">Request info</param>
|
||||
/// <param name="ct">Cancellation token</param>
|
||||
Task<ExchangeWebResult<SharedOpenInterest>> GetOpenInterestAsync(GetOpenInterestRequest request, CancellationToken ct = default);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
/// <summary>
|
||||
/// Client for getting position history
|
||||
/// </summary>
|
||||
public interface IPositionHistoryRestClient : ISharedClient
|
||||
{
|
||||
/// <summary>
|
||||
/// Position history request options
|
||||
/// </summary>
|
||||
GetPositionHistoryOptions GetPositionHistoryOptions { get; }
|
||||
/// <summary>
|
||||
/// Get position history
|
||||
/// </summary>
|
||||
/// <param name="request">Request info</param>
|
||||
/// <param name="nextPageToken">The pagination token from the previous request to continue pagination</param>
|
||||
/// <param name="ct">Cancellation token</param>
|
||||
Task<ExchangeWebResult<IEnumerable<SharedPositionHistory>>> GetPositionHistoryAsync(GetPositionHistoryRequest request, INextPageToken? nextPageToken = null, CancellationToken ct = default);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
/// <summary>
|
||||
/// Client for managing the position mode setting
|
||||
/// </summary>
|
||||
public interface IPositionModeRestClient : ISharedClient
|
||||
{
|
||||
/// <summary>
|
||||
/// How the exchange handles setting the position mode
|
||||
/// </summary>
|
||||
SharedPositionModeSelection PositionModeSettingType { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Position mode request options
|
||||
/// </summary>
|
||||
GetPositionModeOptions GetPositionModeOptions { get; }
|
||||
/// <summary>
|
||||
/// Get the current position mode setting
|
||||
/// </summary>
|
||||
/// <param name="request">Request info</param>
|
||||
/// <param name="ct">Cancellation token</param>
|
||||
Task<ExchangeWebResult<SharedPositionModeResult>> GetPositionModeAsync(GetPositionModeRequest request, CancellationToken ct = default);
|
||||
|
||||
/// <summary>
|
||||
/// Position mode set request options
|
||||
/// </summary>
|
||||
SetPositionModeOptions SetPositionModeOptions { get; }
|
||||
/// <summary>
|
||||
/// Set the position mode to a new value
|
||||
/// </summary>
|
||||
/// <param name="request">Request info</param>
|
||||
/// <param name="ct">Cancellation token</param>
|
||||
Task<ExchangeWebResult<SharedPositionModeResult>> SetPositionModeAsync(SetPositionModeRequest request, CancellationToken ct = default);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user