mirror of
https://github.com/JKorf/CryptoExchange.Net.git
synced 2026-10-21 18:40:57 +00:00
wip
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
@@ -69,16 +70,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
if (val == null)
|
||||
return false;
|
||||
|
||||
try
|
||||
{
|
||||
Type t = Nullable.GetUnderlyingType(type) ?? type;
|
||||
Convert.ChangeType(val, t);
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return TryConvertValue(val, type, out _);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -99,16 +91,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
if (val == null)
|
||||
return false;
|
||||
|
||||
try
|
||||
{
|
||||
Type t = Nullable.GetUnderlyingType(type) ?? type;
|
||||
Convert.ChangeType(val, t);
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return TryConvertValue(val, type, out _);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -124,18 +107,14 @@ namespace CryptoExchange.Net.SharedApis
|
||||
if (val == null)
|
||||
return default;
|
||||
|
||||
if (val is T typeVal)
|
||||
return typeVal;
|
||||
if (!TryConvertValue(val, typeof(T), out var convertedValue))
|
||||
{
|
||||
throw new ArgumentException(
|
||||
$"Incorrect type for parameter, expected {typeof(T).Name}",
|
||||
name);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Type t = Nullable.GetUnderlyingType(typeof(T)) ?? typeof(T);
|
||||
return (T)Convert.ChangeType(val, t);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw new ArgumentException("Incorrect type for parameter, expected " + typeof(T).Name, name);
|
||||
}
|
||||
return (T)convertedValue!;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -158,16 +137,52 @@ namespace CryptoExchange.Net.SharedApis
|
||||
if (val == null)
|
||||
return default;
|
||||
|
||||
if (!TryConvertValue(val, typeof(T), out var convertedValue))
|
||||
{
|
||||
throw new ArgumentException(
|
||||
$"Incorrect type for parameter, expected {typeof(T).Name}",
|
||||
name);
|
||||
}
|
||||
|
||||
return (T)convertedValue!;
|
||||
}
|
||||
|
||||
private static bool TryConvertValue(
|
||||
object value,
|
||||
Type expectedType,
|
||||
out object? convertedValue)
|
||||
{
|
||||
var targetType = Nullable.GetUnderlyingType(expectedType) ?? expectedType;
|
||||
|
||||
if (targetType.IsInstanceOfType(value))
|
||||
{
|
||||
convertedValue = value;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (targetType.IsEnum)
|
||||
{
|
||||
convertedValue = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var type = typeof(T);
|
||||
Type t = Nullable.GetUnderlyingType(type) ?? type;
|
||||
var result = Convert.ChangeType(val, t);
|
||||
return (T)result;
|
||||
convertedValue = Convert.ChangeType(
|
||||
value,
|
||||
targetType,
|
||||
CultureInfo.InvariantCulture);
|
||||
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
catch (Exception ex) when (
|
||||
ex is FormatException ||
|
||||
ex is InvalidCastException ||
|
||||
ex is OverflowException ||
|
||||
ex is ArgumentException)
|
||||
{
|
||||
throw new ArgumentException("Incorrect type for parameter, expected " + typeof(T).Name, name);
|
||||
convertedValue = null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for canceling a futures order by client order id
|
||||
/// </summary>
|
||||
public class CancelFuturesOrderByClientOrderIdOptions : EndpointOptions<CancelOrderRequest, ICancelFuturesOrderByClientOrderIdRestClient>
|
||||
public class CancelFuturesOrderByClientOrderIdOptions : EndpointOptions<CancelOrderRequest, ICancelFuturesOrderByClientOrderIdEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Cancel a futures order by its client order id";
|
||||
@@ -11,7 +11,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public CancelFuturesOrderByClientOrderIdOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ICancelFuturesOrderByClientOrderIdRestClient.CancelFuturesOrderByClientOrderIdAsync))
|
||||
public CancelFuturesOrderByClientOrderIdOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ICancelFuturesOrderByClientOrderIdEndpoint.CancelFuturesOrderByClientOrderIdAsync))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for canceling a futures order
|
||||
/// </summary>
|
||||
public class CancelFuturesOrderOptions : EndpointOptions<CancelOrderRequest, ICancelFuturesOrderRestClient>
|
||||
public class CancelFuturesOrderOptions : EndpointOptions<CancelOrderRequest, ICancelFuturesOrderEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Cancel a futures order";
|
||||
@@ -15,7 +15,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public CancelFuturesOrderOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ICancelFuturesOrderRestClient.CancelFuturesOrderAsync))
|
||||
public CancelFuturesOrderOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ICancelFuturesOrderEndpoint.CancelFuturesOrderAsync))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for canceling a TP/SL
|
||||
/// </summary>
|
||||
public class CancelFuturesTpSlOptions : EndpointOptions<CancelTpSlRequest, ICancelFuturesTpSlRestClient>
|
||||
public class CancelFuturesTpSlOptions : EndpointOptions<CancelTpSlRequest, ICancelFuturesTpSlEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Cancel a take profit or stop loss order for a futures position";
|
||||
@@ -15,7 +15,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public CancelFuturesTpSlOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ICancelFuturesTpSlRestClient.CancelFuturesTpSlAsync))
|
||||
public CancelFuturesTpSlOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ICancelFuturesTpSlEndpoint.CancelFuturesTpSlAsync))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -7,7 +7,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for canceling spot trigger order
|
||||
/// </summary>
|
||||
public class CancelFuturesTriggerOrderOptions : EndpointOptions<CancelOrderRequest, ICancelFuturesTriggerOrderRestClient>
|
||||
public class CancelFuturesTriggerOrderOptions : EndpointOptions<CancelOrderRequest, ICancelFuturesTriggerOrderEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Cancel a futures trigger order";
|
||||
@@ -15,7 +15,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public CancelFuturesTriggerOrderOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ICancelFuturesTriggerOrderRestClient.CancelFuturesTriggerOrderAsync))
|
||||
public CancelFuturesTriggerOrderOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ICancelFuturesTriggerOrderEndpoint.CancelFuturesTriggerOrderAsync))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -8,7 +8,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for canceling a spot order
|
||||
/// </summary>
|
||||
public class CancelSpotOrderByClientOrderIdOptions : EndpointOptions<CancelOrderRequest, ICancelSpotOrderByClientOrderIdRestClient>
|
||||
public class CancelSpotOrderByClientOrderIdOptions : EndpointOptions<CancelOrderRequest, ICancelSpotOrderByClientOrderIdEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Cancel a spot order by its client order id";
|
||||
@@ -16,12 +16,12 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public CancelSpotOrderByClientOrderIdOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ICancelSpotOrderByClientOrderIdRestClient.CancelSpotOrderByClientOrderIdAsync))
|
||||
public CancelSpotOrderByClientOrderIdOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ICancelSpotOrderByClientOrderIdEndpoint.CancelSpotOrderByClientOrderIdAsync))
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override Error? ValidateRequest(CancelOrderRequest request, ICancelSpotOrderByClientOrderIdRestClient client)
|
||||
public override Error? ValidateRequest(CancelOrderRequest request, ICancelSpotOrderByClientOrderIdEndpoint client)
|
||||
{
|
||||
if (request.Symbol!.TradingMode != TradingMode.Spot)
|
||||
return ArgumentError.Invalid("TradingMode", $"TradingMode.{request.Symbol!.TradingMode} is not supported, should be Spot");
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for canceling a spot order
|
||||
/// </summary>
|
||||
public class CancelSpotOrderOptions : EndpointOptions<CancelOrderRequest, ICancelSpotOrderRestClient>
|
||||
public class CancelSpotOrderOptions : EndpointOptions<CancelOrderRequest, ICancelSpotOrderEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Cancel a spot order";
|
||||
@@ -16,12 +16,12 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public CancelSpotOrderOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ICancelSpotOrderRestClient.CancelSpotOrderAsync))
|
||||
public CancelSpotOrderOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ICancelSpotOrderEndpoint.CancelSpotOrderAsync))
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override Error? ValidateRequest(CancelOrderRequest request, ICancelSpotOrderRestClient client)
|
||||
public override Error? ValidateRequest(CancelOrderRequest request, ICancelSpotOrderEndpoint client)
|
||||
{
|
||||
if (request.Symbol!.TradingMode != TradingMode.Spot)
|
||||
return ArgumentError.Invalid("TradingMode", $"TradingMode.{request.Symbol!.TradingMode} is not supported, should be Spot");
|
||||
|
||||
+3
-3
@@ -8,7 +8,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for requesting spot trigger order
|
||||
/// </summary>
|
||||
public class CancelSpotTriggerOrderOptions : EndpointOptions<CancelOrderRequest, ICancelSpotTriggerOrderRestClient>
|
||||
public class CancelSpotTriggerOrderOptions : EndpointOptions<CancelOrderRequest, ICancelSpotTriggerOrderEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Cancel a spot trigger order";
|
||||
@@ -16,12 +16,12 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public CancelSpotTriggerOrderOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ICancelSpotTriggerOrderRestClient.CancelSpotTriggerOrderAsync))
|
||||
public CancelSpotTriggerOrderOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ICancelSpotTriggerOrderEndpoint.CancelSpotTriggerOrderAsync))
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override Error? ValidateRequest(CancelOrderRequest request, ICancelSpotTriggerOrderRestClient client)
|
||||
public override Error? ValidateRequest(CancelOrderRequest request, ICancelSpotTriggerOrderEndpoint client)
|
||||
{
|
||||
if (request.Symbol!.TradingMode != TradingMode.Spot)
|
||||
return ArgumentError.Invalid("TradingMode", $"TradingMode.{request.Symbol!.TradingMode} is not supported, should be Spot");
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for closing position
|
||||
/// </summary>
|
||||
public class ClosePositionOptions : EndpointOptions<ClosePositionRequest, IClosePositionRestClient>
|
||||
public class ClosePositionOptions : EndpointOptions<ClosePositionRequest, IClosePositionEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Close an open futures position";
|
||||
@@ -15,7 +15,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public ClosePositionOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IClosePositionRestClient.ClosePositionAsync))
|
||||
public ClosePositionOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IClosePositionEndpoint.ClosePositionAsync))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,10 +123,27 @@ namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
private static PropertyInfo[] _requestProperties = typeof(TRequest).GetProperties();
|
||||
|
||||
private List<ParameterDescription> _requiredRequestParameters = new();
|
||||
|
||||
/// <summary>
|
||||
/// Required optional parameters in the request. These can be provided via the `exchangeParameters` property of the request object.
|
||||
/// Request properties that are optional in the shared contract,
|
||||
/// but required by this exchange implementation.
|
||||
/// </summary>
|
||||
public List<ParameterDescription> RequiredOptionalParameters { get; set; } = new List<ParameterDescription>();
|
||||
public List<ParameterDescription> RequiredRequestParameters
|
||||
{
|
||||
get => _requiredRequestParameters;
|
||||
set => _requiredRequestParameters = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Use RequiredRequestParameters instead.
|
||||
/// </summary>
|
||||
[Obsolete("Use RequiredRequestParameters instead")]
|
||||
public List<ParameterDescription> RequiredOptionalParameters
|
||||
{
|
||||
get => _requiredRequestParameters;
|
||||
set => _requiredRequestParameters = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether this accepts multiple symbols (Only applicable to request requiring symbol parameters)
|
||||
@@ -155,7 +172,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
if (NeedsAuthentication && !client.Authenticated)
|
||||
return new NoApiCredentialsError();
|
||||
|
||||
foreach (var param in RequiredOptionalParameters)
|
||||
foreach (var param in RequiredRequestParameters)
|
||||
{
|
||||
if (param.Names!.All(x => _requestProperties.Single(p => p.Name == x).GetValue(request, null) == null))
|
||||
{
|
||||
@@ -199,10 +216,10 @@ namespace CryptoExchange.Net.SharedApis
|
||||
sb.Append(" Notes: ");
|
||||
sb.AppendLine(RequestNotes);
|
||||
}
|
||||
if (RequiredOptionalParameters.Any())
|
||||
if (RequiredRequestParameters.Any())
|
||||
{
|
||||
sb.AppendLine($" Required optional parameters:");
|
||||
foreach(var param in RequiredOptionalParameters)
|
||||
sb.AppendLine($" Required request parameters:");
|
||||
foreach(var param in RequiredRequestParameters)
|
||||
sb.AppendLine($" {param}");
|
||||
}
|
||||
if (RequiredExchangeParameters.Any())
|
||||
|
||||
+2
-2
@@ -5,7 +5,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for requesting tickers
|
||||
/// </summary>
|
||||
public class GetFuturesTickersOptions : EndpointOptions<GetTickersRequest, IGetAllFuturesTickersRestClient>
|
||||
public class GetAllFuturesTickersOptions : EndpointOptions<GetTickersRequest, IGetAllFuturesTickersEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Retrieve price ticker information for all futures symbols";
|
||||
@@ -18,7 +18,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetFuturesTickersOptions(string exchange, SharedTickerType? tickerCalcType = null) : base(exchange, false, nameof(IGetAllFuturesTickersRestClient.GetFuturesTickersAsync))
|
||||
public GetAllFuturesTickersOptions(string exchange, SharedTickerType? tickerCalcType = null) : base(exchange, false, nameof(IGetAllFuturesTickersEndpoint.GetAllFuturesTickersAsync))
|
||||
{
|
||||
TickerType = tickerCalcType ?? SharedTickerType.Day24H;
|
||||
}
|
||||
@@ -5,7 +5,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for requesting tickers
|
||||
/// </summary>
|
||||
public class GetAllSpotTickersOptions : EndpointOptions<GetTickersRequest, IGetAllSpotTickersRestClient>
|
||||
public class GetAllSpotTickersOptions : EndpointOptions<GetTickersRequest, IGetAllSpotTickersEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Retrieve price ticker information for all spot symbols";
|
||||
@@ -18,7 +18,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetAllSpotTickersOptions(string exchange, SharedTickerType? tickerCalcType = null) : base(exchange, false, nameof(IGetAllSpotTickersRestClient.GetAllSpotTickersAsync))
|
||||
public GetAllSpotTickersOptions(string exchange, SharedTickerType? tickerCalcType = null) : base(exchange, false, nameof(IGetAllSpotTickersEndpoint.GetAllSpotTickersAsync))
|
||||
{
|
||||
TickerType = tickerCalcType ?? SharedTickerType.Day24H;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for requesting asset info
|
||||
/// </summary>
|
||||
public class GetAssetOptions : EndpointOptions<GetAssetRequest, IGetAssetRestClient>
|
||||
public class GetAssetOptions : EndpointOptions<GetAssetRequest, IGetAssetEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Retrieve basic info for a single asset and networks it supports for withdrawals/deposits";
|
||||
@@ -15,7 +15,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetAssetOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetAssetRestClient.GetAssetAsync))
|
||||
public GetAssetOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetAssetEndpoint.GetAssetAsync))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for requesting assets info
|
||||
/// </summary>
|
||||
public class GetAssetsOptions : EndpointOptions<GetAssetsRequest, IGetAllAssetsRestClient>
|
||||
public class GetAssetsOptions : EndpointOptions<GetAssetsRequest, IGetAllAssetsEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Retrieve basic info for all assets and the networks they support for withdrawals/deposits";
|
||||
@@ -15,7 +15,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetAssetsOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetAllAssetsRestClient.GetAssetsAsync))
|
||||
public GetAssetsOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetAllAssetsEndpoint.GetAssetsAsync))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for requesting a transfer
|
||||
/// </summary>
|
||||
public class GetBalancesOptions : EndpointOptions<GetBalancesRequest, IGetBalancesRestClient>
|
||||
public class GetBalancesOptions : EndpointOptions<GetBalancesRequest, IGetBalancesEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Retrieve account balances";
|
||||
@@ -19,7 +19,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetBalancesOptions(string exchange, params AccountTypeFilter[] accountTypes) : base(exchange, true, nameof(IGetBalancesRestClient.GetBalancesAsync))
|
||||
public GetBalancesOptions(string exchange, params AccountTypeFilter[] accountTypes) : base(exchange, true, nameof(IGetBalancesEndpoint.GetBalancesAsync))
|
||||
{
|
||||
SupportedAccountTypes = accountTypes;
|
||||
}
|
||||
@@ -29,7 +29,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// </summary>
|
||||
public override Error? ValidateRequest(
|
||||
GetBalancesRequest request,
|
||||
IGetBalancesRestClient client)
|
||||
IGetBalancesEndpoint client)
|
||||
{
|
||||
if (request.AccountType != null && !IsValid(request.AccountType.Value))
|
||||
return ArgumentError.Invalid(nameof(request.AccountType), "Invalid AccountType");
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for requesting book ticker
|
||||
/// </summary>
|
||||
public class GetBookTickerOptions : EndpointOptions<GetBookTickerRequest, IGetBookTickerRestClient>
|
||||
public class GetBookTickerOptions : EndpointOptions<GetBookTickerRequest, IGetBookTickerEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Retrieve the best bid and ask price for a symbol";
|
||||
@@ -15,7 +15,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetBookTickerOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetBookTickerRestClient.GetBookTickerAsync))
|
||||
public GetBookTickerOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetBookTickerEndpoint.GetBookTickerAsync))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -7,7 +7,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for requesting deposit address
|
||||
/// </summary>
|
||||
public class GetDepositAddressesOptions : EndpointOptions<GetDepositAddressesRequest, IGetDepositAddressesRestClient>
|
||||
public class GetDepositAddressesOptions : EndpointOptions<GetDepositAddressesRequest, IGetDepositAddressesEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Retrieve deposit addresses for an asset";
|
||||
@@ -15,7 +15,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetDepositAddressesOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetDepositAddressesRestClient.GetDepositAddressesAsync))
|
||||
public GetDepositAddressesOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetDepositAddressesEndpoint.GetDepositAddressesAsync))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for requesting deposits
|
||||
/// </summary>
|
||||
public class GetDepositHistoryOptions : PaginatedEndpointOptions<GetDepositsRequest, IGetDepositHistoryRestClient>
|
||||
public class GetDepositHistoryOptions : PaginatedEndpointOptions<GetDepositsRequest, IGetDepositHistoryEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Retrieve deposit history";
|
||||
@@ -16,12 +16,12 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetDepositHistoryOptions(string exchange, bool supportsAscending, bool supportsDescending, bool timeFilterSupported, int maxLimit)
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, true, nameof(IGetDepositHistoryRestClient.GetDepositHistoryAsync))
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, true, nameof(IGetDepositHistoryEndpoint.GetDepositHistoryAsync))
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override Error? ValidateRequest(GetDepositsRequest request, IGetDepositHistoryRestClient client)
|
||||
public override Error? ValidateRequest(GetDepositsRequest request, IGetDepositHistoryEndpoint client)
|
||||
{
|
||||
if (!SupportsAscending && request.Direction == DataDirection.Ascending)
|
||||
return ArgumentError.Invalid(nameof(GetWithdrawalsRequest.Direction), $"Ascending direction is not supported");
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for requesting trading fee info
|
||||
/// </summary>
|
||||
public class GetFeeOptions : EndpointOptions<GetFeeRequest, IGetFeesRestClient>
|
||||
public class GetFeeOptions : EndpointOptions<GetFeeRequest, IGetFeesEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Retrieve trading fee information";
|
||||
@@ -15,7 +15,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetFeeOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetFeesRestClient.GetFeesAsync))
|
||||
public GetFeeOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetFeesEndpoint.GetFeesAsync))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -7,7 +7,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for requesting funding rate history
|
||||
/// </summary>
|
||||
public class GetFundingRateHistoryOptions : PaginatedEndpointOptions<GetFundingRateHistoryRequest, IGetFundingRateHistoryRestClient>
|
||||
public class GetFundingRateHistoryOptions : PaginatedEndpointOptions<GetFundingRateHistoryRequest, IGetFundingRateHistoryEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Retrieve historical funding rates for a futures symbol";
|
||||
@@ -16,12 +16,12 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetFundingRateHistoryOptions(string exchange, bool supportsAscending, bool supportsDescending, bool timeFilterSupported, int maxLimit, bool needsAuthentication)
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, needsAuthentication, nameof(IGetFundingRateHistoryRestClient.GetFundingRateHistoryAsync))
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, needsAuthentication, nameof(IGetFundingRateHistoryEndpoint.GetFundingRateHistoryAsync))
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override Error? ValidateRequest(GetFundingRateHistoryRequest request, IGetFundingRateHistoryRestClient client)
|
||||
public override Error? ValidateRequest(GetFundingRateHistoryRequest request, IGetFundingRateHistoryEndpoint client)
|
||||
{
|
||||
if (!SupportsAscending && request.Direction == DataDirection.Ascending)
|
||||
return ArgumentError.Invalid(nameof(GetWithdrawalsRequest.Direction), $"Ascending direction is not supported");
|
||||
|
||||
+3
-3
@@ -7,7 +7,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for requesting closed orders
|
||||
/// </summary>
|
||||
public class GetFuturesClosedOrdersOptions : PaginatedEndpointOptions<GetClosedOrdersRequest, IGetClosedFuturesOrdersRestClient>
|
||||
public class GetFuturesClosedOrdersOptions : PaginatedEndpointOptions<GetClosedOrdersRequest, IGetClosedFuturesOrdersEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Retrieve closed futures orders";
|
||||
@@ -16,12 +16,12 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetFuturesClosedOrdersOptions(string exchange, bool supportsAscending, bool supportsDescending, bool timeFilterSupported, int maxLimit)
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, true, nameof(IGetClosedFuturesOrdersRestClient.GetClosedFuturesOrdersAsync))
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, true, nameof(IGetClosedFuturesOrdersEndpoint.GetClosedFuturesOrdersAsync))
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override Error? ValidateRequest(GetClosedOrdersRequest request, IGetClosedFuturesOrdersRestClient client)
|
||||
public override Error? ValidateRequest(GetClosedOrdersRequest request, IGetClosedFuturesOrdersEndpoint client)
|
||||
{
|
||||
if (!SupportsAscending && request.Direction == DataDirection.Ascending)
|
||||
return ArgumentError.Invalid(nameof(GetClosedOrdersRequest.Direction), $"Ascending direction is not supported");
|
||||
|
||||
+2
-2
@@ -7,7 +7,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for getting a spot order by client order id
|
||||
/// </summary>
|
||||
public class GetFuturesOrderByClientOrderIdOptions : EndpointOptions<GetOrderRequest, IGetFuturesOrderByClientOrderIdRestClient>
|
||||
public class GetFuturesOrderByClientOrderIdOptions : EndpointOptions<GetOrderRequest, IGetFuturesOrderByClientOrderIdEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Retrieve a futures order by its client order id";
|
||||
@@ -15,7 +15,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetFuturesOrderByClientOrderIdOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetFuturesOrderByClientOrderIdRestClient.GetFuturesOrderByClientOrderIdAsync))
|
||||
public GetFuturesOrderByClientOrderIdOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetFuturesOrderByClientOrderIdEndpoint.GetFuturesOrderByClientOrderIdAsync))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for getting a futures order by id endpoint
|
||||
/// </summary>
|
||||
public class GetFuturesOrderOptions : EndpointOptions<GetOrderRequest, IGetFuturesOrderRestClient>
|
||||
public class GetFuturesOrderOptions : EndpointOptions<GetOrderRequest, IGetFuturesOrderEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Retrieve a futures order";
|
||||
@@ -15,7 +15,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetFuturesOrderOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetFuturesOrderRestClient.GetFuturesOrderAsync))
|
||||
public GetFuturesOrderOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetFuturesOrderEndpoint.GetFuturesOrderAsync))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -7,7 +7,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for getting a trades for an order
|
||||
/// </summary>
|
||||
public class GetFuturesOrderTradesOptions : EndpointOptions<GetOrderTradesRequest, IGetFuturesOrderTradesRestClient>
|
||||
public class GetFuturesOrderTradesOptions : EndpointOptions<GetOrderTradesRequest, IGetFuturesOrderTradesEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Retrieve trades for a futures order";
|
||||
@@ -15,7 +15,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetFuturesOrderTradesOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetFuturesOrderTradesRestClient.GetFuturesOrderTradesAsync))
|
||||
public GetFuturesOrderTradesOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetFuturesOrderTradesEndpoint.GetFuturesOrderTradesAsync))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for requesting symbol info
|
||||
/// </summary>
|
||||
public class GetFuturesSymbolsOptions : EndpointOptions<GetSymbolsRequest, IGetFuturesSymbolsRestClient>
|
||||
public class GetFuturesSymbolsOptions : EndpointOptions<GetSymbolsRequest, IGetFuturesSymbolsEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Retrieve supported futures symbols and their trading rules";
|
||||
@@ -16,12 +16,12 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetFuturesSymbolsOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetFuturesSymbolsRestClient.GetFuturesSymbolsAsync))
|
||||
public GetFuturesSymbolsOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetFuturesSymbolsEndpoint.GetFuturesSymbolsAsync))
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override Error? ValidateRequest(GetSymbolsRequest request, IGetFuturesSymbolsRestClient client)
|
||||
public override Error? ValidateRequest(GetSymbolsRequest request, IGetFuturesSymbolsEndpoint client)
|
||||
{
|
||||
if (request.BaseAssetType != null && request.BaseAssetSubType != null)
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for requesting ticker
|
||||
/// </summary>
|
||||
public class GetFuturesTickerOptions : EndpointOptions<GetTickerRequest, IGetFuturesTickerRestClient>
|
||||
public class GetFuturesTickerOptions : EndpointOptions<GetTickerRequest, IGetFuturesTickerEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Retrieve price ticker information for a futures symbol";
|
||||
@@ -18,7 +18,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetFuturesTickerOptions(string exchange, SharedTickerType? tickerCalcType = null) : base(exchange, false, nameof(IGetFuturesTickerRestClient.GetFuturesTickerAsync))
|
||||
public GetFuturesTickerOptions(string exchange, SharedTickerType? tickerCalcType = null) : base(exchange, false, nameof(IGetFuturesTickerEndpoint.GetFuturesTickerAsync))
|
||||
{
|
||||
TickerType = tickerCalcType ?? SharedTickerType.Day24H;
|
||||
}
|
||||
|
||||
+2
-2
@@ -7,7 +7,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for requesting futures trigger order
|
||||
/// </summary>
|
||||
public class GetFuturesTriggerOrderOptions : EndpointOptions<GetOrderRequest, IGetFuturesTriggerOrderRestClient>
|
||||
public class GetFuturesTriggerOrderOptions : EndpointOptions<GetOrderRequest, IGetFuturesTriggerOrderEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Retrieve a futures trigger order";
|
||||
@@ -15,7 +15,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetFuturesTriggerOrderOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetFuturesTriggerOrderRestClient.GetFuturesTriggerOrderAsync))
|
||||
public GetFuturesTriggerOrderOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetFuturesTriggerOrderEndpoint.GetFuturesTriggerOrderAsync))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -7,7 +7,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for requesting user trades
|
||||
/// </summary>
|
||||
public class GetFuturesUserTradesOptions : PaginatedEndpointOptions<GetUserTradesRequest, IGetFuturesUserTradesRestClient>
|
||||
public class GetFuturesUserTradeHistoryOptions : PaginatedEndpointOptions<GetUserTradesRequest, IGetFuturesUserTradeHistoryEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Retrieve futures user trade history";
|
||||
@@ -15,13 +15,13 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetFuturesUserTradesOptions(string exchange, bool supportsAscending, bool supportsDescending, bool timeFilterSupported, int maxLimit)
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, true, nameof(IGetFuturesUserTradesRestClient.GetFuturesUserTradesAsync))
|
||||
public GetFuturesUserTradeHistoryOptions(string exchange, bool supportsAscending, bool supportsDescending, bool timeFilterSupported, int maxLimit)
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, true, nameof(IGetFuturesUserTradeHistoryEndpoint.GetFuturesUserTradesAsync))
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override Error? ValidateRequest(GetUserTradesRequest request, IGetFuturesUserTradesRestClient client)
|
||||
public override Error? ValidateRequest(GetUserTradesRequest request, IGetFuturesUserTradeHistoryEndpoint client)
|
||||
{
|
||||
if (!SupportsAscending && request.Direction == DataDirection.Ascending)
|
||||
return ArgumentError.Invalid(nameof(GetUserTradesRequest.Direction), $"Ascending direction is not supported");
|
||||
+3
-3
@@ -8,7 +8,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for requesting kline/candlestick data
|
||||
/// </summary>
|
||||
public class GetIndexPriceKlinesOptions : PaginatedEndpointOptions<GetKlinesRequest, IGetIndexPriceKlinesRestClient>
|
||||
public class GetIndexPriceKlinesOptions : PaginatedEndpointOptions<GetKlinesRequest, IGetIndexPriceKlinesEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Retrieve index price candlestick data";
|
||||
@@ -26,7 +26,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetIndexPriceKlinesOptions(string exchange, bool supportsAscending, bool supportsDescending, bool timeFilterSupported, int maxLimit, bool needsAuthentication)
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, needsAuthentication, nameof(IGetIndexPriceKlinesRestClient.GetIndexPriceKlinesAsync))
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, needsAuthentication, nameof(IGetIndexPriceKlinesEndpoint.GetIndexPriceKlinesAsync))
|
||||
{
|
||||
SupportIntervals = new[]
|
||||
{
|
||||
@@ -64,7 +64,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
public bool IsSupported(SharedKlineInterval interval) => SupportIntervals.Contains(interval);
|
||||
|
||||
/// <inheritdoc />
|
||||
public override Error? ValidateRequest(GetKlinesRequest request, IGetIndexPriceKlinesRestClient client)
|
||||
public override Error? ValidateRequest(GetKlinesRequest request, IGetIndexPriceKlinesEndpoint client)
|
||||
{
|
||||
if (!IsSupported(request.Interval))
|
||||
return ArgumentError.Invalid(nameof(GetKlinesRequest.Interval), $"Interval {request.Interval} not supported");
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for requesting kline/candlestick data
|
||||
/// </summary>
|
||||
public class GetKlinesOptions : PaginatedEndpointOptions<GetKlinesRequest, IGetKlinesRestClient>
|
||||
public class GetKlinesOptions : PaginatedEndpointOptions<GetKlinesRequest, IGetKlinesEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Retrieve candlestick data for a symbol";
|
||||
@@ -26,7 +26,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetKlinesOptions(string exchange, bool supportsAscending, bool supportsDescending, bool timeFilterSupported, int maxLimit, bool needsAuthentication)
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, needsAuthentication, nameof(IGetKlinesRestClient.GetKlinesAsync))
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, needsAuthentication, nameof(IGetKlinesEndpoint.GetKlinesAsync))
|
||||
{
|
||||
SupportIntervals = new[]
|
||||
{
|
||||
@@ -51,7 +51,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetKlinesOptions(string exchange, bool supportsAscending, bool supportsDescending, bool timeFilterSupported, int maxLimit, bool needsAuthentication, params SharedKlineInterval[] intervals)
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, needsAuthentication, nameof(IGetKlinesRestClient.GetKlinesAsync))
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, needsAuthentication, nameof(IGetKlinesEndpoint.GetKlinesAsync))
|
||||
{
|
||||
SupportIntervals = intervals;
|
||||
}
|
||||
@@ -64,7 +64,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
public bool IsSupported(SharedKlineInterval interval) => SupportIntervals.Contains(interval);
|
||||
|
||||
/// <inheritdoc />
|
||||
public override Error? ValidateRequest(GetKlinesRequest request, IGetKlinesRestClient client)
|
||||
public override Error? ValidateRequest(GetKlinesRequest request, IGetKlinesEndpoint client)
|
||||
{
|
||||
if (!IsSupported(request.Interval))
|
||||
return ArgumentError.Invalid(nameof(GetKlinesRequest.Interval), $"Interval {request.Interval} not supported");
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for requesting asset info
|
||||
/// </summary>
|
||||
public class GetLeverageOptions : EndpointOptions<GetLeverageRequest, IGetLeverageRestClient>
|
||||
public class GetLeverageOptions : EndpointOptions<GetLeverageRequest, IGetLeverageEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Retrieve the current leverage for a futures symbol";
|
||||
@@ -15,7 +15,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetLeverageOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetLeverageRestClient.GetLeverageAsync))
|
||||
public GetLeverageOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetLeverageEndpoint.GetLeverageAsync))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for requesting kline/candlestick data
|
||||
/// </summary>
|
||||
public class GetMarkPriceKlinesOptions : PaginatedEndpointOptions<GetKlinesRequest, IGetMarkPriceKlinesRestClient>
|
||||
public class GetMarkPriceKlinesOptions : PaginatedEndpointOptions<GetKlinesRequest, IGetMarkPriceKlinesEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Retrieve mark price candlestick data";
|
||||
@@ -26,7 +26,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetMarkPriceKlinesOptions(string exchange, bool supportsAscending, bool supportsDescending, bool timeFilterSupported, int maxLimit, bool needsAuthentication)
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, needsAuthentication, nameof(IGetMarkPriceKlinesRestClient.GetMarkPriceKlinesAsync))
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, needsAuthentication, nameof(IGetMarkPriceKlinesEndpoint.GetMarkPriceKlinesAsync))
|
||||
{
|
||||
SupportIntervals = new[]
|
||||
{
|
||||
@@ -51,7 +51,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetMarkPriceKlinesOptions(string exchange, bool supportsAscending, bool supportsDescending, bool timeFilterSupported, int maxLimit, bool needsAuthentication, params SharedKlineInterval[] intervals)
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, needsAuthentication, nameof(IGetMarkPriceKlinesRestClient.GetMarkPriceKlinesAsync))
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, needsAuthentication, nameof(IGetMarkPriceKlinesEndpoint.GetMarkPriceKlinesAsync))
|
||||
{
|
||||
SupportIntervals = intervals;
|
||||
}
|
||||
@@ -64,7 +64,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
public bool IsSupported(SharedKlineInterval interval) => SupportIntervals.Contains(interval);
|
||||
|
||||
/// <inheritdoc />
|
||||
public override Error? ValidateRequest(GetKlinesRequest request, IGetMarkPriceKlinesRestClient client)
|
||||
public override Error? ValidateRequest(GetKlinesRequest request, IGetMarkPriceKlinesEndpoint client)
|
||||
{
|
||||
if (!IsSupported(request.Interval))
|
||||
return ArgumentError.Invalid(nameof(GetKlinesRequest.Interval), $"Interval {request.Interval} not supported");
|
||||
|
||||
+2
-2
@@ -7,7 +7,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for getting a futures order by id endpoint
|
||||
/// </summary>
|
||||
public class GetOpenFuturesOrdersOptions : EndpointOptions<GetOpenOrdersRequest, IGetOpenFuturesOrdersRestClient>
|
||||
public class GetOpenFuturesOrdersOptions : EndpointOptions<GetOpenOrdersRequest, IGetOpenFuturesOrdersEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Retrieve open futures orders";
|
||||
@@ -15,7 +15,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetOpenFuturesOrdersOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetOpenFuturesOrdersRestClient.GetOpenFuturesOrdersAsync))
|
||||
public GetOpenFuturesOrdersOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetOpenFuturesOrdersEndpoint.GetOpenFuturesOrdersAsync))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for requesting open interest
|
||||
/// </summary>
|
||||
public class GetOpenInterestOptions : EndpointOptions<GetOpenInterestRequest, IGetOpenInterestRestClient>
|
||||
public class GetOpenInterestOptions : EndpointOptions<GetOpenInterestRequest, IGetOpenInterestEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Retrieve open interest for a futures symbol";
|
||||
@@ -15,7 +15,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetOpenInterestOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetOpenInterestRestClient.GetOpenInterestAsync))
|
||||
public GetOpenInterestOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetOpenInterestEndpoint.GetOpenInterestAsync))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for getting a spot order by id endpoint
|
||||
/// </summary>
|
||||
public class GetOpenSpotOrdersOptions : EndpointOptions<GetOpenOrdersRequest, IGetOpenSpotOrdersRestClient>
|
||||
public class GetOpenSpotOrdersOptions : EndpointOptions<GetOpenOrdersRequest, IGetOpenSpotOrdersEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Retrieve open spot orders";
|
||||
@@ -15,7 +15,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetOpenSpotOrdersOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetOpenSpotOrdersRestClient.GetOpenSpotOrdersAsync))
|
||||
public GetOpenSpotOrdersOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetOpenSpotOrdersEndpoint.GetOpenSpotOrdersAsync))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for requesting order book
|
||||
/// </summary>
|
||||
public class GetOrderBookOptions : EndpointOptions<GetOrderBookRequest, IGetOrderBookRestClient>
|
||||
public class GetOrderBookOptions : EndpointOptions<GetOrderBookRequest, IGetOrderBookEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Retrieve the current order book for a symbol";
|
||||
@@ -31,7 +31,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetOrderBookOptions(string exchange, int minLimit, int maxLimit, bool authenticated)
|
||||
: base(exchange, authenticated, nameof(IGetOrderBookRestClient.GetOrderBookAsync))
|
||||
: base(exchange, authenticated, nameof(IGetOrderBookEndpoint.GetOrderBookAsync))
|
||||
{
|
||||
MinLimit = minLimit;
|
||||
MaxLimit = maxLimit;
|
||||
@@ -41,13 +41,13 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetOrderBookOptions(string exchange, int[] supportedLimits, bool authenticated)
|
||||
: base(exchange, authenticated, nameof(IGetOrderBookRestClient.GetOrderBookAsync))
|
||||
: base(exchange, authenticated, nameof(IGetOrderBookEndpoint.GetOrderBookAsync))
|
||||
{
|
||||
SupportedLimits = supportedLimits;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override Error? ValidateRequest(GetOrderBookRequest request, IGetOrderBookRestClient client)
|
||||
public override Error? ValidateRequest(GetOrderBookRequest request, IGetOrderBookEndpoint client)
|
||||
{
|
||||
if (request.Limit == null)
|
||||
return base.ValidateRequest(request, client);
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for requesting position history
|
||||
/// </summary>
|
||||
public class GetPositionHistoryOptions : PaginatedEndpointOptions<GetPositionHistoryRequest, IGetPositionHistoryRestClient>
|
||||
public class GetPositionHistoryOptions : PaginatedEndpointOptions<GetPositionHistoryRequest, IGetPositionHistoryEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Retrieve historical futures positions";
|
||||
@@ -16,12 +16,12 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetPositionHistoryOptions(string exchange, bool supportsAscending, bool supportsDescending, bool timeFilterSupported, int maxLimit)
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, true, nameof(IGetPositionHistoryRestClient.GetPositionHistoryAsync))
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, true, nameof(IGetPositionHistoryEndpoint.GetPositionHistoryAsync))
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override Error? ValidateRequest(GetPositionHistoryRequest request, IGetPositionHistoryRestClient client)
|
||||
public override Error? ValidateRequest(GetPositionHistoryRequest request, IGetPositionHistoryEndpoint client)
|
||||
{
|
||||
if (!SupportsAscending && request.Direction == DataDirection.Ascending)
|
||||
return ArgumentError.Invalid(nameof(GetWithdrawalsRequest.Direction), $"Ascending direction is not supported");
|
||||
|
||||
@@ -3,7 +3,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for requesting current position mode
|
||||
/// </summary>
|
||||
public class GetPositionModeOptions : EndpointOptions<GetPositionModeRequest, IGetPositionModeRestClient>
|
||||
public class GetPositionModeOptions : EndpointOptions<GetPositionModeRequest, IGetPositionModeEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Retrieve the current futures position mode";
|
||||
@@ -11,7 +11,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetPositionModeOptions(string exchange) : base(exchange, true, nameof(IGetPositionModeRestClient.GetPositionModeAsync))
|
||||
public GetPositionModeOptions(string exchange) : base(exchange, true, nameof(IGetPositionModeEndpoint.GetPositionModeAsync))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for requesting open positions
|
||||
/// </summary>
|
||||
public class GetPositionsOptions : EndpointOptions<GetPositionsRequest, IGetPositionsRestClient>
|
||||
public class GetPositionsOptions : EndpointOptions<GetPositionsRequest, IGetPositionsEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Retrieve open futures positions";
|
||||
@@ -15,7 +15,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetPositionsOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetPositionsRestClient.GetPositionsAsync))
|
||||
public GetPositionsOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetPositionsEndpoint.GetPositionsAsync))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for requesting recent trades
|
||||
/// </summary>
|
||||
public class GetRecentTradesOptions : EndpointOptions<GetRecentTradesRequest, IGetRecentTradesRestClient>
|
||||
public class GetRecentTradesOptions : EndpointOptions<GetRecentTradesRequest, IGetRecentTradesEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Retrieve recent public trades for a symbol";
|
||||
@@ -20,13 +20,13 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetRecentTradesOptions(string exchange, int limit, bool authenticated)
|
||||
: base(exchange, authenticated, nameof(IGetRecentTradesRestClient.GetRecentTradesAsync))
|
||||
: base(exchange, authenticated, nameof(IGetRecentTradesEndpoint.GetRecentTradesAsync))
|
||||
{
|
||||
MaxLimit = limit;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override Error? ValidateRequest(GetRecentTradesRequest request, IGetRecentTradesRestClient client)
|
||||
public override Error? ValidateRequest(GetRecentTradesRequest request, IGetRecentTradesEndpoint client)
|
||||
{
|
||||
var baseError = base.ValidateRequest(request, client);
|
||||
if (baseError != null)
|
||||
|
||||
+3
-3
@@ -7,7 +7,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for requesting user trades
|
||||
/// </summary>
|
||||
public class GetSpotClosedOrdersOptions : PaginatedEndpointOptions<GetClosedOrdersRequest, IGetClosedSpotOrdersRestClient>
|
||||
public class GetSpotClosedOrdersOptions : PaginatedEndpointOptions<GetClosedOrdersRequest, IGetClosedSpotOrdersEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Retrieve closed spot orders";
|
||||
@@ -16,12 +16,12 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetSpotClosedOrdersOptions(string exchange, bool supportsAscending, bool supportsDescending, bool timeFilterSupported, int maxLimit)
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, true, nameof(IGetClosedSpotOrdersRestClient.GetClosedSpotOrdersAsync))
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, true, nameof(IGetClosedSpotOrdersEndpoint.GetClosedSpotOrdersAsync))
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override Error? ValidateRequest(GetClosedOrdersRequest request, IGetClosedSpotOrdersRestClient client)
|
||||
public override Error? ValidateRequest(GetClosedOrdersRequest request, IGetClosedSpotOrdersEndpoint client)
|
||||
{
|
||||
if (request.Symbol!.TradingMode != TradingMode.Spot)
|
||||
return ArgumentError.Invalid("TradingMode", $"TradingMode.{request.Symbol!.TradingMode} is not supported, should be Spot");
|
||||
|
||||
+3
-3
@@ -8,7 +8,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for getting a spot order by client order id endpoint
|
||||
/// </summary>
|
||||
public class GetSpotOrderByClientOrderIdOptions : EndpointOptions<GetOrderRequest, IGetSpotOrderByClientOrderIdRestClient>
|
||||
public class GetSpotOrderByClientOrderIdOptions : EndpointOptions<GetOrderRequest, IGetSpotOrderByClientOrderIdEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Retrieve a spot order by its client order id";
|
||||
@@ -16,12 +16,12 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetSpotOrderByClientOrderIdOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetSpotOrderByClientOrderIdRestClient.GetSpotOrderByClientOrderIdAsync))
|
||||
public GetSpotOrderByClientOrderIdOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetSpotOrderByClientOrderIdEndpoint.GetSpotOrderByClientOrderIdAsync))
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override Error? ValidateRequest(GetOrderRequest request, IGetSpotOrderByClientOrderIdRestClient client)
|
||||
public override Error? ValidateRequest(GetOrderRequest request, IGetSpotOrderByClientOrderIdEndpoint client)
|
||||
{
|
||||
if (request.Symbol!.TradingMode != TradingMode.Spot)
|
||||
return ArgumentError.Invalid("TradingMode", $"TradingMode.{request.Symbol!.TradingMode} is not supported, should be Spot");
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for getting a spot order by id endpoint
|
||||
/// </summary>
|
||||
public class GetSpotOrderOptions : EndpointOptions<GetOrderRequest, IGetSpotOrderRestClient>
|
||||
public class GetSpotOrderOptions : EndpointOptions<GetOrderRequest, IGetSpotOrderEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Retrieve a spot order";
|
||||
@@ -16,12 +16,12 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetSpotOrderOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetSpotOrderRestClient.GetSpotOrderAsync))
|
||||
public GetSpotOrderOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetSpotOrderEndpoint.GetSpotOrderAsync))
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override Error? ValidateRequest(GetOrderRequest request, IGetSpotOrderRestClient client)
|
||||
public override Error? ValidateRequest(GetOrderRequest request, IGetSpotOrderEndpoint client)
|
||||
{
|
||||
if (request.Symbol!.TradingMode != TradingMode.Spot)
|
||||
return ArgumentError.Invalid("TradingMode", $"TradingMode.{request.Symbol!.TradingMode} is not supported, should be Spot");
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for getting trades for a spot order
|
||||
/// </summary>
|
||||
public class GetSpotOrderTradesOptions : EndpointOptions<GetOrderTradesRequest, IGetSpotOrderTradesRestClient>
|
||||
public class GetSpotOrderTradesOptions : EndpointOptions<GetOrderTradesRequest, IGetSpotOrderTradesEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Retrieve trades for a spot order";
|
||||
@@ -16,12 +16,12 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetSpotOrderTradesOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetSpotOrderTradesRestClient.GetSpotOrderTradesAsync))
|
||||
public GetSpotOrderTradesOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetSpotOrderTradesEndpoint.GetSpotOrderTradesAsync))
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override Error? ValidateRequest(GetOrderTradesRequest request, IGetSpotOrderTradesRestClient client)
|
||||
public override Error? ValidateRequest(GetOrderTradesRequest request, IGetSpotOrderTradesEndpoint client)
|
||||
{
|
||||
if (request.Symbol!.TradingMode != TradingMode.Spot)
|
||||
return ArgumentError.Invalid("TradingMode", $"TradingMode.{request.Symbol!.TradingMode} is not supported, should be Spot");
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for requesting symbol info
|
||||
/// </summary>
|
||||
public class GetSpotSymbolsOptions : EndpointOptions<GetSymbolsRequest, IGetSpotSymbolsRestClient>
|
||||
public class GetSpotSymbolsOptions : EndpointOptions<GetSymbolsRequest, IGetSpotSymbolsEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Retrieve supported spot symbols and their trading rules";
|
||||
@@ -16,13 +16,13 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetSpotSymbolsOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetSpotSymbolsRestClient.GetSpotSymbolsAsync))
|
||||
public GetSpotSymbolsOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetSpotSymbolsEndpoint.GetSpotSymbolsAsync))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public override Error? ValidateRequest(GetSymbolsRequest request, IGetSpotSymbolsRestClient client)
|
||||
public override Error? ValidateRequest(GetSymbolsRequest request, IGetSpotSymbolsEndpoint client)
|
||||
{
|
||||
if (request.BaseAssetType != null && request.BaseAssetSubType != null)
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for requesting ticker
|
||||
/// </summary>
|
||||
public class GetSpotTickerOptions : EndpointOptions<GetTickerRequest, IGetSpotTickerRestClient>
|
||||
public class GetSpotTickerOptions : EndpointOptions<GetTickerRequest, IGetSpotTickerEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Retrieve price ticker information for a spot symbol";
|
||||
@@ -18,7 +18,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetSpotTickerOptions(string exchange, SharedTickerType? tickerCalcType = null) : base(exchange, false, nameof(IGetSpotTickerRestClient.GetSpotTickerAsync))
|
||||
public GetSpotTickerOptions(string exchange, SharedTickerType? tickerCalcType = null) : base(exchange, false, nameof(IGetSpotTickerEndpoint.GetSpotTickerAsync))
|
||||
{
|
||||
TickerType = tickerCalcType ?? SharedTickerType.Day24H;
|
||||
}
|
||||
|
||||
+3
-3
@@ -8,7 +8,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for requesting spot trigger order
|
||||
/// </summary>
|
||||
public class GetSpotTriggerOrderOptions : EndpointOptions<GetOrderRequest, IGetSpotTriggerOrderRestClient>
|
||||
public class GetSpotTriggerOrderOptions : EndpointOptions<GetOrderRequest, IGetSpotTriggerOrderEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Retrieve a spot trigger order";
|
||||
@@ -16,12 +16,12 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetSpotTriggerOrderOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetSpotTriggerOrderRestClient.GetSpotTriggerOrderAsync))
|
||||
public GetSpotTriggerOrderOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetSpotTriggerOrderEndpoint.GetSpotTriggerOrderAsync))
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override Error? ValidateRequest(GetOrderRequest request, IGetSpotTriggerOrderRestClient client)
|
||||
public override Error? ValidateRequest(GetOrderRequest request, IGetSpotTriggerOrderEndpoint client)
|
||||
{
|
||||
if (request.Symbol!.TradingMode != TradingMode.Spot)
|
||||
return ArgumentError.Invalid("TradingMode", $"TradingMode.{request.Symbol!.TradingMode} is not supported, should be Spot");
|
||||
|
||||
+3
-3
@@ -7,7 +7,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for requesting user trades
|
||||
/// </summary>
|
||||
public class GetSpotUserTradeHistoryOptions : PaginatedEndpointOptions<GetUserTradesRequest, IGetSpotUserTradeHistoryRestClient>
|
||||
public class GetSpotUserTradeHistoryOptions : PaginatedEndpointOptions<GetUserTradesRequest, IGetSpotUserTradeHistoryEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Retrieve spot user trade history";
|
||||
@@ -16,12 +16,12 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetSpotUserTradeHistoryOptions(string exchange, bool supportsAscending, bool supportsDescending, bool timeFilterSupported, int maxLimit)
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, true, nameof(IGetSpotUserTradeHistoryRestClient.GetSpotUserTradeHistoryAsync))
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, true, nameof(IGetSpotUserTradeHistoryEndpoint.GetSpotUserTradeHistoryAsync))
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override Error? ValidateRequest(GetUserTradesRequest request, IGetSpotUserTradeHistoryRestClient client)
|
||||
public override Error? ValidateRequest(GetUserTradesRequest request, IGetSpotUserTradeHistoryEndpoint client)
|
||||
{
|
||||
if (request.Symbol!.TradingMode != TradingMode.Spot)
|
||||
return ArgumentError.Invalid("TradingMode", $"TradingMode.{request.Symbol!.TradingMode} is not supported, should be Spot");
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for requesting trade history
|
||||
/// </summary>
|
||||
public class GetTradeHistoryOptions : PaginatedEndpointOptions<GetTradeHistoryRequest, IGetTradeHistoryRestClient>
|
||||
public class GetTradeHistoryOptions : PaginatedEndpointOptions<GetTradeHistoryRequest, IGetTradeHistoryEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Retrieve public trade history for a symbol";
|
||||
@@ -16,12 +16,12 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetTradeHistoryOptions(string exchange, bool supportsAscending, bool supportsDescending, bool timeFilterSupported, int maxLimit, bool needsAuthentication)
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, needsAuthentication, nameof(IGetTradeHistoryRestClient.GetTradeHistoryAsync))
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, needsAuthentication, nameof(IGetTradeHistoryEndpoint.GetTradeHistoryAsync))
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override Error? ValidateRequest(GetTradeHistoryRequest request, IGetTradeHistoryRestClient client)
|
||||
public override Error? ValidateRequest(GetTradeHistoryRequest request, IGetTradeHistoryEndpoint client)
|
||||
{
|
||||
if (!SupportsAscending && request.Direction == DataDirection.Ascending)
|
||||
return ArgumentError.Invalid(nameof(GetTradeHistoryRequest.Direction), $"Ascending direction is not supported");
|
||||
|
||||
+3
-3
@@ -7,7 +7,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for requesting withdrawals
|
||||
/// </summary>
|
||||
public class GetWithdrawalHistoryOptions : PaginatedEndpointOptions<GetWithdrawalsRequest, IGetWithdrawalHistoryRestClient>
|
||||
public class GetWithdrawalHistoryOptions : PaginatedEndpointOptions<GetWithdrawalsRequest, IGetWithdrawalHistoryEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Retrieve withdrawal history";
|
||||
@@ -16,12 +16,12 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetWithdrawalHistoryOptions(string exchange, bool supportsAscending, bool supportsDescending, bool timeFilterSupported, int maxLimit)
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, true, nameof(IGetWithdrawalHistoryRestClient.GetWithdrawalHistoryAsync))
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, true, nameof(IGetWithdrawalHistoryEndpoint.GetWithdrawalHistoryAsync))
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override Error? ValidateRequest(GetWithdrawalsRequest request, IGetWithdrawalHistoryRestClient client)
|
||||
public override Error? ValidateRequest(GetWithdrawalsRequest request, IGetWithdrawalHistoryEndpoint client)
|
||||
{
|
||||
if (!SupportsAscending && request.Direction == DataDirection.Ascending)
|
||||
return ArgumentError.Invalid(nameof(GetWithdrawalsRequest.Direction), $"Ascending direction is not supported");
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for placing a new futures order
|
||||
/// </summary>
|
||||
public class PlaceFuturesOrderOptions : EndpointOptions<PlaceFuturesOrderRequest, IPlaceFuturesOrderRestClient>
|
||||
public class PlaceFuturesOrderOptions : EndpointOptions<PlaceFuturesOrderRequest, IPlaceFuturesOrderEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Place a new futures order";
|
||||
@@ -20,7 +20,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public PlaceFuturesOrderOptions(string exchange, bool supportsTpSl) : base(exchange, true, nameof(IPlaceFuturesOrderRestClient.PlaceFuturesOrderAsync))
|
||||
public PlaceFuturesOrderOptions(string exchange, bool supportsTpSl) : base(exchange, true, nameof(IPlaceFuturesOrderEndpoint.PlaceFuturesOrderAsync))
|
||||
{
|
||||
SupportsTpSl = supportsTpSl;
|
||||
}
|
||||
@@ -30,7 +30,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// </summary>
|
||||
public override Error? ValidateRequest(
|
||||
PlaceFuturesOrderRequest request,
|
||||
IPlaceFuturesOrderRestClient client
|
||||
IPlaceFuturesOrderEndpoint client
|
||||
)
|
||||
{
|
||||
if (!SupportsTpSl && (request.StopLossPrice != null || request.TakeProfitPrice != null))
|
||||
|
||||
+2
-2
@@ -5,7 +5,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for placing a new spot trigger order
|
||||
/// </summary>
|
||||
public class PlaceFuturesTriggerOrderOptions : EndpointOptions<PlaceFuturesTriggerOrderRequest, IPlaceFuturesTriggerOrderRestClient>
|
||||
public class PlaceFuturesTriggerOrderOptions : EndpointOptions<PlaceFuturesTriggerOrderRequest, IPlaceFuturesTriggerOrderEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Place a new futures trigger order";
|
||||
@@ -18,7 +18,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public PlaceFuturesTriggerOrderOptions(string exchange, bool holdsFunds) : base(exchange, true, nameof(IPlaceFuturesTriggerOrderRestClient.PlaceFuturesTriggerOrderAsync))
|
||||
public PlaceFuturesTriggerOrderOptions(string exchange, bool holdsFunds) : base(exchange, true, nameof(IPlaceFuturesTriggerOrderEndpoint.PlaceFuturesTriggerOrderAsync))
|
||||
{
|
||||
HoldsFunds = holdsFunds;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for placing a new spot order
|
||||
/// </summary>
|
||||
public class PlaceSpotOrderOptions : EndpointOptions<PlaceSpotOrderRequest, IPlaceSpotOrderRestClient>
|
||||
public class PlaceSpotOrderOptions : EndpointOptions<PlaceSpotOrderRequest, IPlaceSpotOrderEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Place a new spot order";
|
||||
@@ -16,7 +16,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public PlaceSpotOrderOptions(string exchange) : base(exchange, true, nameof(IPlaceSpotOrderRestClient.PlaceSpotOrderAsync))
|
||||
public PlaceSpotOrderOptions(string exchange) : base(exchange, true, nameof(IPlaceSpotOrderEndpoint.PlaceSpotOrderAsync))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// </summary>
|
||||
public override Error? ValidateRequest(
|
||||
PlaceSpotOrderRequest request,
|
||||
IPlaceSpotOrderRestClient client)
|
||||
IPlaceSpotOrderEndpoint client)
|
||||
{
|
||||
if (request.Symbol!.TradingMode != TradingMode.Spot)
|
||||
return ArgumentError.Invalid("TradingMode", $"TradingMode.{request.Symbol!.TradingMode} is not supported, should be Spot");
|
||||
|
||||
+3
-3
@@ -5,7 +5,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for placing a new spot trigger order
|
||||
/// </summary>
|
||||
public class PlaceSpotTriggerOrderOptions : EndpointOptions<PlaceSpotTriggerOrderRequest, IPlaceSpotTriggerOrderRestClient>
|
||||
public class PlaceSpotTriggerOrderOptions : EndpointOptions<PlaceSpotTriggerOrderRequest, IPlaceSpotTriggerOrderEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Place a new spot trigger order";
|
||||
@@ -18,7 +18,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public PlaceSpotTriggerOrderOptions(string exchange, bool holdsFunds) : base(exchange, true, nameof(IPlaceSpotTriggerOrderRestClient.PlaceSpotTriggerOrderAsync))
|
||||
public PlaceSpotTriggerOrderOptions(string exchange, bool holdsFunds) : base(exchange, true, nameof(IPlaceSpotTriggerOrderEndpoint.PlaceSpotTriggerOrderAsync))
|
||||
{
|
||||
HoldsFunds = holdsFunds;
|
||||
}
|
||||
@@ -28,7 +28,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// </summary>
|
||||
public override Error? ValidateRequest(
|
||||
PlaceSpotTriggerOrderRequest request,
|
||||
IPlaceSpotTriggerOrderRestClient client)
|
||||
IPlaceSpotTriggerOrderEndpoint client)
|
||||
{
|
||||
if (request.Symbol!.TradingMode != TradingMode.Spot)
|
||||
return ArgumentError.Invalid("TradingMode", $"TradingMode.{request.Symbol!.TradingMode} is not supported, should be Spot");
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for setting a TP/SL
|
||||
/// </summary>
|
||||
public class SetFuturesTpSlOptions : EndpointOptions<SetTpSlRequest, ISetFuturesTpSlRestClient>
|
||||
public class SetFuturesTpSlOptions : EndpointOptions<SetTpSlRequest, ISetFuturesTpSlEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Set take profit or stop loss values for a futures position";
|
||||
@@ -15,7 +15,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public SetFuturesTpSlOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ISetFuturesTpSlRestClient.SetFuturesTpSlAsync))
|
||||
public SetFuturesTpSlOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ISetFuturesTpSlEndpoint.SetFuturesTpSlAsync))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for setting leverage
|
||||
/// </summary>
|
||||
public class SetLeverageOptions : EndpointOptions<SetLeverageRequest, ISetLeverageRestClient>
|
||||
public class SetLeverageOptions : EndpointOptions<SetLeverageRequest, ISetLeverageEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Set the leverage for a futures symbol";
|
||||
@@ -11,7 +11,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public SetLeverageOptions(string exchange) : base(exchange, true, nameof(ISetLeverageRestClient.SetLeverageAsync))
|
||||
public SetLeverageOptions(string exchange) : base(exchange, true, nameof(ISetLeverageEndpoint.SetLeverageAsync))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for setting position mode
|
||||
/// </summary>
|
||||
public class SetPositionModeOptions : EndpointOptions<SetPositionModeRequest, ISetPositionModeRestClient>
|
||||
public class SetPositionModeOptions : EndpointOptions<SetPositionModeRequest, ISetPositionModeEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Set the futures position mode";
|
||||
@@ -11,7 +11,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public SetPositionModeOptions(string exchange) : base(exchange, true, nameof(ISetPositionModeRestClient.SetPositionModeOptions))
|
||||
public SetPositionModeOptions(string exchange) : base(exchange, true, nameof(ISetPositionModeEndpoint.SetPositionModeOptions))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for requesting a transfer
|
||||
/// </summary>
|
||||
public class TransferOptions : EndpointOptions<TransferRequest, ITransferRestClient>
|
||||
public class TransferOptions : EndpointOptions<TransferRequest, ITransferEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Transfer funds between account types";
|
||||
@@ -20,7 +20,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public TransferOptions(string exchange, SharedAccountType[] accountTypes) : base(exchange, true, nameof(ITransferRestClient.TransferAsync))
|
||||
public TransferOptions(string exchange, SharedAccountType[] accountTypes) : base(exchange, true, nameof(ITransferEndpoint.TransferAsync))
|
||||
{
|
||||
SupportedAccountTypes = accountTypes;
|
||||
}
|
||||
@@ -30,7 +30,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// </summary>
|
||||
public override Error? ValidateRequest(
|
||||
TransferRequest request,
|
||||
ITransferRestClient client)
|
||||
ITransferEndpoint client)
|
||||
{
|
||||
if (!SupportedAccountTypes.Contains(request.FromAccountType))
|
||||
return ArgumentError.Invalid(nameof(request.FromAccountType), "Invalid FromAccountType");
|
||||
|
||||
@@ -3,7 +3,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for requesting a withdrawal
|
||||
/// </summary>
|
||||
public class WithdrawOptions : EndpointOptions<WithdrawRequest, IWithdrawRestClient>
|
||||
public class WithdrawOptions : EndpointOptions<WithdrawRequest, IWithdrawEndpoint>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Withdraw an asset";
|
||||
@@ -11,7 +11,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public WithdrawOptions(string exchange) : base(exchange, true, nameof(IWithdrawRestClient.WithdrawAsync))
|
||||
public WithdrawOptions(string exchange) : base(exchange, true, nameof(IWithdrawEndpoint.WithdrawAsync))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq.Expressions;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates descriptions for properties on a shared request.
|
||||
/// </summary>
|
||||
public static class RequestParameter<TRequest>
|
||||
where TRequest : SharedRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Describe a request property which is required by an implementation.
|
||||
/// </summary>
|
||||
public static ParameterDescription Required<TValue>(
|
||||
Expression<Func<TRequest, TValue>> selector,
|
||||
string description,
|
||||
TValue exampleValue)
|
||||
{
|
||||
Expression body = selector.Body;
|
||||
|
||||
if (body is UnaryExpression unary
|
||||
&& unary.NodeType == ExpressionType.Convert)
|
||||
{
|
||||
body = unary.Operand;
|
||||
}
|
||||
|
||||
if (body is not MemberExpression member
|
||||
|| member.Member is not PropertyInfo property
|
||||
|| member.Expression != selector.Parameters[0])
|
||||
{
|
||||
throw new ArgumentException(
|
||||
"Selector must select a direct request property",
|
||||
nameof(selector));
|
||||
}
|
||||
|
||||
return new ParameterDescription(
|
||||
property.Name,
|
||||
property.PropertyType,
|
||||
description,
|
||||
exampleValue!);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates descriptions for exchange-specific parameters.
|
||||
/// </summary>
|
||||
public static class ExchangeParameterDescription
|
||||
{
|
||||
/// <summary>
|
||||
/// Describe a required exchange-specific parameter.
|
||||
/// </summary>
|
||||
public static ParameterDescription Required<TValue>(
|
||||
string name,
|
||||
string description,
|
||||
TValue exampleValue,
|
||||
params string[] aliases)
|
||||
=> Create(name, description, exampleValue, aliases);
|
||||
|
||||
/// <summary>
|
||||
/// Describe an optional exchange-specific parameter.
|
||||
/// </summary>
|
||||
public static ParameterDescription Optional<TValue>(
|
||||
string name,
|
||||
string description,
|
||||
TValue exampleValue,
|
||||
params string[] aliases)
|
||||
=> Create(name, description, exampleValue, aliases);
|
||||
|
||||
private static ParameterDescription Create<TValue>(
|
||||
string name,
|
||||
string description,
|
||||
TValue exampleValue,
|
||||
string[] aliases)
|
||||
{
|
||||
var names = new string[aliases.Length + 1];
|
||||
names[0] = name;
|
||||
Array.Copy(aliases, 0, names, 1, aliases.Length);
|
||||
|
||||
return new ParameterDescription(
|
||||
names,
|
||||
typeof(TValue),
|
||||
description,
|
||||
exampleValue!);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user