diff --git a/CryptoExchange.Net/SharedApis/Enums/SharedTransport.cs b/CryptoExchange.Net/SharedApis/Enums/SharedTransport.cs
index 669346f1..ca408b20 100644
--- a/CryptoExchange.Net/SharedApis/Enums/SharedTransport.cs
+++ b/CryptoExchange.Net/SharedApis/Enums/SharedTransport.cs
@@ -4,9 +4,18 @@ using System.Text;
namespace CryptoExchange.Net.SharedApis
{
+ ///
+ /// The type of transport used for the shared API
+ ///
public record SharedTransport(string Name)
{
+ ///
+ /// REST transport
+ ///
public static SharedTransport Rest { get; } = new("REST");
+ ///
+ /// WebSocket transport
+ ///
public static SharedTransport Socket { get; } = new("WebSocket");
}
}
diff --git a/CryptoExchange.Net/SharedApis/Models/Options/ParameterDescription.cs b/CryptoExchange.Net/SharedApis/Models/Options/ParameterDescription.cs
deleted file mode 100644
index 317ff86b..00000000
--- a/CryptoExchange.Net/SharedApis/Models/Options/ParameterDescription.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-using System;
-using System.Linq;
-
-namespace CryptoExchange.Net.SharedApis
-{
- ///
- /// Parameter description
- ///
- public class ParameterDescription
- {
- ///
- /// Possible names for the parameter. One of these names can be used to provide the parameter in the ExchangeParameters of the request.
- ///
- public string[] Names { get; set; }
- ///
- /// Type of the value
- ///
- public Type ValueType { get; set; }
- ///
- /// Parameter description
- ///
- public string Description { get; set; }
- ///
- /// Example value
- ///
- public object ExampleValue { get; set; }
-
- ///
- /// ctor
- ///
- public ParameterDescription(string parameterName, Type valueType, string description, object exampleValue)
- {
- Names = [parameterName];
- ValueType = valueType;
- Description = description;
- ExampleValue = exampleValue;
- }
-
- ///
- /// ctor
- ///
- public ParameterDescription(string[] parameterNames, Type valueType, string description, object exampleValue)
- {
- Names = parameterNames;
- ValueType = valueType;
- Description = description;
- ExampleValue = exampleValue;
- }
-
- ///
- public override string ToString()
- {
- return $"[{ValueType.Name}] {string.Join(" / ", Names.Select(x => $"\"{x}\""))}: {Description}";
- }
- }
-}
diff --git a/CryptoExchange.Net/SharedApis/Models/Responses/SharedAsset.cs b/CryptoExchange.Net/SharedApis/Models/SharedAsset.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Responses/SharedAsset.cs
rename to CryptoExchange.Net/SharedApis/Models/SharedAsset.cs
diff --git a/CryptoExchange.Net/SharedApis/Models/Responses/SharedBalance.cs b/CryptoExchange.Net/SharedApis/Models/SharedBalance.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Responses/SharedBalance.cs
rename to CryptoExchange.Net/SharedApis/Models/SharedBalance.cs
diff --git a/CryptoExchange.Net/SharedApis/Models/Responses/SharedBookTicker.cs b/CryptoExchange.Net/SharedApis/Models/SharedBookTicker.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Responses/SharedBookTicker.cs
rename to CryptoExchange.Net/SharedApis/Models/SharedBookTicker.cs
diff --git a/CryptoExchange.Net/SharedApis/SharedClientInfo.cs b/CryptoExchange.Net/SharedApis/Models/SharedClientInfo.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/SharedClientInfo.cs
rename to CryptoExchange.Net/SharedApis/Models/SharedClientInfo.cs
diff --git a/CryptoExchange.Net/SharedApis/Models/Responses/SharedDeposit.cs b/CryptoExchange.Net/SharedApis/Models/SharedDeposit.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Responses/SharedDeposit.cs
rename to CryptoExchange.Net/SharedApis/Models/SharedDeposit.cs
diff --git a/CryptoExchange.Net/SharedApis/Models/Responses/SharedDepositAddress.cs b/CryptoExchange.Net/SharedApis/Models/SharedDepositAddress.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Responses/SharedDepositAddress.cs
rename to CryptoExchange.Net/SharedApis/Models/SharedDepositAddress.cs
diff --git a/CryptoExchange.Net/SharedApis/Models/Responses/SharedFee.cs b/CryptoExchange.Net/SharedApis/Models/SharedFee.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Responses/SharedFee.cs
rename to CryptoExchange.Net/SharedApis/Models/SharedFee.cs
diff --git a/CryptoExchange.Net/SharedApis/Models/Responses/SharedFundingRate.cs b/CryptoExchange.Net/SharedApis/Models/SharedFundingRate.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Responses/SharedFundingRate.cs
rename to CryptoExchange.Net/SharedApis/Models/SharedFundingRate.cs
diff --git a/CryptoExchange.Net/SharedApis/Models/Responses/SharedFuturesKline.cs b/CryptoExchange.Net/SharedApis/Models/SharedFuturesKline.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Responses/SharedFuturesKline.cs
rename to CryptoExchange.Net/SharedApis/Models/SharedFuturesKline.cs
diff --git a/CryptoExchange.Net/SharedApis/Models/Responses/SharedFuturesOrder.cs b/CryptoExchange.Net/SharedApis/Models/SharedFuturesOrder.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Responses/SharedFuturesOrder.cs
rename to CryptoExchange.Net/SharedApis/Models/SharedFuturesOrder.cs
diff --git a/CryptoExchange.Net/SharedApis/Models/Responses/SharedFuturesOrderUpdate.cs b/CryptoExchange.Net/SharedApis/Models/SharedFuturesOrderUpdate.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Responses/SharedFuturesOrderUpdate.cs
rename to CryptoExchange.Net/SharedApis/Models/SharedFuturesOrderUpdate.cs
diff --git a/CryptoExchange.Net/SharedApis/Models/Responses/SharedFuturesSymbol.cs b/CryptoExchange.Net/SharedApis/Models/SharedFuturesSymbol.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Responses/SharedFuturesSymbol.cs
rename to CryptoExchange.Net/SharedApis/Models/SharedFuturesSymbol.cs
diff --git a/CryptoExchange.Net/SharedApis/Models/Responses/SharedFuturesTicker.cs b/CryptoExchange.Net/SharedApis/Models/SharedFuturesTicker.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Responses/SharedFuturesTicker.cs
rename to CryptoExchange.Net/SharedApis/Models/SharedFuturesTicker.cs
diff --git a/CryptoExchange.Net/SharedApis/Models/Responses/SharedFuturesTriggerOrder.cs b/CryptoExchange.Net/SharedApis/Models/SharedFuturesTriggerOrder.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Responses/SharedFuturesTriggerOrder.cs
rename to CryptoExchange.Net/SharedApis/Models/SharedFuturesTriggerOrder.cs
diff --git a/CryptoExchange.Net/SharedApis/Models/Responses/SharedId.cs b/CryptoExchange.Net/SharedApis/Models/SharedId.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Responses/SharedId.cs
rename to CryptoExchange.Net/SharedApis/Models/SharedId.cs
diff --git a/CryptoExchange.Net/SharedApis/Models/Responses/SharedIndexPrice.cs b/CryptoExchange.Net/SharedApis/Models/SharedIndexPrice.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Responses/SharedIndexPrice.cs
rename to CryptoExchange.Net/SharedApis/Models/SharedIndexPrice.cs
diff --git a/CryptoExchange.Net/SharedApis/Models/Responses/SharedKline.cs b/CryptoExchange.Net/SharedApis/Models/SharedKline.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Responses/SharedKline.cs
rename to CryptoExchange.Net/SharedApis/Models/SharedKline.cs
diff --git a/CryptoExchange.Net/SharedApis/Models/Responses/SharedLeverage.cs b/CryptoExchange.Net/SharedApis/Models/SharedLeverage.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Responses/SharedLeverage.cs
rename to CryptoExchange.Net/SharedApis/Models/SharedLeverage.cs
diff --git a/CryptoExchange.Net/SharedApis/Models/Responses/SharedMarkPrice.cs b/CryptoExchange.Net/SharedApis/Models/SharedMarkPrice.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Responses/SharedMarkPrice.cs
rename to CryptoExchange.Net/SharedApis/Models/SharedMarkPrice.cs
diff --git a/CryptoExchange.Net/SharedApis/Models/Responses/SharedOpenInterest.cs b/CryptoExchange.Net/SharedApis/Models/SharedOpenInterest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Responses/SharedOpenInterest.cs
rename to CryptoExchange.Net/SharedApis/Models/SharedOpenInterest.cs
diff --git a/CryptoExchange.Net/SharedApis/Models/Responses/SharedOrderBook.cs b/CryptoExchange.Net/SharedApis/Models/SharedOrderBook.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Responses/SharedOrderBook.cs
rename to CryptoExchange.Net/SharedApis/Models/SharedOrderBook.cs
diff --git a/CryptoExchange.Net/SharedApis/Models/Responses/SharedPosition.cs b/CryptoExchange.Net/SharedApis/Models/SharedPosition.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Responses/SharedPosition.cs
rename to CryptoExchange.Net/SharedApis/Models/SharedPosition.cs
diff --git a/CryptoExchange.Net/SharedApis/Models/Responses/SharedPositionHistory.cs b/CryptoExchange.Net/SharedApis/Models/SharedPositionHistory.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Responses/SharedPositionHistory.cs
rename to CryptoExchange.Net/SharedApis/Models/SharedPositionHistory.cs
diff --git a/CryptoExchange.Net/SharedApis/Models/Responses/SharedPositionModeResult.cs b/CryptoExchange.Net/SharedApis/Models/SharedPositionModeResult.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Responses/SharedPositionModeResult.cs
rename to CryptoExchange.Net/SharedApis/Models/SharedPositionModeResult.cs
diff --git a/CryptoExchange.Net/SharedApis/SharedQuantity.cs b/CryptoExchange.Net/SharedApis/Models/SharedQuantity.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/SharedQuantity.cs
rename to CryptoExchange.Net/SharedApis/Models/SharedQuantity.cs
diff --git a/CryptoExchange.Net/SharedApis/Models/Responses/SharedSpotOrder.cs b/CryptoExchange.Net/SharedApis/Models/SharedSpotOrder.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Responses/SharedSpotOrder.cs
rename to CryptoExchange.Net/SharedApis/Models/SharedSpotOrder.cs
diff --git a/CryptoExchange.Net/SharedApis/Models/Responses/SharedSpotOrderUpdate.cs b/CryptoExchange.Net/SharedApis/Models/SharedSpotOrderUpdate.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Responses/SharedSpotOrderUpdate.cs
rename to CryptoExchange.Net/SharedApis/Models/SharedSpotOrderUpdate.cs
diff --git a/CryptoExchange.Net/SharedApis/Models/Responses/SharedSpotSymbol.cs b/CryptoExchange.Net/SharedApis/Models/SharedSpotSymbol.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Responses/SharedSpotSymbol.cs
rename to CryptoExchange.Net/SharedApis/Models/SharedSpotSymbol.cs
diff --git a/CryptoExchange.Net/SharedApis/Models/Responses/SharedSpotTicker.cs b/CryptoExchange.Net/SharedApis/Models/SharedSpotTicker.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Responses/SharedSpotTicker.cs
rename to CryptoExchange.Net/SharedApis/Models/SharedSpotTicker.cs
diff --git a/CryptoExchange.Net/SharedApis/Models/Responses/SharedSpotTriggerOrder.cs b/CryptoExchange.Net/SharedApis/Models/SharedSpotTriggerOrder.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Responses/SharedSpotTriggerOrder.cs
rename to CryptoExchange.Net/SharedApis/Models/SharedSpotTriggerOrder.cs
diff --git a/CryptoExchange.Net/SharedApis/SharedSymbol.cs b/CryptoExchange.Net/SharedApis/Models/SharedSymbol.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/SharedSymbol.cs
rename to CryptoExchange.Net/SharedApis/Models/SharedSymbol.cs
diff --git a/CryptoExchange.Net/SharedApis/Models/Responses/SharedSymbolModel.cs b/CryptoExchange.Net/SharedApis/Models/SharedSymbolModel.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Responses/SharedSymbolModel.cs
rename to CryptoExchange.Net/SharedApis/Models/SharedSymbolModel.cs
diff --git a/CryptoExchange.Net/SharedApis/Models/Responses/SharedTicker.cs b/CryptoExchange.Net/SharedApis/Models/SharedTicker.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Responses/SharedTicker.cs
rename to CryptoExchange.Net/SharedApis/Models/SharedTicker.cs
diff --git a/CryptoExchange.Net/SharedApis/Models/Responses/SharedTrade.cs b/CryptoExchange.Net/SharedApis/Models/SharedTrade.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Responses/SharedTrade.cs
rename to CryptoExchange.Net/SharedApis/Models/SharedTrade.cs
diff --git a/CryptoExchange.Net/SharedApis/Models/Responses/SharedUserTrade.cs b/CryptoExchange.Net/SharedApis/Models/SharedUserTrade.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Responses/SharedUserTrade.cs
rename to CryptoExchange.Net/SharedApis/Models/SharedUserTrade.cs
diff --git a/CryptoExchange.Net/SharedApis/Models/Responses/SharedWithdrawal.cs b/CryptoExchange.Net/SharedApis/Models/SharedWithdrawal.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Responses/SharedWithdrawal.cs
rename to CryptoExchange.Net/SharedApis/Models/SharedWithdrawal.cs
diff --git a/CryptoExchange.Net/SharedApis/Models/Options/CapabilityOptions.cs b/CryptoExchange.Net/SharedApis/Options/CapabilityOptions.cs
similarity index 54%
rename from CryptoExchange.Net/SharedApis/Models/Options/CapabilityOptions.cs
rename to CryptoExchange.Net/SharedApis/Options/CapabilityOptions.cs
index 4c7663cf..77b58929 100644
--- a/CryptoExchange.Net/SharedApis/Models/Options/CapabilityOptions.cs
+++ b/CryptoExchange.Net/SharedApis/Options/CapabilityOptions.cs
@@ -13,26 +13,44 @@ namespace CryptoExchange.Net.SharedApis
///
public abstract class CapabilityOptions
{
- private List _requiredRequestParameters = new();
+ ///
+ /// Request parameter rules for the capability. The rules differ per exchange API and can be used to
+ /// dynamically discover and adjust the request parameters for a capability.
+ ///
+ public RequestParameterDescription[] RequestParameterRules { get; private set; } = [];
+ ///
+ /// Exchange parameter rules for the capability. These are parameters specific to the exchange API and
+ /// must be provided in the request via the ExchangeParameters property of the request object.
+ ///
+ public ExchangeParameterDescription[] ExchangeParameterRules { get; set; } = [];
+
+ private readonly RequestParameterDescription[] _defaultParameterRules;
+
///
- /// Request properties that are optional in the shared contract,
- /// but required by this exchange implementation.
+ /// Deprectaed, use RequestParameterRules instead.
///
- public List RequiredRequestParameters
+ public List RequiredOptionalParameters
{
- get => _requiredRequestParameters;
- set => _requiredRequestParameters = value;
+ get => RequestParameterRules.Where(x => x.DefaultSupport == RequestParameterSupport.Optional
+ && x.Support == RequestParameterSupport.Required)
+ .Cast()
+ .ToList();
}
///
- /// Use RequiredRequestParameters instead.
+ /// Deprectaed, use ExchangeParameterRules instead.
///
- [Obsolete("Use RequiredRequestParameters instead")]
- public List RequiredOptionalParameters
+ public List RequiredExchangeParameters
{
- get => _requiredRequestParameters;
- set => _requiredRequestParameters = value;
+ get => ExchangeParameterRules.Where(x => x.Requirement == ExchangeParameterRequirement.Required).Cast().ToList();
+ }
+ ///
+ /// Deprectaed, use ExchangeParameterRules instead.
+ ///
+ public List OptionalExchangeParameters
+ {
+ get => ExchangeParameterRules.Where(x => x.Requirement == ExchangeParameterRequirement.Optional).Cast().ToList();
}
///
@@ -43,15 +61,6 @@ namespace CryptoExchange.Net.SharedApis
/// The max number of symbols which can be passed in a call (Only applicable to request requiring symbol parameters)
///
public int? MaxSymbolCount { get; set; }
-
- ///
- /// Required exchange-specific parameters. These can be provided via the `exchangeParameters` property of the request object.
- ///
- public List RequiredExchangeParameters { get; set; } = new List();
- ///
- /// Optional exchange-specific parameters. These can be provided via the `exchangeParameters` property of the request object.
- ///
- public List OptionalExchangeParameters { get; set; } = new List();
///
/// Exchange
///
@@ -84,11 +93,59 @@ namespace CryptoExchange.Net.SharedApis
///
/// ctor
///
- public CapabilityOptions(string exchange, string operationName, bool needAuthentication)
+ public CapabilityOptions(
+ string exchange,
+ string operationName,
+ bool needAuthentication,
+ IEnumerable defaultParameterRules)
{
Exchange = exchange;
OperationName = operationName;
NeedsAuthentication = needAuthentication;
+
+ _defaultParameterRules = defaultParameterRules
+ .Select(x => x.WithSupport(x.DefaultSupport))
+ .ToArray();
+
+ RequestParameterRules = CombineParameters(
+ _defaultParameterRules,
+ Array.Empty());
+ }
+
+ ///
+ /// Set request parameter overrides for this instance
+ ///
+ /// The parameter overrides
+ protected void SetRequestParameters(IEnumerable overrides)
+ {
+ RequestParameterRules = CombineParameters(_defaultParameterRules, overrides);
+ }
+
+ private RequestParameterDescription[] CombineParameters(
+ RequestParameterDescription[] defaultParameters,
+ IEnumerable overrideParameters
+ )
+ {
+ var result = defaultParameters
+ .Select(x => x.WithSupport(x.DefaultSupport))
+ .ToList();
+
+ foreach (var item in overrideParameters)
+ {
+ var index = result.FindIndex(
+ x => x.Name == item.ParameterName);
+
+ if (index == -1)
+ {
+ throw new ArgumentException(
+ $"No default request parameter rule exists for " +
+ $"`{item.ParameterName}`");
+ }
+
+ result[index] = result[index].WithOverride(item);
+ }
+
+ return result.ToArray();
}
///
@@ -108,12 +165,13 @@ namespace CryptoExchange.Net.SharedApis
foreach (var param in RequiredExchangeParameters)
{
- if (param.Names!.All(x => ExchangeParameters.HasValue(exchangeParameters, Exchange, x, param.ValueType) != true))
+ if (ExchangeParameters.HasValue(exchangeParameters, Exchange, param.Name, param.ValueType) != true
+ && param.Aliases.Any(x => ExchangeParameters.HasValue(exchangeParameters, Exchange, x, param.ValueType) != true))
{
- if (param.Names.Length == 1)
- return ArgumentError.Invalid(string.Join("/", param.Names!), $"Exchange parameter `{param.Names[0]}` for exchange `{Exchange}` should be provided. Example: {param.ExampleValue}");
+ if (param.Aliases.Length == 0)
+ return ArgumentError.Invalid(param.Name, $"Exchange parameter `{param.Name}` for exchange `{Exchange}` should be provided. Example: {param.ExampleValue}");
else
- return ArgumentError.Invalid(string.Join("/", param.Names!), $"One of exchange parameters `{string.Join(", ", param.Names!)}` for exchange `{Exchange}` should be provided. Example: {param.ExampleValue}");
+ return ArgumentError.Invalid(string.Join("/", [param.Name, .. param.Aliases]), $"One of exchange parameters `{string.Join(", ", [param.Name, .. param.Aliases])}` for exchange `{Exchange}` should be provided. Example: {param.ExampleValue}");
}
}
@@ -137,22 +195,16 @@ namespace CryptoExchange.Net.SharedApis
sb.Append(" Notes: ");
sb.AppendLine(RequestNotes);
}
- if (RequiredRequestParameters.Any())
+ if (RequestParameterRules.Any())
{
- sb.AppendLine($" Required request parameters:");
- foreach (var param in RequiredRequestParameters)
+ sb.AppendLine($" Request parameters:");
+ foreach (var param in RequestParameterRules)
sb.AppendLine($" {param}");
}
- if (RequiredExchangeParameters.Any())
+ if (ExchangeParameterRules.Any())
{
- sb.AppendLine($" Required exchange specific parameters:");
- foreach (var param in RequiredExchangeParameters)
- sb.AppendLine($" {param}");
- }
- if (OptionalExchangeParameters.Any())
- {
- sb.AppendLine($" Optional exchange specific parameters:");
- foreach (var param in OptionalExchangeParameters)
+ sb.AppendLine($" Exchange specific parameters:");
+ foreach (var param in ExchangeParameterRules)
sb.AppendLine($" {param}");
}
sb.Append(" Needs authentication: ");
@@ -179,10 +231,17 @@ namespace CryptoExchange.Net.SharedApis
///
public override Type CapabilityType => typeof(TCapability);
+ ///
+ public virtual RequestParameterRuleOverride[] ParameterRuleOverwrites
+ {
+ set => SetRequestParameters(value);
+ }
+
///
/// ctor
///
- public CapabilityOptions(string exchange, bool needsAuthentication, string requestName) : base(exchange, requestName, needsAuthentication)
+ public CapabilityOptions(string exchange, bool needsAuthentication, string requestName, IEnumerable defaultParameterRules)
+ : base(exchange, requestName, needsAuthentication, defaultParameterRules)
{
}
@@ -197,14 +256,28 @@ namespace CryptoExchange.Net.SharedApis
if (NeedsAuthentication && !client.Authenticated)
return new NoApiCredentialsError();
- foreach (var param in RequiredRequestParameters)
+ foreach (var param in RequestParameterRules)
{
- if (param.Names!.All(x => _requestProperties.Single(p => p.Name == x).GetValue(request, null) == null))
+ var property = _requestProperties.Single(x => x.Name == param.Name);
+ var value = property.GetValue(request);
+
+ if (param.Support == RequestParameterSupport.Required)
{
- if (param.Names.Length == 1)
- return ArgumentError.Invalid(string.Join("/", param.Names!), $"Optional parameter `{param.Names[0]}` for exchange `{Exchange}` should be provided. Example: {param.ExampleValue}");
- else
- return ArgumentError.Invalid(string.Join("/", param.Names!), $"One of optional parameters `{string.Join(", ", param.Names!)}` for exchange `{Exchange}` should be provided. Example: {param.ExampleValue}");
+ if (value == null)
+ {
+ return ArgumentError.Invalid(
+ param.Name,
+ $"Request parameter `{param.Name}` for exchange `{Exchange}` is required and should be provided. Example: {param.ExampleValue}");
+ }
+ }
+ else if (param.Support == RequestParameterSupport.NotSupported)
+ {
+ if (value != null)
+ {
+ return ArgumentError.Invalid(
+ param.Name,
+ $"Request parameter `{param.Name}` is not supported by exchange `{Exchange}`");
+ }
}
}
diff --git a/CryptoExchange.Net/SharedApis/Models/Options/EndpointOptions.cs b/CryptoExchange.Net/SharedApis/Options/EndpointOptions.cs
similarity index 80%
rename from CryptoExchange.Net/SharedApis/Models/Options/EndpointOptions.cs
rename to CryptoExchange.Net/SharedApis/Options/EndpointOptions.cs
index db302681..2ae6d450 100644
--- a/CryptoExchange.Net/SharedApis/Models/Options/EndpointOptions.cs
+++ b/CryptoExchange.Net/SharedApis/Options/EndpointOptions.cs
@@ -30,8 +30,9 @@ namespace CryptoExchange.Net.SharedApis
protected EndpointOptions(
string exchange,
string operationName,
- bool needsAuthentication)
- : base(exchange, operationName, needsAuthentication)
+ bool needsAuthentication,
+ IEnumerable defaultParameterRules)
+ : base(exchange, operationName, needsAuthentication, defaultParameterRules)
{
}
}
diff --git a/CryptoExchange.Net/SharedApis/Models/Options/PaginatedCapabilityOptions.cs b/CryptoExchange.Net/SharedApis/Options/PaginatedCapabilityOptions.cs
similarity index 91%
rename from CryptoExchange.Net/SharedApis/Models/Options/PaginatedCapabilityOptions.cs
rename to CryptoExchange.Net/SharedApis/Options/PaginatedCapabilityOptions.cs
index 4d8d3b04..892521b6 100644
--- a/CryptoExchange.Net/SharedApis/Models/Options/PaginatedCapabilityOptions.cs
+++ b/CryptoExchange.Net/SharedApis/Options/PaginatedCapabilityOptions.cs
@@ -1,4 +1,6 @@
using System;
+using System.Collections;
+using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Text;
@@ -49,7 +51,8 @@ namespace CryptoExchange.Net.SharedApis
bool timePeriodSupport,
int maxLimit,
bool needsAuthentication,
- string requestName) : base(exchange, needsAuthentication, requestName)
+ string requestName,
+ IEnumerable defaultParameterRules) : base(exchange, needsAuthentication, requestName, defaultParameterRules)
{
SupportsAscending = supportsAscending;
SupportsDescending = supportsDescending;
diff --git a/CryptoExchange.Net/SharedApis/Models/Pagination/DataDirection.cs b/CryptoExchange.Net/SharedApis/Pagination/DataDirection.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Pagination/DataDirection.cs
rename to CryptoExchange.Net/SharedApis/Pagination/DataDirection.cs
diff --git a/CryptoExchange.Net/SharedApis/Models/Pagination/PageRequest.cs b/CryptoExchange.Net/SharedApis/Pagination/PageRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Pagination/PageRequest.cs
rename to CryptoExchange.Net/SharedApis/Pagination/PageRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/Models/Pagination/Pagination.cs b/CryptoExchange.Net/SharedApis/Pagination/Pagination.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Pagination/Pagination.cs
rename to CryptoExchange.Net/SharedApis/Pagination/Pagination.cs
diff --git a/CryptoExchange.Net/SharedApis/Models/Pagination/PaginationParameters.cs b/CryptoExchange.Net/SharedApis/Pagination/PaginationParameters.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Pagination/PaginationParameters.cs
rename to CryptoExchange.Net/SharedApis/Pagination/PaginationParameters.cs
diff --git a/CryptoExchange.Net/SharedApis/Models/ExchangeParameter.cs b/CryptoExchange.Net/SharedApis/Parameters/ExchangeParameter.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/ExchangeParameter.cs
rename to CryptoExchange.Net/SharedApis/Parameters/ExchangeParameter.cs
diff --git a/CryptoExchange.Net/SharedApis/Parameters/ExchangeParameterRequirement.cs b/CryptoExchange.Net/SharedApis/Parameters/ExchangeParameterRequirement.cs
new file mode 100644
index 00000000..6e4a0a0e
--- /dev/null
+++ b/CryptoExchange.Net/SharedApis/Parameters/ExchangeParameterRequirement.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace CryptoExchange.Net.SharedApis
+{
+ ///
+ /// Exchange parameter requirements
+ ///
+ public enum ExchangeParameterRequirement
+ {
+ ///
+ /// Required parameter
+ ///
+ Required,
+ ///
+ /// Optional parameter
+ ///
+ Optional
+ }
+}
diff --git a/CryptoExchange.Net/SharedApis/Models/ExchangeParameters.cs b/CryptoExchange.Net/SharedApis/Parameters/ExchangeParameters.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/ExchangeParameters.cs
rename to CryptoExchange.Net/SharedApis/Parameters/ExchangeParameters.cs
diff --git a/CryptoExchange.Net/SharedApis/Parameters/ParameterDescription.cs b/CryptoExchange.Net/SharedApis/Parameters/ParameterDescription.cs
new file mode 100644
index 00000000..b2a0088c
--- /dev/null
+++ b/CryptoExchange.Net/SharedApis/Parameters/ParameterDescription.cs
@@ -0,0 +1,173 @@
+using System;
+using System.Linq;
+
+namespace CryptoExchange.Net.SharedApis
+{
+ ///
+ /// Parameter description
+ ///
+ public class ParameterDescription
+ {
+ ///
+ /// Name of the parameter
+ ///
+ public string Name { get; set; }
+ ///
+ /// Alternative names for the parameter.
+ ///
+ public string[] Aliases { get; set; } = [];
+ ///
+ /// Type of the value
+ ///
+ public Type ValueType { get; set; }
+ ///
+ /// Parameter description
+ ///
+ public string Description { get; set; }
+ ///
+ /// Example value
+ ///
+ public object ExampleValue { get; set; }
+
+ ///
+ /// Names of the parameter
+ ///
+ [Obsolete("Use Name and Aliases instead")]
+ public string[] Names
+ {
+ get => [Name, .. Aliases];
+ }
+
+
+ ///
+ /// ctor
+ ///
+ public ParameterDescription(string parameterName, Type valueType, string description, object exampleValue)
+ {
+ Name = parameterName;
+ ValueType = valueType;
+ Description = description;
+ ExampleValue = exampleValue;
+ }
+
+ ///
+ /// ctor
+ ///
+ public ParameterDescription(string parameterName, string[] aliases, Type valueType, string description, object exampleValue)
+ {
+ Name = parameterName;
+ Aliases = aliases;
+ ValueType = valueType;
+ Description = description;
+ ExampleValue = exampleValue;
+ }
+
+ ///
+ public override string ToString()
+ {
+ return $"[{ValueType.Name}] \"{Name}\" {string.Join(" / ", Aliases.Select(x => $"\"{x}\""))}: {Description}";
+ }
+ }
+
+ ///
+ /// Request parameter description
+ ///
+ public class RequestParameterDescription : ParameterDescription
+ {
+ ///
+ /// Status defined by the shared request contract.
+ ///
+ public RequestParameterSupport DefaultSupport { get; }
+
+ ///
+ /// Status after applying exchange overrides.
+ ///
+ public RequestParameterSupport Support { get; }
+
+ ///
+ /// ctor
+ ///
+ public RequestParameterDescription(
+ RequestParameterSupport support,
+ string parameterName,
+ Type valueType,
+ string description,
+ object exampleValue)
+ : base(parameterName, valueType, description, exampleValue)
+ {
+ Support = support;
+ DefaultSupport = support;
+ }
+
+ private RequestParameterDescription(
+ RequestParameterSupport defaultSupport,
+ RequestParameterSupport support,
+ string parameterName,
+ Type valueType,
+ string description,
+ object exampleValue)
+ : base(parameterName, valueType, description, exampleValue)
+ {
+ DefaultSupport = defaultSupport;
+ Support = support;
+ }
+
+ internal RequestParameterDescription WithSupport(
+ RequestParameterSupport support)
+ => new(
+ DefaultSupport,
+ support,
+ Name,
+ ValueType,
+ Description,
+ ExampleValue);
+
+ internal RequestParameterDescription WithOverride(
+ RequestParameterRuleOverride parameterOverride)
+ => new(
+ DefaultSupport,
+ parameterOverride.Support,
+ Name,
+ ValueType,
+ parameterOverride.Description ?? Description,
+ ExampleValue);
+
+ ///
+ public override string ToString()
+ {
+ return $"[{Support}] [{ValueType.Name}] \"{Name}\" {string.Join(" / ", Aliases.Select(x => $"\"{x}\""))}: {Description}";
+ }
+ }
+
+ ///
+ /// Exchange-specific parameter description
+ ///
+ public class ExchangeParameterDescription : ParameterDescription
+ {
+ ///
+ /// Requirement for the parameter
+ ///
+ public ExchangeParameterRequirement Requirement { get; init; }
+
+ ///
+ /// ctor
+ ///
+ public ExchangeParameterDescription(
+ ExchangeParameterRequirement requirement,
+ string parameterName,
+ string[] aliases,
+ Type valueType,
+ string description,
+ object exampleValue)
+ : base(parameterName, aliases, valueType, description, exampleValue)
+ {
+ Requirement = requirement;
+ }
+
+ ///
+ public override string ToString()
+ {
+ return $"[{Requirement}] [{ValueType.Name}] \"{Name}\" {string.Join(" / ", Aliases.Select(x => $"\"{x}\""))}: {Description}";
+ }
+ }
+}
diff --git a/CryptoExchange.Net/SharedApis/Models/RequestParameter.cs b/CryptoExchange.Net/SharedApis/Parameters/RequestParameterRule.cs
similarity index 50%
rename from CryptoExchange.Net/SharedApis/Models/RequestParameter.cs
rename to CryptoExchange.Net/SharedApis/Parameters/RequestParameterRule.cs
index ef0a11b1..10092553 100644
--- a/CryptoExchange.Net/SharedApis/Models/RequestParameter.cs
+++ b/CryptoExchange.Net/SharedApis/Parameters/RequestParameterRule.cs
@@ -9,13 +9,13 @@ namespace CryptoExchange.Net.SharedApis
///
/// Creates descriptions for properties on a shared request.
///
- public static class RequestParameter
+ public static class RequestParameterRule
where TRequest : SharedRequest
{
///
/// Describe a request property which is required by an implementation.
///
- public static ParameterDescription Required(
+ public static RequestParameterDescription Required(
Expression> selector,
string description,
TValue exampleValue)
@@ -37,51 +37,86 @@ namespace CryptoExchange.Net.SharedApis
nameof(selector));
}
- return new ParameterDescription(
+ return new RequestParameterDescription(
+ RequestParameterSupport.Required,
property.Name,
property.PropertyType,
description,
- exampleValue!);
+ exampleValue!
+ );
}
+
+ ///
+ /// Describe a request property which is optional by an implementation.
+ ///
+ public static RequestParameterDescription Optional(
+ Expression> 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 RequestParameterDescription(
+ RequestParameterSupport.Optional,
+ property.Name,
+ property.PropertyType,
+ description,
+ exampleValue!
+ );
+ }
}
///
/// Creates descriptions for exchange-specific parameters.
///
- public static class ExchangeParameterDescription
+ public static class ExchangeParameterRule
{
///
/// Describe a required exchange-specific parameter.
///
- public static ParameterDescription Required(
+ public static ExchangeParameterDescription Required(
string name,
string description,
TValue exampleValue,
params string[] aliases)
- => Create(name, description, exampleValue, aliases);
+ => Create(ExchangeParameterRequirement.Required, name, description, exampleValue, aliases);
///
/// Describe an optional exchange-specific parameter.
///
- public static ParameterDescription Optional(
+ public static ExchangeParameterDescription Optional(
string name,
string description,
TValue exampleValue,
params string[] aliases)
- => Create(name, description, exampleValue, aliases);
+ => Create(ExchangeParameterRequirement.Optional, name, description, exampleValue, aliases);
- private static ParameterDescription Create(
+ private static ExchangeParameterDescription Create(
+ ExchangeParameterRequirement requirement,
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,
+ return new ExchangeParameterDescription(
+ requirement,
+ name,
+ aliases,
typeof(TValue),
description,
exampleValue!);
diff --git a/CryptoExchange.Net/SharedApis/Parameters/RequestParameterRuleOverride.cs b/CryptoExchange.Net/SharedApis/Parameters/RequestParameterRuleOverride.cs
new file mode 100644
index 00000000..b00f9c9c
--- /dev/null
+++ b/CryptoExchange.Net/SharedApis/Parameters/RequestParameterRuleOverride.cs
@@ -0,0 +1,76 @@
+using System;
+using System.Collections.Generic;
+using System.Linq.Expressions;
+using System.Reflection;
+using System.Text;
+
+namespace CryptoExchange.Net.SharedApis
+{
+ ///
+ /// Request parameter rule override
+ ///
+ /// The name of the parameter
+ /// The support level of the parameter
+ /// A description of the parameter
+ public record RequestParameterRuleOverride(
+ string ParameterName,
+ RequestParameterSupport Support,
+ string? Description = null);
+
+ ///
+ /// Request parameter rule override factory
+ ///
+ /// The type of the request
+ public static class RequestParameterRuleOverride
+ where TRequest : SharedRequest
+ {
+ ///
+ /// Required parameter rule override
+ ///
+ public static RequestParameterRuleOverride Required(
+ Expression> selector,
+ string? description = null)
+ => Create(selector, RequestParameterSupport.Required, description);
+
+ ///
+ /// Optional parameter rule override
+ ///
+ public static RequestParameterRuleOverride Optional(
+ Expression> selector,
+ string? description = null)
+ => Create(selector, RequestParameterSupport.Optional, description);
+
+ ///
+ /// Not supported parameter rule override
+ ///
+ public static RequestParameterRuleOverride NotSupported(
+ Expression> selector,
+ string? description = null)
+ => Create(selector, RequestParameterSupport.NotSupported, description);
+
+ private static RequestParameterRuleOverride Create(
+ Expression> selector,
+ RequestParameterSupport support,
+ string? description)
+ {
+ var body = selector.Body is UnaryExpression unary
+ && unary.NodeType == ExpressionType.Convert
+ ? unary.Operand
+ : selector.Body;
+
+ 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 RequestParameterRuleOverride(
+ property.Name,
+ support,
+ description);
+ }
+ }
+}
diff --git a/CryptoExchange.Net/SharedApis/Parameters/RequestParameterSupport.cs b/CryptoExchange.Net/SharedApis/Parameters/RequestParameterSupport.cs
new file mode 100644
index 00000000..0960c747
--- /dev/null
+++ b/CryptoExchange.Net/SharedApis/Parameters/RequestParameterSupport.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace CryptoExchange.Net.SharedApis
+{
+ ///
+ /// Request parameter support
+ ///
+ public enum RequestParameterSupport
+ {
+ ///
+ /// Required parameter
+ ///
+ Required,
+ ///
+ /// Optional parameter
+ ///
+ Optional,
+ ///
+ /// Not supported parameter
+ ///
+ NotSupported
+ }
+}
diff --git a/CryptoExchange.Net/SharedApis/V2/Assets/GetAllAssets/GetAllAssetsOptions.cs b/CryptoExchange.Net/SharedApis/V2/Assets/GetAllAssets/GetAllAssetsOptions.cs
index 6e1bb5ab..d05a2703 100644
--- a/CryptoExchange.Net/SharedApis/V2/Assets/GetAllAssets/GetAllAssetsOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Assets/GetAllAssets/GetAllAssetsOptions.cs
@@ -12,10 +12,12 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Retrieve basic info for all assets and the networks they support for withdrawals/deposits";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = [];
+
///
/// ctor
///
- public GetAllAssetsOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetAllAssetsRest.GetAllAssetsAsync))
+ public GetAllAssetsOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetAllAssetsRest.GetAllAssetsAsync), _defaultParameterRules)
{
}
}
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/GetAssetsRequest.cs b/CryptoExchange.Net/SharedApis/V2/Assets/GetAllAssets/GetAssetsRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/GetAssetsRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/Assets/GetAllAssets/GetAssetsRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/V2/Assets/GetAllAssets/IGetAllAssets.cs b/CryptoExchange.Net/SharedApis/V2/Assets/GetAllAssets/IGetAllAssets.cs
index 03797c63..6f2c5933 100644
--- a/CryptoExchange.Net/SharedApis/V2/Assets/GetAllAssets/IGetAllAssets.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Assets/GetAllAssets/IGetAllAssets.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Assets request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
GetAllAssetsOptions GetAllAssetsOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/Assets/GetAsset/GetAssetOptions.cs b/CryptoExchange.Net/SharedApis/V2/Assets/GetAsset/GetAssetOptions.cs
index 8f834528..fc4f3412 100644
--- a/CryptoExchange.Net/SharedApis/V2/Assets/GetAsset/GetAssetOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Assets/GetAsset/GetAssetOptions.cs
@@ -12,10 +12,15 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Retrieve basic info for a single asset and networks it supports for withdrawals/deposits";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Asset, "The asset to retrieve information for", "ETH"),
+ };
+
///
/// ctor
///
- public GetAssetOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetAssetRest.GetAssetAsync))
+ public GetAssetOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetAssetRest.GetAssetAsync), _defaultParameterRules)
{
}
}
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/GetAssetRequest.cs b/CryptoExchange.Net/SharedApis/V2/Assets/GetAsset/GetAssetRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/GetAssetRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/Assets/GetAsset/GetAssetRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/V2/Assets/GetAsset/IGetAsset.cs b/CryptoExchange.Net/SharedApis/V2/Assets/GetAsset/IGetAsset.cs
index 39c40152..1150a8d2 100644
--- a/CryptoExchange.Net/SharedApis/V2/Assets/GetAsset/IGetAsset.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Assets/GetAsset/IGetAsset.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Asset request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
GetAssetOptions GetAssetOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/Balances/GetBalances/GetBalancesOptions.cs b/CryptoExchange.Net/SharedApis/V2/Balances/GetBalances/GetBalancesOptions.cs
index d6c56691..a63aca3c 100644
--- a/CryptoExchange.Net/SharedApis/V2/Balances/GetBalances/GetBalancesOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Balances/GetBalances/GetBalancesOptions.cs
@@ -11,6 +11,12 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Retrieve account balances";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Optional(x => x.TradingMode, "Filter the balances by trading mode", TradingMode.Spot),
+ RequestParameterRule.Optional(x => x.AccountType, "The account type to retrieve balances for", SharedAccountType.Spot),
+ };
+
///
/// Supported account types
///
@@ -19,7 +25,7 @@ namespace CryptoExchange.Net.SharedApis
///
/// ctor
///
- public GetBalancesOptions(string exchange, params AccountTypeFilter[] accountTypes) : base(exchange, true, nameof(IGetBalancesRest.GetBalancesAsync))
+ public GetBalancesOptions(string exchange, params AccountTypeFilter[] accountTypes) : base(exchange, true, nameof(IGetBalancesRest.GetBalancesAsync), _defaultParameterRules)
{
SupportedAccountTypes = accountTypes;
}
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/GetBalancesRequest.cs b/CryptoExchange.Net/SharedApis/V2/Balances/GetBalances/GetBalancesRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/GetBalancesRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/Balances/GetBalances/GetBalancesRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/V2/Balances/GetBalances/IGetBalances.cs b/CryptoExchange.Net/SharedApis/V2/Balances/GetBalances/IGetBalances.cs
index b7c0ad13..9b4601cd 100644
--- a/CryptoExchange.Net/SharedApis/V2/Balances/GetBalances/IGetBalances.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Balances/GetBalances/IGetBalances.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Balances request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
GetBalancesOptions GetBalancesOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/Balances/SubscribeBalances/SubscribeBalanceOptions.cs b/CryptoExchange.Net/SharedApis/V2/Balances/SubscribeBalances/SubscribeBalanceOptions.cs
index 4dc5818c..6cd84170 100644
--- a/CryptoExchange.Net/SharedApis/V2/Balances/SubscribeBalances/SubscribeBalanceOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Balances/SubscribeBalances/SubscribeBalanceOptions.cs
@@ -12,10 +12,15 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Subscribe to balance updates";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Optional(x => x.TradingMode, "Filter balance updates by trading mode", TradingMode.Spot),
+ };
+
///
/// ctor
///
- public SubscribeBalanceOptions(string exchange, bool needsAuthentication) : base(exchange, needsAuthentication, nameof(ISubscribeBalancesSocket.SubscribeToBalanceUpdatesAsync))
+ public SubscribeBalanceOptions(string exchange, bool needsAuthentication) : base(exchange, needsAuthentication, nameof(ISubscribeBalancesSocket.SubscribeToBalanceUpdatesAsync), _defaultParameterRules)
{
}
}
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/SubscribeBalancesRequest.cs b/CryptoExchange.Net/SharedApis/V2/Balances/SubscribeBalances/SubscribeBalancesRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/SubscribeBalancesRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/Balances/SubscribeBalances/SubscribeBalancesRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/V2/Deposits/GetDepositAddresses/GetDepositAddressesOptions.cs b/CryptoExchange.Net/SharedApis/V2/Deposits/GetDepositAddresses/GetDepositAddressesOptions.cs
index d0138d09..a6d13a3b 100644
--- a/CryptoExchange.Net/SharedApis/V2/Deposits/GetDepositAddresses/GetDepositAddressesOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Deposits/GetDepositAddresses/GetDepositAddressesOptions.cs
@@ -12,10 +12,16 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Retrieve deposit addresses for an asset";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Asset, "The asset to retrieve deposit addresses for", "ETH"),
+ RequestParameterRule.Optional(x => x.Network, "The network to retrieve a deposit address for", "ERC20"),
+ };
+
///
/// ctor
///
- public GetDepositAddressesOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetDepositAddressesRest.GetDepositAddressesAsync))
+ public GetDepositAddressesOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetDepositAddressesRest.GetDepositAddressesAsync), _defaultParameterRules)
{
}
}
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/GetDepositAddressesRequest.cs b/CryptoExchange.Net/SharedApis/V2/Deposits/GetDepositAddresses/GetDepositAddressesRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/GetDepositAddressesRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/Deposits/GetDepositAddresses/GetDepositAddressesRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/V2/Deposits/GetDepositAddresses/IGetDepositAddresses.cs b/CryptoExchange.Net/SharedApis/V2/Deposits/GetDepositAddresses/IGetDepositAddresses.cs
index 782d64a8..5f352b3f 100644
--- a/CryptoExchange.Net/SharedApis/V2/Deposits/GetDepositAddresses/IGetDepositAddresses.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Deposits/GetDepositAddresses/IGetDepositAddresses.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Deposit addresses request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
GetDepositAddressesOptions GetDepositAddressesOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/Deposits/GetDepositHistory/GetDepositHistoryOptions.cs b/CryptoExchange.Net/SharedApis/V2/Deposits/GetDepositHistory/GetDepositHistoryOptions.cs
index a039a989..79a698d9 100644
--- a/CryptoExchange.Net/SharedApis/V2/Deposits/GetDepositHistory/GetDepositHistoryOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Deposits/GetDepositHistory/GetDepositHistoryOptions.cs
@@ -12,11 +12,20 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Retrieve deposit history";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Optional(x => x.Asset, "Filter the result set by asset", "ETH"),
+ RequestParameterRule.Optional(x => x.StartTime, "Filter the result set by start time", DateTime.UtcNow.AddDays(-1)),
+ RequestParameterRule.Optional(x => x.EndTime, "Filter the result set by end time", DateTime.UtcNow.AddHours(-1)),
+ RequestParameterRule.Optional(x => x.Limit, "Limit the result set to a maximum number of items", 100),
+ RequestParameterRule.Optional(x => x.Direction, "The direction in which to retrieve the results", DataDirection.Descending),
+ };
+
///
/// ctor
///
public GetDepositHistoryOptions(string exchange, bool supportsAscending, bool supportsDescending, bool timeFilterSupported, int maxLimit)
- : base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, true, nameof(IGetDepositHistoryRest.GetDepositHistoryAsync))
+ : base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, true, nameof(IGetDepositHistoryRest.GetDepositHistoryAsync), _defaultParameterRules)
{
}
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/GetDepositsRequest.cs b/CryptoExchange.Net/SharedApis/V2/Deposits/GetDepositHistory/GetDepositsRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/GetDepositsRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/Deposits/GetDepositHistory/GetDepositsRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/V2/Deposits/GetDepositHistory/IGetDepositHistory.cs b/CryptoExchange.Net/SharedApis/V2/Deposits/GetDepositHistory/IGetDepositHistory.cs
index dcbc37ec..9fb7c894 100644
--- a/CryptoExchange.Net/SharedApis/V2/Deposits/GetDepositHistory/IGetDepositHistory.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Deposits/GetDepositHistory/IGetDepositHistory.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Deposits request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
GetDepositHistoryOptions GetDepositHistoryOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/Fees/GetFees/GetFeeOptions.cs b/CryptoExchange.Net/SharedApis/V2/Fees/GetFees/GetFeeOptions.cs
index ea57460c..7d1032b9 100644
--- a/CryptoExchange.Net/SharedApis/V2/Fees/GetFees/GetFeeOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Fees/GetFees/GetFeeOptions.cs
@@ -12,10 +12,15 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Retrieve trading fee information";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Symbol, "The symbol to retrieve trading fees for", new SharedSymbol(TradingMode.Spot, "ETH", "USDT")),
+ };
+
///
/// ctor
///
- public GetFeeOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetFeesRest.GetFeesAsync))
+ public GetFeeOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetFeesRest.GetFeesAsync), _defaultParameterRules)
{
}
}
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/GetFeeRequest.cs b/CryptoExchange.Net/SharedApis/V2/Fees/GetFees/GetFeeRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/GetFeeRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/Fees/GetFees/GetFeeRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/V2/Fees/GetFees/IGetFees.cs b/CryptoExchange.Net/SharedApis/V2/Fees/GetFees/IGetFees.cs
index 406abe2c..901a1e2c 100644
--- a/CryptoExchange.Net/SharedApis/V2/Fees/GetFees/IGetFees.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Fees/GetFees/IGetFees.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Fee request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
GetFeeOptions GetFeeOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/Funding/GetFundingRateHistory/GetFundingRateHistoryOptions.cs b/CryptoExchange.Net/SharedApis/V2/Funding/GetFundingRateHistory/GetFundingRateHistoryOptions.cs
index d4d14236..5345f08c 100644
--- a/CryptoExchange.Net/SharedApis/V2/Funding/GetFundingRateHistory/GetFundingRateHistoryOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Funding/GetFundingRateHistory/GetFundingRateHistoryOptions.cs
@@ -12,11 +12,20 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Retrieve historical funding rates for a futures symbol";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Symbol, "The symbol to retrieve funding rate history for", new SharedSymbol(TradingMode.PerpetualLinear, "ETH", "USDT")),
+ RequestParameterRule.Optional(x => x.StartTime, "Filter the result set by start time", DateTime.UtcNow.AddDays(-1)),
+ RequestParameterRule.Optional(x => x.EndTime, "Filter the result set by end time", DateTime.UtcNow.AddHours(-1)),
+ RequestParameterRule.Optional(x => x.Limit, "Limit the result set to a maximum number of items", 100),
+ RequestParameterRule.Optional(x => x.Direction, "The direction in which to retrieve the results", DataDirection.Descending),
+ };
+
///
/// ctor
///
public GetFundingRateHistoryOptions(string exchange, bool supportsAscending, bool supportsDescending, bool timeFilterSupported, int maxLimit, bool needsAuthentication)
- : base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, needsAuthentication, nameof(IGetFundingRateHistoryRest.GetFundingRateHistoryAsync))
+ : base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, needsAuthentication, nameof(IGetFundingRateHistoryRest.GetFundingRateHistoryAsync), _defaultParameterRules)
{
}
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/GetFundingRateHistoryRequest.cs b/CryptoExchange.Net/SharedApis/V2/Funding/GetFundingRateHistory/GetFundingRateHistoryRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/GetFundingRateHistoryRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/Funding/GetFundingRateHistory/GetFundingRateHistoryRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/V2/Funding/GetFundingRateHistory/IGetFundingRateHistory.cs b/CryptoExchange.Net/SharedApis/V2/Funding/GetFundingRateHistory/IGetFundingRateHistory.cs
index dc29c6b2..761b2811 100644
--- a/CryptoExchange.Net/SharedApis/V2/Funding/GetFundingRateHistory/IGetFundingRateHistory.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Funding/GetFundingRateHistory/IGetFundingRateHistory.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Funding rate request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
GetFundingRateHistoryOptions GetFundingRateHistoryOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/IndexPrice/GetAllIndexPrices/GetAllIndexPricesOptions.cs b/CryptoExchange.Net/SharedApis/V2/IndexPrice/GetAllIndexPrices/GetAllIndexPricesOptions.cs
new file mode 100644
index 00000000..028a69c2
--- /dev/null
+++ b/CryptoExchange.Net/SharedApis/V2/IndexPrice/GetAllIndexPrices/GetAllIndexPricesOptions.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace CryptoExchange.Net.SharedApis
+{
+ ///
+ /// Options for requesting the index price
+ ///
+ public class GetAllIndexPricesOptions : CapabilityOptions
+ {
+ ///
+ public override string Description => "Retrieve the index prices for all futures symbols";
+
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Optional(x => x.TradingMode, "Filter the index prices by trading mode", TradingMode.PerpetualLinear),
+ };
+
+ ///
+ /// ctor
+ ///
+ public GetAllIndexPricesOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetAllIndexPricesRest.GetAllIndexPricesAsync), _defaultParameterRules)
+ {
+ }
+ }
+}
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/GetIndexPricesRequest.cs b/CryptoExchange.Net/SharedApis/V2/IndexPrice/GetAllIndexPrices/GetAllIndexPricesRequest.cs
similarity index 63%
rename from CryptoExchange.Net/SharedApis/Models/Requests/GetIndexPricesRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/IndexPrice/GetAllIndexPrices/GetAllIndexPricesRequest.cs
index 71ee4c5e..b05c17f0 100644
--- a/CryptoExchange.Net/SharedApis/Models/Requests/GetIndexPricesRequest.cs
+++ b/CryptoExchange.Net/SharedApis/V2/IndexPrice/GetAllIndexPrices/GetAllIndexPricesRequest.cs
@@ -3,14 +3,14 @@
///
/// Request to retrieve the current index prices for all symbols
///
- public record GetIndexPricesRequest : SharedRequest
+ public record GetAllIndexPricesRequest : SharedRequest
{
///
/// ctor
///
/// Trading mode
/// Exchange specific parameters
- public GetIndexPricesRequest(TradingMode? tradingMode = null, ExchangeParameters? exchangeParameters = null) : base(tradingMode, exchangeParameters)
+ public GetAllIndexPricesRequest(TradingMode? tradingMode = null, ExchangeParameters? exchangeParameters = null) : base(tradingMode, exchangeParameters)
{
}
}
diff --git a/CryptoExchange.Net/SharedApis/V2/IndexPrice/GetAllIndexPrices/IGetAllIndexPrices.cs b/CryptoExchange.Net/SharedApis/V2/IndexPrice/GetAllIndexPrices/IGetAllIndexPrices.cs
new file mode 100644
index 00000000..46b29a06
--- /dev/null
+++ b/CryptoExchange.Net/SharedApis/V2/IndexPrice/GetAllIndexPrices/IGetAllIndexPrices.cs
@@ -0,0 +1,37 @@
+using CryptoExchange.Net.Objects;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace CryptoExchange.Net.SharedApis
+{
+ ///
+ /// Operation for retrieving the index price for all symbols from an exchange.
+ ///
+ public interface IGetAllIndexPrices : ISharedApiCapability
+ {
+ ///
+ /// Index price request options.
+ /// Use and to check for required and optional parameters for the request.
+ /// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
+ ///
+ GetAllIndexPricesOptions GetAllIndexPricesOptions { get; }
+ ///
+ /// Get the index price for a symbol, see for request options and exchange specific required/optional parameters.
+ ///
+ /// Request info
+ /// Cancellation token
+ Task> GetAllIndexPricesAsync(GetAllIndexPricesRequest request, CancellationToken ct = default);
+ }
+
+ ///
+ /// Operation for retrieving the index price for all symbols from an exchange via the REST API.
+ ///
+ public interface IGetAllIndexPricesRest : IGetAllIndexPrices, ISharedRest
+ {
+ ///
+ new Task> GetAllIndexPricesAsync(GetAllIndexPricesRequest request, CancellationToken ct = default);
+ }
+}
diff --git a/CryptoExchange.Net/SharedApis/V2/IndexPrice/GetIndexPrice/GetIndexPriceOptions.cs b/CryptoExchange.Net/SharedApis/V2/IndexPrice/GetIndexPrice/GetIndexPriceOptions.cs
index 2037da55..b973af75 100644
--- a/CryptoExchange.Net/SharedApis/V2/IndexPrice/GetIndexPrice/GetIndexPriceOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/IndexPrice/GetIndexPrice/GetIndexPriceOptions.cs
@@ -12,10 +12,15 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Retrieve the index price for a futures symbol";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Symbol, "The symbol to retrieve the index price for", new SharedSymbol(TradingMode.PerpetualLinear, "ETH", "USDT")),
+ };
+
///
/// ctor
///
- public GetIndexPriceOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetIndexPriceRest.GetIndexPriceAsync))
+ public GetIndexPriceOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetIndexPriceRest.GetIndexPriceAsync), _defaultParameterRules)
{
}
}
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/GetIndexPriceRequest.cs b/CryptoExchange.Net/SharedApis/V2/IndexPrice/GetIndexPrice/GetIndexPriceRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/GetIndexPriceRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/IndexPrice/GetIndexPrice/GetIndexPriceRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/V2/IndexPrice/GetIndexPrice/IGetIndexPrice.cs b/CryptoExchange.Net/SharedApis/V2/IndexPrice/GetIndexPrice/IGetIndexPrice.cs
index a64f5b09..952526ca 100644
--- a/CryptoExchange.Net/SharedApis/V2/IndexPrice/GetIndexPrice/IGetIndexPrice.cs
+++ b/CryptoExchange.Net/SharedApis/V2/IndexPrice/GetIndexPrice/IGetIndexPrice.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Index price request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
GetIndexPriceOptions GetIndexPriceOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/IndexPrice/GetIndexPrices/GetIndexPricesOptions.cs b/CryptoExchange.Net/SharedApis/V2/IndexPrice/GetIndexPrices/GetIndexPricesOptions.cs
deleted file mode 100644
index cedb378b..00000000
--- a/CryptoExchange.Net/SharedApis/V2/IndexPrice/GetIndexPrices/GetIndexPricesOptions.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace CryptoExchange.Net.SharedApis
-{
- ///
- /// Options for requesting the index price
- ///
- public class GetIndexPricesOptions : CapabilityOptions
- {
- ///
- public override string Description => "Retrieve the index prices for all futures symbols";
-
- ///
- /// ctor
- ///
- public GetIndexPricesOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetIndexPricesRest.GetIndexPricesAsync))
- {
- }
- }
-}
diff --git a/CryptoExchange.Net/SharedApis/V2/IndexPrice/GetIndexPrices/IGetIndexPrices.cs b/CryptoExchange.Net/SharedApis/V2/IndexPrice/GetIndexPrices/IGetIndexPrices.cs
deleted file mode 100644
index 9acafae2..00000000
--- a/CryptoExchange.Net/SharedApis/V2/IndexPrice/GetIndexPrices/IGetIndexPrices.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using CryptoExchange.Net.Objects;
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace CryptoExchange.Net.SharedApis
-{
- ///
- /// Operation for retrieving the index price for a symbol from an exchange.
- ///
- public interface IGetIndexPrices : ISharedApiCapability
- {
- ///
- /// Index price request options.
- /// Use , and to check for required and optional parameters for the request.
- /// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
- ///
- GetIndexPricesOptions GetIndexPricesOptions { get; }
- ///
- /// Get the index price for a symbol, see for request options and exchange specific required/optional parameters.
- ///
- /// Request info
- /// Cancellation token
- Task> GetIndexPricesAsync(GetIndexPricesRequest request, CancellationToken ct = default);
- }
-
- ///
- /// Operation for retrieving the index price for a symbol from an exchange via the REST API.
- ///
- public interface IGetIndexPricesRest : IGetIndexPrices, ISharedRest
- {
- ///
- new Task> GetIndexPricesAsync(GetIndexPricesRequest request, CancellationToken ct = default);
- }
-}
diff --git a/CryptoExchange.Net/SharedApis/V2/Klines/Futures/GetIndexPriceKlines/GetIndexPriceKlinesOptions.cs b/CryptoExchange.Net/SharedApis/V2/Klines/Futures/GetIndexPriceKlines/GetIndexPriceKlinesOptions.cs
index 0ac32c41..792920ad 100644
--- a/CryptoExchange.Net/SharedApis/V2/Klines/Futures/GetIndexPriceKlines/GetIndexPriceKlinesOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Klines/Futures/GetIndexPriceKlines/GetIndexPriceKlinesOptions.cs
@@ -13,6 +13,16 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Retrieve index price candlestick data";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Symbol, "The symbol to retrieve klines for", new SharedSymbol(TradingMode.PerpetualLinear, "ETH", "USDT")),
+ RequestParameterRule.Required(x => x.Interval, "The kline interval", SharedKlineInterval.OneMinute),
+ RequestParameterRule.Optional(x => x.StartTime, "Filter the result set by start time", DateTime.UtcNow.AddDays(-1)),
+ RequestParameterRule.Optional(x => x.EndTime, "Filter the result set by end time", DateTime.UtcNow.AddHours(-1)),
+ RequestParameterRule.Optional(x => x.Limit, "Limit the result set to a maximum number of items", 100),
+ RequestParameterRule.Optional(x => x.Direction, "The direction in which to retrieve the results", DataDirection.Descending),
+ };
+
///
/// The supported kline intervals
///
@@ -26,7 +36,7 @@ namespace CryptoExchange.Net.SharedApis
/// ctor
///
public GetIndexPriceKlinesOptions(string exchange, bool supportsAscending, bool supportsDescending, bool timeFilterSupported, int maxLimit, bool needsAuthentication)
- : base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, needsAuthentication, nameof(IGetIndexPriceKlinesRest.GetIndexPriceKlinesAsync))
+ : base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, needsAuthentication, nameof(IGetIndexPriceKlinesRest.GetIndexPriceKlinesAsync), _defaultParameterRules)
{
SupportIntervals = new[]
{
@@ -51,7 +61,7 @@ namespace CryptoExchange.Net.SharedApis
/// ctor
///
public GetIndexPriceKlinesOptions(string exchange, bool supportsAscending, bool supportsDescending, bool timeFilterSupported, int maxLimit, bool needsAuthentication, params SharedKlineInterval[] intervals)
- : base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, needsAuthentication, nameof(IIndexPriceKlineRestClient.GetIndexPriceKlinesAsync))
+ : base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, needsAuthentication, nameof(IIndexPriceKlineRestClient.GetIndexPriceKlinesAsync), _defaultParameterRules)
{
SupportIntervals = intervals;
}
diff --git a/CryptoExchange.Net/SharedApis/V2/Klines/Futures/GetIndexPriceKlines/IGetIndexPriceKlines.cs b/CryptoExchange.Net/SharedApis/V2/Klines/Futures/GetIndexPriceKlines/IGetIndexPriceKlines.cs
index 04fefa05..c62df958 100644
--- a/CryptoExchange.Net/SharedApis/V2/Klines/Futures/GetIndexPriceKlines/IGetIndexPriceKlines.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Klines/Futures/GetIndexPriceKlines/IGetIndexPriceKlines.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Index price klines request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
GetIndexPriceKlinesOptions GetIndexPriceKlinesOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/Klines/Futures/GetMarkPriceKlines/GetMarkPriceKlinesOptions.cs b/CryptoExchange.Net/SharedApis/V2/Klines/Futures/GetMarkPriceKlines/GetMarkPriceKlinesOptions.cs
index a245288f..ddae22fc 100644
--- a/CryptoExchange.Net/SharedApis/V2/Klines/Futures/GetMarkPriceKlines/GetMarkPriceKlinesOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Klines/Futures/GetMarkPriceKlines/GetMarkPriceKlinesOptions.cs
@@ -13,6 +13,16 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Retrieve mark price candlestick data";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Symbol, "The symbol to retrieve klines for", new SharedSymbol(TradingMode.PerpetualLinear, "ETH", "USDT")),
+ RequestParameterRule.Required(x => x.Interval, "The kline interval", SharedKlineInterval.OneMinute),
+ RequestParameterRule.Optional(x => x.StartTime, "Filter the result set by start time", DateTime.UtcNow.AddDays(-1)),
+ RequestParameterRule.Optional(x => x.EndTime, "Filter the result set by end time", DateTime.UtcNow.AddHours(-1)),
+ RequestParameterRule.Optional(x => x.Limit, "Limit the result set to a maximum number of items", 100),
+ RequestParameterRule.Optional(x => x.Direction, "The direction in which to retrieve the results", DataDirection.Descending),
+ };
+
///
/// The supported kline intervals
///
@@ -26,7 +36,7 @@ namespace CryptoExchange.Net.SharedApis
/// ctor
///
public GetMarkPriceKlinesOptions(string exchange, bool supportsAscending, bool supportsDescending, bool timeFilterSupported, int maxLimit, bool needsAuthentication)
- : base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, needsAuthentication, nameof(IGetMarkPriceKlinesRest.GetMarkPriceKlinesAsync))
+ : base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, needsAuthentication, nameof(IGetMarkPriceKlinesRest.GetMarkPriceKlinesAsync), _defaultParameterRules)
{
SupportIntervals = new[]
{
@@ -51,7 +61,7 @@ namespace CryptoExchange.Net.SharedApis
/// ctor
///
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(IGetMarkPriceKlinesRest.GetMarkPriceKlinesAsync))
+ : base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, needsAuthentication, nameof(IGetMarkPriceKlinesRest.GetMarkPriceKlinesAsync), _defaultParameterRules)
{
SupportIntervals = intervals;
}
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/GetMarkPriceRequest.cs b/CryptoExchange.Net/SharedApis/V2/Klines/Futures/GetMarkPriceKlines/GetMarkPriceRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/GetMarkPriceRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/Klines/Futures/GetMarkPriceKlines/GetMarkPriceRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/V2/Klines/Futures/GetMarkPriceKlines/IGetMarkPriceKlines.cs b/CryptoExchange.Net/SharedApis/V2/Klines/Futures/GetMarkPriceKlines/IGetMarkPriceKlines.cs
index 1bab9b32..d9848b76 100644
--- a/CryptoExchange.Net/SharedApis/V2/Klines/Futures/GetMarkPriceKlines/IGetMarkPriceKlines.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Klines/Futures/GetMarkPriceKlines/IGetMarkPriceKlines.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Mark price klines request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
GetMarkPriceKlinesOptions GetMarkPriceKlinesOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/Klines/GetKlines/GetKlinesOptions.cs b/CryptoExchange.Net/SharedApis/V2/Klines/GetKlines/GetKlinesOptions.cs
index 173fcb83..bb0a6ebd 100644
--- a/CryptoExchange.Net/SharedApis/V2/Klines/GetKlines/GetKlinesOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Klines/GetKlines/GetKlinesOptions.cs
@@ -13,6 +13,16 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Retrieve candlestick data for a symbol";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Symbol, "The symbol to retrieve klines for", new SharedSymbol(TradingMode.Spot, "ETH", "USDT")),
+ RequestParameterRule.Required(x => x.Interval, "The kline interval", SharedKlineInterval.OneMinute),
+ RequestParameterRule.Optional(x => x.StartTime, "Filter the result set by start time", DateTime.UtcNow.AddDays(-1)),
+ RequestParameterRule.Optional(x => x.EndTime, "Filter the result set by end time", DateTime.UtcNow.AddHours(-1)),
+ RequestParameterRule.Optional(x => x.Limit, "Limit the result set to a maximum number of items", 100),
+ RequestParameterRule.Optional(x => x.Direction, "The direction in which to retrieve the results", DataDirection.Descending),
+ };
+
///
/// The supported kline intervals
///
@@ -26,7 +36,7 @@ namespace CryptoExchange.Net.SharedApis
/// ctor
///
public GetKlinesOptions(string exchange, bool supportsAscending, bool supportsDescending, bool timeFilterSupported, int maxLimit, bool needsAuthentication)
- : base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, needsAuthentication, nameof(IGetKlinesRest.GetKlinesAsync))
+ : base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, needsAuthentication, nameof(IGetKlinesRest.GetKlinesAsync), _defaultParameterRules)
{
SupportIntervals = new[]
{
@@ -51,7 +61,7 @@ namespace CryptoExchange.Net.SharedApis
/// ctor
///
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(IGetKlinesRest.GetKlinesAsync))
+ : base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, needsAuthentication, nameof(IGetKlinesRest.GetKlinesAsync), _defaultParameterRules)
{
SupportIntervals = intervals;
}
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/GetKlinesRequest.cs b/CryptoExchange.Net/SharedApis/V2/Klines/GetKlines/GetKlinesRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/GetKlinesRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/Klines/GetKlines/GetKlinesRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/V2/Klines/GetKlines/IGetKlines.cs b/CryptoExchange.Net/SharedApis/V2/Klines/GetKlines/IGetKlines.cs
index cd607e4b..658d6180 100644
--- a/CryptoExchange.Net/SharedApis/V2/Klines/GetKlines/IGetKlines.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Klines/GetKlines/IGetKlines.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Kline request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
GetKlinesOptions GetKlinesOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/Klines/SubscribeKlines/SubscribeKlineOptions.cs b/CryptoExchange.Net/SharedApis/V2/Klines/SubscribeKlines/SubscribeKlineOptions.cs
index b662dc37..00304417 100644
--- a/CryptoExchange.Net/SharedApis/V2/Klines/SubscribeKlines/SubscribeKlineOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Klines/SubscribeKlines/SubscribeKlineOptions.cs
@@ -12,6 +12,13 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Subscribe to candlestick updates for a symbol";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Optional(x => x.Symbol, "The symbol to subscribe to", new SharedSymbol(TradingMode.Spot, "ETH", "USDT")),
+ RequestParameterRule.Optional(x => x.Symbols, "The symbols to subscribe to", new[] { new SharedSymbol(TradingMode.Spot, "ETH", "USDT") }),
+ RequestParameterRule.Required(x => x.Interval, "The kline interval", SharedKlineInterval.OneMinute),
+ };
+
///
/// Kline intervals supported for updates
///
@@ -20,7 +27,7 @@ namespace CryptoExchange.Net.SharedApis
///
/// ctor
///
- public SubscribeKlineOptions(string exchange, bool needsAuthentication) : base(exchange, needsAuthentication, nameof(ISubscribeKlinesSocket.SubscribeToKlineUpdatesAsync))
+ public SubscribeKlineOptions(string exchange, bool needsAuthentication) : base(exchange, needsAuthentication, nameof(ISubscribeKlinesSocket.SubscribeToKlineUpdatesAsync), _defaultParameterRules)
{
SupportIntervals = new[]
{
@@ -45,7 +52,7 @@ namespace CryptoExchange.Net.SharedApis
/// ctor
///
public SubscribeKlineOptions(string exchange, bool needsAuthentication, params SharedKlineInterval[] intervals)
- : base(exchange, needsAuthentication, nameof(ISubscribeKlinesSocket.SubscribeToKlineUpdatesAsync))
+ : base(exchange, needsAuthentication, nameof(ISubscribeKlinesSocket.SubscribeToKlineUpdatesAsync), _defaultParameterRules)
{
SupportIntervals = intervals;
}
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/SubscribeKlineRequest.cs b/CryptoExchange.Net/SharedApis/V2/Klines/SubscribeKlines/SubscribeKlineRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/SubscribeKlineRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/Klines/SubscribeKlines/SubscribeKlineRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/V2/Leverage/GetLeverage/GetLeverageOptions.cs b/CryptoExchange.Net/SharedApis/V2/Leverage/GetLeverage/GetLeverageOptions.cs
index 9f68beaf..a1ba3b21 100644
--- a/CryptoExchange.Net/SharedApis/V2/Leverage/GetLeverage/GetLeverageOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Leverage/GetLeverage/GetLeverageOptions.cs
@@ -12,10 +12,17 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Retrieve the current leverage for a futures symbol";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Symbol, "The symbol to retrieve leverage for", new SharedSymbol(TradingMode.PerpetualLinear, "ETH", "USDT")),
+ RequestParameterRule.Optional(x => x.PositionSide, "The position side to retrieve leverage for", SharedPositionSide.Long),
+ RequestParameterRule.Optional(x => x.MarginMode, "The margin mode to retrieve leverage for", SharedMarginMode.Cross),
+ };
+
///
/// ctor
///
- public GetLeverageOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetLeverageRest.GetLeverageAsync))
+ public GetLeverageOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetLeverageRest.GetLeverageAsync), _defaultParameterRules)
{
}
}
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/GetLeverageRequest.cs b/CryptoExchange.Net/SharedApis/V2/Leverage/GetLeverage/GetLeverageRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/GetLeverageRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/Leverage/GetLeverage/GetLeverageRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/V2/Leverage/GetLeverage/IGetLeverage.cs b/CryptoExchange.Net/SharedApis/V2/Leverage/GetLeverage/IGetLeverage.cs
index b2cabdc0..e130cf4a 100644
--- a/CryptoExchange.Net/SharedApis/V2/Leverage/GetLeverage/IGetLeverage.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Leverage/GetLeverage/IGetLeverage.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Leverage request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
GetLeverageOptions GetLeverageOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/Leverage/SetLeverage/ISetLeverage.cs b/CryptoExchange.Net/SharedApis/V2/Leverage/SetLeverage/ISetLeverage.cs
index 6dc26d56..9bdf295d 100644
--- a/CryptoExchange.Net/SharedApis/V2/Leverage/SetLeverage/ISetLeverage.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Leverage/SetLeverage/ISetLeverage.cs
@@ -19,7 +19,7 @@ namespace CryptoExchange.Net.SharedApis
///
/// Leverage set request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
SetLeverageOptions SetLeverageOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/Leverage/SetLeverage/SetLeverageOptions.cs b/CryptoExchange.Net/SharedApis/V2/Leverage/SetLeverage/SetLeverageOptions.cs
index 1413266d..e0590a62 100644
--- a/CryptoExchange.Net/SharedApis/V2/Leverage/SetLeverage/SetLeverageOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Leverage/SetLeverage/SetLeverageOptions.cs
@@ -8,10 +8,18 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Set the leverage for a futures symbol";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Symbol, "The symbol to set leverage for", new SharedSymbol(TradingMode.PerpetualLinear, "ETH", "USDT")),
+ RequestParameterRule.Required(x => x.Leverage, "The leverage to set", 10m),
+ RequestParameterRule.Optional(x => x.Side, "The position side to set leverage for", SharedPositionSide.Long),
+ RequestParameterRule.Optional(x => x.MarginMode, "The margin mode to set leverage for", SharedMarginMode.Cross),
+ };
+
///
/// ctor
///
- public SetLeverageOptions(string exchange) : base(exchange, true, nameof(ISetLeverageRest.SetLeverageAsync))
+ public SetLeverageOptions(string exchange) : base(exchange, true, nameof(ISetLeverageRest.SetLeverageAsync), _defaultParameterRules)
{
}
}
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/SetLeverageRequest.cs b/CryptoExchange.Net/SharedApis/V2/Leverage/SetLeverage/SetLeverageRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/SetLeverageRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/Leverage/SetLeverage/SetLeverageRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/V2/MarkPrice/GetAllMarkPrices/GetAllMarkPricesOptions.cs b/CryptoExchange.Net/SharedApis/V2/MarkPrice/GetAllMarkPrices/GetAllMarkPricesOptions.cs
new file mode 100644
index 00000000..5387b161
--- /dev/null
+++ b/CryptoExchange.Net/SharedApis/V2/MarkPrice/GetAllMarkPrices/GetAllMarkPricesOptions.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace CryptoExchange.Net.SharedApis
+{
+ ///
+ /// Options for requesting the mark price
+ ///
+ public class GetAllMarkPricesOptions : CapabilityOptions
+ {
+ ///
+ public override string Description => "Retrieve the mark prices for all futures symbols";
+
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Optional(x => x.TradingMode, "Filter the mark prices by trading mode", TradingMode.PerpetualLinear),
+ };
+
+ ///
+ /// ctor
+ ///
+ public GetAllMarkPricesOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetAllMarkPricesRest.GetAllMarkPricesAsync), _defaultParameterRules)
+ {
+ }
+ }
+}
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/GetMarkPricesRequest.cs b/CryptoExchange.Net/SharedApis/V2/MarkPrice/GetAllMarkPrices/GetAllMarkPricesRequest.cs
similarity index 64%
rename from CryptoExchange.Net/SharedApis/Models/Requests/GetMarkPricesRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/MarkPrice/GetAllMarkPrices/GetAllMarkPricesRequest.cs
index 79a8638c..90aa3809 100644
--- a/CryptoExchange.Net/SharedApis/Models/Requests/GetMarkPricesRequest.cs
+++ b/CryptoExchange.Net/SharedApis/V2/MarkPrice/GetAllMarkPrices/GetAllMarkPricesRequest.cs
@@ -3,14 +3,14 @@
///
/// Request to retrieve the current mark prices for all symbols
///
- public record GetMarkPricesRequest : SharedRequest
+ public record GetAllMarkPricesRequest : SharedRequest
{
///
/// ctor
///
/// Trading mode
/// Exchange specific parameters
- public GetMarkPricesRequest(TradingMode? tradingMode = null, ExchangeParameters? exchangeParameters = null) : base(tradingMode, exchangeParameters)
+ public GetAllMarkPricesRequest(TradingMode? tradingMode = null, ExchangeParameters? exchangeParameters = null) : base(tradingMode, exchangeParameters)
{
}
}
diff --git a/CryptoExchange.Net/SharedApis/V2/MarkPrice/GetAllMarkPrices/IGetAllMarkPrices.cs b/CryptoExchange.Net/SharedApis/V2/MarkPrice/GetAllMarkPrices/IGetAllMarkPrices.cs
new file mode 100644
index 00000000..9217a405
--- /dev/null
+++ b/CryptoExchange.Net/SharedApis/V2/MarkPrice/GetAllMarkPrices/IGetAllMarkPrices.cs
@@ -0,0 +1,37 @@
+using CryptoExchange.Net.Objects;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace CryptoExchange.Net.SharedApis
+{
+ ///
+ /// Operation for retrieving the mark price for all symbols from an exchange.
+ ///
+ public interface IGetAllMarkPrices : ISharedApiCapability
+ {
+ ///
+ /// Mark price request options.
+ /// Use and to check for required and optional parameters for the request.
+ /// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
+ ///
+ GetAllMarkPricesOptions GetAllMarkPricesOptions { get; }
+ ///
+ /// Get the mark price for a symbol, see for request options and exchange specific required/optional parameters.
+ ///
+ /// Request info
+ /// Cancellation token
+ Task> GetAllMarkPricesAsync(GetAllMarkPricesRequest request, CancellationToken ct = default);
+ }
+
+ ///
+ /// Operation for retrieving the mark price for all symbols from an exchange via the REST API.
+ ///
+ public interface IGetAllMarkPricesRest : IGetAllMarkPrices, ISharedRest
+ {
+ ///
+ new Task> GetAllMarkPricesAsync(GetAllMarkPricesRequest request, CancellationToken ct = default);
+ }
+}
diff --git a/CryptoExchange.Net/SharedApis/V2/MarkPrice/GetMarkPrice/GetMarkPriceOptions.cs b/CryptoExchange.Net/SharedApis/V2/MarkPrice/GetMarkPrice/GetMarkPriceOptions.cs
index 33e806ba..9eb581e3 100644
--- a/CryptoExchange.Net/SharedApis/V2/MarkPrice/GetMarkPrice/GetMarkPriceOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/MarkPrice/GetMarkPrice/GetMarkPriceOptions.cs
@@ -12,10 +12,15 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Retrieve the mark price for a futures symbol";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Symbol, "The symbol to retrieve the mark price for", new SharedSymbol(TradingMode.PerpetualLinear, "ETH", "USDT")),
+ };
+
///
/// ctor
///
- public GetMarkPriceOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetMarkPriceRest.GetMarkPriceAsync))
+ public GetMarkPriceOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetMarkPriceRest.GetMarkPriceAsync), _defaultParameterRules)
{
}
}
diff --git a/CryptoExchange.Net/SharedApis/V2/MarkPrice/GetMarkPrice/IGetMarkPrice.cs b/CryptoExchange.Net/SharedApis/V2/MarkPrice/GetMarkPrice/IGetMarkPrice.cs
index 3ebec787..31a10e8f 100644
--- a/CryptoExchange.Net/SharedApis/V2/MarkPrice/GetMarkPrice/IGetMarkPrice.cs
+++ b/CryptoExchange.Net/SharedApis/V2/MarkPrice/GetMarkPrice/IGetMarkPrice.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Mark price request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
GetMarkPriceOptions GetMarkPriceOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/MarkPrice/GetMarkPrices/GetMarkPricesOptions.cs b/CryptoExchange.Net/SharedApis/V2/MarkPrice/GetMarkPrices/GetMarkPricesOptions.cs
deleted file mode 100644
index 084a00fa..00000000
--- a/CryptoExchange.Net/SharedApis/V2/MarkPrice/GetMarkPrices/GetMarkPricesOptions.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace CryptoExchange.Net.SharedApis
-{
- ///
- /// Options for requesting the mark price
- ///
- public class GetMarkPricesOptions : CapabilityOptions
- {
- ///
- public override string Description => "Retrieve the mark prices for all futures symbols";
-
- ///
- /// ctor
- ///
- public GetMarkPricesOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetMarkPricesRest.GetMarkPricesAsync))
- {
- }
- }
-}
diff --git a/CryptoExchange.Net/SharedApis/V2/MarkPrice/GetMarkPrices/IGetMarkPrices.cs b/CryptoExchange.Net/SharedApis/V2/MarkPrice/GetMarkPrices/IGetMarkPrices.cs
deleted file mode 100644
index 776911c4..00000000
--- a/CryptoExchange.Net/SharedApis/V2/MarkPrice/GetMarkPrices/IGetMarkPrices.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using CryptoExchange.Net.Objects;
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace CryptoExchange.Net.SharedApis
-{
- ///
- /// Operation for retrieving the mark price for a symbol from an exchange.
- ///
- public interface IGetMarkPrices : ISharedApiCapability
- {
- ///
- /// Mark price request options.
- /// Use , and to check for required and optional parameters for the request.
- /// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
- ///
- GetMarkPricesOptions GetMarkPricesOptions { get; }
- ///
- /// Get the mark price for a symbol, see for request options and exchange specific required/optional parameters.
- ///
- /// Request info
- /// Cancellation token
- Task> GetMarkPricesAsync(GetMarkPricesRequest request, CancellationToken ct = default);
- }
-
- ///
- /// Operation for retrieving the mark price for a symbol from an exchange via the REST API.
- ///
- public interface IGetMarkPricesRest : IGetMarkPrices, ISharedRest
- {
- ///
- new Task> GetMarkPricesAsync(GetMarkPricesRequest request, CancellationToken ct = default);
- }
-}
diff --git a/CryptoExchange.Net/SharedApis/V2/OpenInterest/GetOpenInterestOptions.cs b/CryptoExchange.Net/SharedApis/V2/OpenInterest/GetOpenInterestOptions.cs
index 95c1dfac..2bee7a9d 100644
--- a/CryptoExchange.Net/SharedApis/V2/OpenInterest/GetOpenInterestOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/OpenInterest/GetOpenInterestOptions.cs
@@ -12,10 +12,15 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Retrieve open interest for a futures symbol";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Symbol, "The symbol to retrieve open interest for", new SharedSymbol(TradingMode.PerpetualLinear, "ETH", "USDT")),
+ };
+
///
/// ctor
///
- public GetOpenInterestOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetOpenInterestRest.GetOpenInterestAsync))
+ public GetOpenInterestOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetOpenInterestRest.GetOpenInterestAsync), _defaultParameterRules)
{
}
}
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/GetOpenInterestRequest.cs b/CryptoExchange.Net/SharedApis/V2/OpenInterest/GetOpenInterestRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/GetOpenInterestRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/OpenInterest/GetOpenInterestRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/V2/OpenInterest/IGetOpenInterest.cs b/CryptoExchange.Net/SharedApis/V2/OpenInterest/IGetOpenInterest.cs
index d17ecb16..1c395042 100644
--- a/CryptoExchange.Net/SharedApis/V2/OpenInterest/IGetOpenInterest.cs
+++ b/CryptoExchange.Net/SharedApis/V2/OpenInterest/IGetOpenInterest.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Open interest request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
GetOpenInterestOptions GetOpenInterestOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/OrderBooks/GetBookTicker/GetBookTickerOptions.cs b/CryptoExchange.Net/SharedApis/V2/OrderBooks/GetBookTicker/GetBookTickerOptions.cs
index 028119c8..c36c4138 100644
--- a/CryptoExchange.Net/SharedApis/V2/OrderBooks/GetBookTicker/GetBookTickerOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/OrderBooks/GetBookTicker/GetBookTickerOptions.cs
@@ -12,10 +12,15 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Retrieve the best bid and ask price for a symbol";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Symbol, "The symbol to retrieve the book ticker for", new SharedSymbol(TradingMode.Spot, "ETH", "USDT")),
+ };
+
///
/// ctor
///
- public GetBookTickerOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetBookTickerRest.GetBookTickerAsync))
+ public GetBookTickerOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetBookTickerRest.GetBookTickerAsync), _defaultParameterRules)
{
}
}
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/GetBookTickerRequest.cs b/CryptoExchange.Net/SharedApis/V2/OrderBooks/GetBookTicker/GetBookTickerRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/GetBookTickerRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/OrderBooks/GetBookTicker/GetBookTickerRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/V2/OrderBooks/GetBookTicker/IGetBookTicker.cs b/CryptoExchange.Net/SharedApis/V2/OrderBooks/GetBookTicker/IGetBookTicker.cs
index 55ecd205..720bfc39 100644
--- a/CryptoExchange.Net/SharedApis/V2/OrderBooks/GetBookTicker/IGetBookTicker.cs
+++ b/CryptoExchange.Net/SharedApis/V2/OrderBooks/GetBookTicker/IGetBookTicker.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Book ticker request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
GetBookTickerOptions GetBookTickerOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/OrderBooks/GetOrderBook/GetOrderBookOptions.cs b/CryptoExchange.Net/SharedApis/V2/OrderBooks/GetOrderBook/GetOrderBookOptions.cs
index 50dcb998..76bdfcbf 100644
--- a/CryptoExchange.Net/SharedApis/V2/OrderBooks/GetOrderBook/GetOrderBookOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/OrderBooks/GetOrderBook/GetOrderBookOptions.cs
@@ -13,6 +13,12 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Retrieve the current order book for a symbol";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Symbol, "The symbol to retrieve the order book for", new SharedSymbol(TradingMode.Spot, "ETH", "USDT")),
+ RequestParameterRule.Optional(x => x.Limit, "The maximum order book depth to retrieve", 100),
+ };
+
///
/// Supported order book depths
///
@@ -31,7 +37,7 @@ namespace CryptoExchange.Net.SharedApis
/// ctor
///
public GetOrderBookOptions(string exchange, int minLimit, int maxLimit, bool authenticated)
- : base(exchange, authenticated, nameof(IGetOrderBookRest.GetOrderBookAsync))
+ : base(exchange, authenticated, nameof(IGetOrderBookRest.GetOrderBookAsync), _defaultParameterRules)
{
MinLimit = minLimit;
MaxLimit = maxLimit;
@@ -41,7 +47,7 @@ namespace CryptoExchange.Net.SharedApis
/// ctor
///
public GetOrderBookOptions(string exchange, int[] supportedLimits, bool authenticated)
- : base(exchange, authenticated, nameof(IGetOrderBookRest.GetOrderBookAsync))
+ : base(exchange, authenticated, nameof(IGetOrderBookRest.GetOrderBookAsync), _defaultParameterRules)
{
SupportedLimits = supportedLimits;
}
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/GetOrderBookRequest.cs b/CryptoExchange.Net/SharedApis/V2/OrderBooks/GetOrderBook/GetOrderBookRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/GetOrderBookRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/OrderBooks/GetOrderBook/GetOrderBookRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/V2/OrderBooks/GetOrderBook/IGetOrderBook.cs b/CryptoExchange.Net/SharedApis/V2/OrderBooks/GetOrderBook/IGetOrderBook.cs
index 3d796216..ccf38f0d 100644
--- a/CryptoExchange.Net/SharedApis/V2/OrderBooks/GetOrderBook/IGetOrderBook.cs
+++ b/CryptoExchange.Net/SharedApis/V2/OrderBooks/GetOrderBook/IGetOrderBook.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Order book request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
GetOrderBookOptions GetOrderBookOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/OrderBooks/SubscribeIncrementalOrderBook/SubscribeIncrementalOrderBookOptions.cs b/CryptoExchange.Net/SharedApis/V2/OrderBooks/SubscribeIncrementalOrderBook/SubscribeIncrementalOrderBookOptions.cs
index 6046852d..803687e8 100644
--- a/CryptoExchange.Net/SharedApis/V2/OrderBooks/SubscribeIncrementalOrderBook/SubscribeIncrementalOrderBookOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/OrderBooks/SubscribeIncrementalOrderBook/SubscribeIncrementalOrderBookOptions.cs
@@ -12,6 +12,13 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Subscribe to incremental order book updates for a symbol";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Optional(x => x.Symbol, "The symbol to subscribe to", new SharedSymbol(TradingMode.Spot, "ETH", "USDT")),
+ RequestParameterRule.Optional(x => x.Symbols, "The symbols to subscribe to", new[] { new SharedSymbol(TradingMode.Spot, "ETH", "USDT") }),
+ RequestParameterRule.Optional(x => x.Limit, "The order book depth", 100),
+ };
+
///
/// Order book depths supported for updates
///
@@ -26,7 +33,7 @@ namespace CryptoExchange.Net.SharedApis
/// ctor
///
public SubscribeIncrementalOrderBookOptions(string exchange, bool needsAuthentication, int[] limits, SharedOrderBookSubscriptionType updateType)
- : base(exchange, needsAuthentication, nameof(ISubscribeIncrementalOrderBookSocket.SubscribeToOrderBookUpdatesAsync))
+ : base(exchange, needsAuthentication, nameof(ISubscribeIncrementalOrderBookSocket.SubscribeToOrderBookUpdatesAsync), _defaultParameterRules)
{
SupportedLimits = limits;
UpdateType = updateType;
diff --git a/CryptoExchange.Net/SharedApis/V2/OrderBooks/SubscribeOrderBook/SubscribeOrderBookOptions.cs b/CryptoExchange.Net/SharedApis/V2/OrderBooks/SubscribeOrderBook/SubscribeOrderBookOptions.cs
index 2a55f349..0dee7819 100644
--- a/CryptoExchange.Net/SharedApis/V2/OrderBooks/SubscribeOrderBook/SubscribeOrderBookOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/OrderBooks/SubscribeOrderBook/SubscribeOrderBookOptions.cs
@@ -12,6 +12,13 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Subscribe to order book updates for a symbol";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Optional(x => x.Symbol, "The symbol to subscribe to", new SharedSymbol(TradingMode.Spot, "ETH", "USDT")),
+ RequestParameterRule.Optional(x => x.Symbols, "The symbols to subscribe to", new[] { new SharedSymbol(TradingMode.Spot, "ETH", "USDT") }),
+ RequestParameterRule.Optional(x => x.Limit, "The order book depth", 100),
+ };
+
///
/// Order book depths supported for updates
///
@@ -20,7 +27,7 @@ namespace CryptoExchange.Net.SharedApis
///
/// ctor
///
- public SubscribeOrderBookOptions(string exchange, bool needsAuthentication, int[] limits) : base(exchange, needsAuthentication, nameof(ISubscribeOrderBookSocket.SubscribeToOrderBookUpdatesAsync))
+ public SubscribeOrderBookOptions(string exchange, bool needsAuthentication, int[] limits) : base(exchange, needsAuthentication, nameof(ISubscribeOrderBookSocket.SubscribeToOrderBookUpdatesAsync), _defaultParameterRules)
{
SupportedLimits = limits;
}
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/SubscribeOrderBookRequest.cs b/CryptoExchange.Net/SharedApis/V2/OrderBooks/SubscribeOrderBook/SubscribeOrderBookRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/SubscribeOrderBookRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/OrderBooks/SubscribeOrderBook/SubscribeOrderBookRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/CancelAllOrdersRequest.cs b/CryptoExchange.Net/SharedApis/V2/Orders/CancelAllOrdersRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/CancelAllOrdersRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/Orders/CancelAllOrdersRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/CancelAllSymbolOrdersRequest.cs b/CryptoExchange.Net/SharedApis/V2/Orders/CancelAllSymbolOrdersRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/CancelAllSymbolOrdersRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/Orders/CancelAllSymbolOrdersRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/CancelOrderRequest.cs b/CryptoExchange.Net/SharedApis/V2/Orders/CancelOrderRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/CancelOrderRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/Orders/CancelOrderRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/V2/Orders/Futures/CancelAllFuturesOrders/CancelAllFuturesOrdersOptions.cs b/CryptoExchange.Net/SharedApis/V2/Orders/Futures/CancelAllFuturesOrders/CancelAllFuturesOrdersOptions.cs
index aa3b3f99..732f3cfa 100644
--- a/CryptoExchange.Net/SharedApis/V2/Orders/Futures/CancelAllFuturesOrders/CancelAllFuturesOrdersOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Orders/Futures/CancelAllFuturesOrders/CancelAllFuturesOrdersOptions.cs
@@ -13,10 +13,12 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Cancel all Futures orders";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = [];
+
///
/// ctor
///
- public CancelAllFuturesOrdersOptions(string exchange) : base(exchange, true, nameof(ICancelAllFuturesOrders.CancelAllFuturesOrdersAsync))
+ public CancelAllFuturesOrdersOptions(string exchange) : base(exchange, true, nameof(ICancelAllFuturesOrders.CancelAllFuturesOrdersAsync), _defaultParameterRules)
{
}
}
diff --git a/CryptoExchange.Net/SharedApis/V2/Orders/Futures/CancelAllFuturesOrders/ICancelAllFuturesOrder.cs b/CryptoExchange.Net/SharedApis/V2/Orders/Futures/CancelAllFuturesOrders/ICancelAllFuturesOrder.cs
index 1f623135..a643d1c2 100644
--- a/CryptoExchange.Net/SharedApis/V2/Orders/Futures/CancelAllFuturesOrders/ICancelAllFuturesOrder.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Orders/Futures/CancelAllFuturesOrders/ICancelAllFuturesOrder.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Futures cancel all orders request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
CancelAllFuturesOrdersOptions CancelAllFuturesOrdersOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/Orders/Futures/CancelAllFuturesSymbolOrders/CancelAllFuturesSymbolOrdersOptions.cs b/CryptoExchange.Net/SharedApis/V2/Orders/Futures/CancelAllFuturesSymbolOrders/CancelAllFuturesSymbolOrdersOptions.cs
index 01f987d1..f5a748b1 100644
--- a/CryptoExchange.Net/SharedApis/V2/Orders/Futures/CancelAllFuturesSymbolOrders/CancelAllFuturesSymbolOrdersOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Orders/Futures/CancelAllFuturesSymbolOrders/CancelAllFuturesSymbolOrdersOptions.cs
@@ -12,10 +12,15 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Cancel all open futures orders for a specific symbol";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Symbol, "The symbol of the orders to cancel", new SharedSymbol(TradingMode.PerpetualLinear, "ETH", "USDT")),
+ };
+
///
/// ctor
///
- public CancelAllFuturesSymbolOrdersOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ICancelAllFuturesSymbolOrders.CancelAllFuturesSymbolOrdersAsync))
+ public CancelAllFuturesSymbolOrdersOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ICancelAllFuturesSymbolOrders.CancelAllFuturesSymbolOrdersAsync), _defaultParameterRules)
{
}
}
diff --git a/CryptoExchange.Net/SharedApis/V2/Orders/Futures/CancelAllFuturesSymbolOrders/ICancelAllFuturesSymbolOrders.cs b/CryptoExchange.Net/SharedApis/V2/Orders/Futures/CancelAllFuturesSymbolOrders/ICancelAllFuturesSymbolOrders.cs
index 2c9714a8..bd40e522 100644
--- a/CryptoExchange.Net/SharedApis/V2/Orders/Futures/CancelAllFuturesSymbolOrders/ICancelAllFuturesSymbolOrders.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Orders/Futures/CancelAllFuturesSymbolOrders/ICancelAllFuturesSymbolOrders.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Futures cancel order request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
CancelAllFuturesSymbolOrdersOptions CancelAllFuturesSymbolOrdersOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/Orders/Futures/CancelFuturesOrder/CancelFuturesOrderOptions.cs b/CryptoExchange.Net/SharedApis/V2/Orders/Futures/CancelFuturesOrder/CancelFuturesOrderOptions.cs
index 4a05a677..7b08e28c 100644
--- a/CryptoExchange.Net/SharedApis/V2/Orders/Futures/CancelFuturesOrder/CancelFuturesOrderOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Orders/Futures/CancelFuturesOrder/CancelFuturesOrderOptions.cs
@@ -12,10 +12,16 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Cancel a futures order";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Symbol, "The symbol of the order to cancel", new SharedSymbol(TradingMode.PerpetualLinear, "ETH", "USDT")),
+ RequestParameterRule.Required(x => x.OrderId, "The id of the order to cancel", "123"),
+ };
+
///
/// ctor
///
- public CancelFuturesOrderOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ICancelFuturesOrder.CancelFuturesOrderAsync))
+ public CancelFuturesOrderOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ICancelFuturesOrder.CancelFuturesOrderAsync), _defaultParameterRules)
{
}
}
diff --git a/CryptoExchange.Net/SharedApis/V2/Orders/Futures/CancelFuturesOrder/ICancelFuturesOrder.cs b/CryptoExchange.Net/SharedApis/V2/Orders/Futures/CancelFuturesOrder/ICancelFuturesOrder.cs
index 80be793c..d6a6f878 100644
--- a/CryptoExchange.Net/SharedApis/V2/Orders/Futures/CancelFuturesOrder/ICancelFuturesOrder.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Orders/Futures/CancelFuturesOrder/ICancelFuturesOrder.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Futures cancel order request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
CancelFuturesOrderOptions CancelFuturesOrderOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/Orders/Futures/CancelFuturesOrderByClientOrderId/CancelFuturesOrderByClientOrderIdOptions.cs b/CryptoExchange.Net/SharedApis/V2/Orders/Futures/CancelFuturesOrderByClientOrderId/CancelFuturesOrderByClientOrderIdOptions.cs
index 5637ef54..90fb0622 100644
--- a/CryptoExchange.Net/SharedApis/V2/Orders/Futures/CancelFuturesOrderByClientOrderId/CancelFuturesOrderByClientOrderIdOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Orders/Futures/CancelFuturesOrderByClientOrderId/CancelFuturesOrderByClientOrderIdOptions.cs
@@ -8,10 +8,16 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Cancel a futures order by its client order id";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Symbol, "The symbol of the order to cancel", new SharedSymbol(TradingMode.PerpetualLinear, "ETH", "USDT")),
+ RequestParameterRule.Required(x => x.OrderId, "The id of the order to cancel", "123"),
+ };
+
///
/// ctor
///
- public CancelFuturesOrderByClientOrderIdOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ICancelFuturesOrderByClientOrderIdRest.CancelFuturesOrderByClientOrderIdAsync))
+ public CancelFuturesOrderByClientOrderIdOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ICancelFuturesOrderByClientOrderIdRest.CancelFuturesOrderByClientOrderIdAsync), _defaultParameterRules)
{
}
}
diff --git a/CryptoExchange.Net/SharedApis/V2/Orders/Futures/CancelFuturesOrderByClientOrderId/ICancelFuturesOrderByClientOrderId.cs b/CryptoExchange.Net/SharedApis/V2/Orders/Futures/CancelFuturesOrderByClientOrderId/ICancelFuturesOrderByClientOrderId.cs
index 3593d8ba..feaacce6 100644
--- a/CryptoExchange.Net/SharedApis/V2/Orders/Futures/CancelFuturesOrderByClientOrderId/ICancelFuturesOrderByClientOrderId.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Orders/Futures/CancelFuturesOrderByClientOrderId/ICancelFuturesOrderByClientOrderId.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Futures cancel order by client order id request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
CancelFuturesOrderByClientOrderIdOptions CancelFuturesOrderByClientOrderIdOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/Orders/Futures/EditFuturesOrder/EditFuturesOrderOptions.cs b/CryptoExchange.Net/SharedApis/V2/Orders/Futures/EditFuturesOrder/EditFuturesOrderOptions.cs
index 4aecd52d..1b84ec19 100644
--- a/CryptoExchange.Net/SharedApis/V2/Orders/Futures/EditFuturesOrder/EditFuturesOrderOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Orders/Futures/EditFuturesOrder/EditFuturesOrderOptions.cs
@@ -12,11 +12,19 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Edit an existing Futures order";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Symbol, "The symbol of the order to edit", new SharedSymbol(TradingMode.PerpetualLinear, "ETH", "USDT")),
+ RequestParameterRule.Required(x => x.OrderId, "The id of the order to edit", "123"),
+ RequestParameterRule.Optional(x => x.Quantity, "The new order quantity", SharedQuantity.Base(1)),
+ RequestParameterRule.Optional(x => x.Price, "The new order price", 0.1m),
+ };
+
///
/// ctor
///
- public EditFuturesOrderOptions(string exchange) : base(exchange, true, nameof(IEditFuturesOrder.EditFuturesOrderAsync))
+ public EditFuturesOrderOptions(string exchange) : base(exchange, true, nameof(IEditFuturesOrder.EditFuturesOrderAsync), _defaultParameterRules)
{
}
}
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/EditFuturesOrderRequest.cs b/CryptoExchange.Net/SharedApis/V2/Orders/Futures/EditFuturesOrder/EditFuturesOrderRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/EditFuturesOrderRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/Orders/Futures/EditFuturesOrder/EditFuturesOrderRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/V2/Orders/Futures/EditFuturesOrder/IEditFuturesOrder.cs b/CryptoExchange.Net/SharedApis/V2/Orders/Futures/EditFuturesOrder/IEditFuturesOrder.cs
index 6afe6c57..a19bf4f2 100644
--- a/CryptoExchange.Net/SharedApis/V2/Orders/Futures/EditFuturesOrder/IEditFuturesOrder.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Orders/Futures/EditFuturesOrder/IEditFuturesOrder.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Futures edit order request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
EditFuturesOrderOptions EditFuturesOrderOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/Orders/Futures/GetClosedFuturesOrders/GetFuturesClosedOrdersOptions.cs b/CryptoExchange.Net/SharedApis/V2/Orders/Futures/GetClosedFuturesOrders/GetFuturesClosedOrdersOptions.cs
index 648b6c52..aa21ae5e 100644
--- a/CryptoExchange.Net/SharedApis/V2/Orders/Futures/GetClosedFuturesOrders/GetFuturesClosedOrdersOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Orders/Futures/GetClosedFuturesOrders/GetFuturesClosedOrdersOptions.cs
@@ -12,11 +12,20 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Retrieve closed futures orders";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Symbol, "The symbol to retrieve closed orders for", new SharedSymbol(TradingMode.PerpetualLinear, "ETH", "USDT")),
+ RequestParameterRule.Optional(x => x.StartTime, "Filter the result set by start time", DateTime.UtcNow.AddDays(-1)),
+ RequestParameterRule.Optional(x => x.EndTime, "Filter the result set by end time", DateTime.UtcNow.AddHours(-1)),
+ RequestParameterRule.Optional(x => x.Limit, "Limit the result set to a maximum number of items", 100),
+ RequestParameterRule.Optional(x => x.Direction, "The direction in which to retrieve the results", DataDirection.Descending),
+ };
+
///
/// ctor
///
public GetFuturesClosedOrdersOptions(string exchange, bool supportsAscending, bool supportsDescending, bool timeFilterSupported, int maxLimit)
- : base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, true, nameof(IGetClosedFuturesOrdersRest.GetClosedFuturesOrdersAsync))
+ : base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, true, nameof(IGetClosedFuturesOrdersRest.GetClosedFuturesOrdersAsync), _defaultParameterRules)
{
}
diff --git a/CryptoExchange.Net/SharedApis/V2/Orders/Futures/GetClosedFuturesOrders/IGetClosedFuturesOrders.cs b/CryptoExchange.Net/SharedApis/V2/Orders/Futures/GetClosedFuturesOrders/IGetClosedFuturesOrders.cs
index 44eae1e6..aa5296f2 100644
--- a/CryptoExchange.Net/SharedApis/V2/Orders/Futures/GetClosedFuturesOrders/IGetClosedFuturesOrders.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Orders/Futures/GetClosedFuturesOrders/IGetClosedFuturesOrders.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Futures get closed orders request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
GetFuturesClosedOrdersOptions GetClosedFuturesOrdersOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/Orders/Futures/GetFuturesOrder/GetFuturesOrderOptions.cs b/CryptoExchange.Net/SharedApis/V2/Orders/Futures/GetFuturesOrder/GetFuturesOrderOptions.cs
index dd9d9660..e9f8ab53 100644
--- a/CryptoExchange.Net/SharedApis/V2/Orders/Futures/GetFuturesOrder/GetFuturesOrderOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Orders/Futures/GetFuturesOrder/GetFuturesOrderOptions.cs
@@ -12,10 +12,16 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Retrieve a futures order";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Symbol, "The symbol of the order to retrieve", new SharedSymbol(TradingMode.PerpetualLinear, "ETH", "USDT")),
+ RequestParameterRule.Required(x => x.OrderId, "The id of the order to retrieve", "123"),
+ };
+
///
/// ctor
///
- public GetFuturesOrderOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetFuturesOrderRest.GetFuturesOrderAsync))
+ public GetFuturesOrderOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetFuturesOrderRest.GetFuturesOrderAsync), _defaultParameterRules)
{
}
}
diff --git a/CryptoExchange.Net/SharedApis/V2/Orders/Futures/GetFuturesOrder/IGetFuturesOrder.cs b/CryptoExchange.Net/SharedApis/V2/Orders/Futures/GetFuturesOrder/IGetFuturesOrder.cs
index 6d613764..8abb1ac3 100644
--- a/CryptoExchange.Net/SharedApis/V2/Orders/Futures/GetFuturesOrder/IGetFuturesOrder.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Orders/Futures/GetFuturesOrder/IGetFuturesOrder.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Futures get order request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
GetFuturesOrderOptions GetFuturesOrderOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/Orders/Futures/GetFuturesOrderByClientOrderId/GetFuturesOrderByClientOrderIdOptions.cs b/CryptoExchange.Net/SharedApis/V2/Orders/Futures/GetFuturesOrderByClientOrderId/GetFuturesOrderByClientOrderIdOptions.cs
index bd090342..95f7d716 100644
--- a/CryptoExchange.Net/SharedApis/V2/Orders/Futures/GetFuturesOrderByClientOrderId/GetFuturesOrderByClientOrderIdOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Orders/Futures/GetFuturesOrderByClientOrderId/GetFuturesOrderByClientOrderIdOptions.cs
@@ -12,10 +12,16 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Retrieve a futures order by its client order id";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Symbol, "The symbol of the order to retrieve", new SharedSymbol(TradingMode.PerpetualLinear, "ETH", "USDT")),
+ RequestParameterRule.Required(x => x.OrderId, "The id of the order to retrieve", "123"),
+ };
+
///
/// ctor
///
- public GetFuturesOrderByClientOrderIdOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetFuturesOrderByClientOrderIdRest.GetFuturesOrderByClientOrderIdAsync))
+ public GetFuturesOrderByClientOrderIdOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetFuturesOrderByClientOrderIdRest.GetFuturesOrderByClientOrderIdAsync), _defaultParameterRules)
{
}
}
diff --git a/CryptoExchange.Net/SharedApis/V2/Orders/Futures/GetFuturesOrderByClientOrderId/IGetFuturesOrderByClientOrderId.cs b/CryptoExchange.Net/SharedApis/V2/Orders/Futures/GetFuturesOrderByClientOrderId/IGetFuturesOrderByClientOrderId.cs
index ad8fc396..97f2a99f 100644
--- a/CryptoExchange.Net/SharedApis/V2/Orders/Futures/GetFuturesOrderByClientOrderId/IGetFuturesOrderByClientOrderId.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Orders/Futures/GetFuturesOrderByClientOrderId/IGetFuturesOrderByClientOrderId.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Futures get order by client order id request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
GetFuturesOrderByClientOrderIdOptions GetFuturesOrderByClientOrderIdOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/Orders/Futures/GetOpenFuturesOrders/GetOpenFuturesOrdersOptions.cs b/CryptoExchange.Net/SharedApis/V2/Orders/Futures/GetOpenFuturesOrders/GetOpenFuturesOrdersOptions.cs
index f54174e9..10314d36 100644
--- a/CryptoExchange.Net/SharedApis/V2/Orders/Futures/GetOpenFuturesOrders/GetOpenFuturesOrdersOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Orders/Futures/GetOpenFuturesOrders/GetOpenFuturesOrdersOptions.cs
@@ -12,10 +12,16 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Retrieve open futures orders";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Optional(x => x.TradingMode, "Filter the open orders by trading mode", TradingMode.PerpetualLinear),
+ RequestParameterRule.Optional(x => x.Symbol, "The symbol to retrieve open orders for", new SharedSymbol(TradingMode.PerpetualLinear, "ETH", "USDT")),
+ };
+
///
/// ctor
///
- public GetOpenFuturesOrdersOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetOpenFuturesOrdersRest.GetOpenFuturesOrdersAsync))
+ public GetOpenFuturesOrdersOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetOpenFuturesOrdersRest.GetOpenFuturesOrdersAsync), _defaultParameterRules)
{
}
}
diff --git a/CryptoExchange.Net/SharedApis/V2/Orders/Futures/GetOpenFuturesOrders/IGetOpenFuturesOrders.cs b/CryptoExchange.Net/SharedApis/V2/Orders/Futures/GetOpenFuturesOrders/IGetOpenFuturesOrders.cs
index e0d7655b..d28d7e63 100644
--- a/CryptoExchange.Net/SharedApis/V2/Orders/Futures/GetOpenFuturesOrders/IGetOpenFuturesOrders.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Orders/Futures/GetOpenFuturesOrders/IGetOpenFuturesOrders.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Futures get open orders request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
GetOpenFuturesOrdersOptions GetOpenFuturesOrdersOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/Orders/Futures/PlaceFuturesOrder/IPlaceFuturesOrder.cs b/CryptoExchange.Net/SharedApis/V2/Orders/Futures/PlaceFuturesOrder/IPlaceFuturesOrder.cs
index 54171e51..8893432b 100644
--- a/CryptoExchange.Net/SharedApis/V2/Orders/Futures/PlaceFuturesOrder/IPlaceFuturesOrder.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Orders/Futures/PlaceFuturesOrder/IPlaceFuturesOrder.cs
@@ -41,7 +41,7 @@ namespace CryptoExchange.Net.SharedApis
///
/// Futures place order request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
PlaceFuturesOrderOptions PlaceFuturesOrderOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/Orders/Futures/PlaceFuturesOrder/PlaceFuturesOrderOptions.cs b/CryptoExchange.Net/SharedApis/V2/Orders/Futures/PlaceFuturesOrder/PlaceFuturesOrderOptions.cs
index 1bf5b699..b40d58d9 100644
--- a/CryptoExchange.Net/SharedApis/V2/Orders/Futures/PlaceFuturesOrder/PlaceFuturesOrderOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Orders/Futures/PlaceFuturesOrder/PlaceFuturesOrderOptions.cs
@@ -12,6 +12,23 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Place a new futures order";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Symbol, "The symbol to place the order on", new SharedSymbol(TradingMode.PerpetualLinear, "ETH", "USDT")),
+ RequestParameterRule.Required(x => x.Side, "The order side", SharedOrderSide.Buy),
+ RequestParameterRule.Required(x => x.OrderType, "The order type", SharedOrderType.Limit),
+ RequestParameterRule.Optional(x => x.TimeInForce, "The order time in force", SharedTimeInForce.GoodTillCanceled),
+ RequestParameterRule.Optional(x => x.Quantity, "The order quantity", SharedQuantity.Base(0.1m)),
+ RequestParameterRule.Optional(x => x.Price, "The order price", 1m),
+ RequestParameterRule.Optional(x => x.ClientOrderId, "The client order id", "123"),
+ RequestParameterRule.Optional(x => x.PositionSide, "The position side of the order", SharedPositionSide.Long),
+ RequestParameterRule.Optional(x => x.MarginMode, "The margin mode of the order", SharedMarginMode.Cross),
+ RequestParameterRule.Optional(x => x.ReduceOnly, "Whether the order should only reduce a position", false),
+ RequestParameterRule.Optional(x => x.Leverage, "The leverage for the position", 10m),
+ RequestParameterRule.Optional(x => x.TakeProfitPrice, "The take profit price", 1.1m),
+ RequestParameterRule.Optional(x => x.StopLossPrice, "The stop loss price", 0.9m),
+ };
+
///
/// Whether or not the API supports setting take profit / stop loss with the order
///
@@ -20,7 +37,7 @@ namespace CryptoExchange.Net.SharedApis
///
/// ctor
///
- public PlaceFuturesOrderOptions(string exchange, bool supportsTpSl) : base(exchange, true, nameof(IPlaceFuturesOrder.PlaceFuturesOrderAsync))
+ public PlaceFuturesOrderOptions(string exchange, bool supportsTpSl) : base(exchange, true, nameof(IPlaceFuturesOrder.PlaceFuturesOrderAsync), _defaultParameterRules)
{
SupportsTpSl = supportsTpSl;
}
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/PlaceFuturesOrderRequest.cs b/CryptoExchange.Net/SharedApis/V2/Orders/Futures/PlaceFuturesOrder/PlaceFuturesOrderRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/PlaceFuturesOrderRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/Orders/Futures/PlaceFuturesOrder/PlaceFuturesOrderRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/V2/Orders/Futures/SubscribeFuturesOrder/SubscribeFuturesOrderOptions.cs b/CryptoExchange.Net/SharedApis/V2/Orders/Futures/SubscribeFuturesOrder/SubscribeFuturesOrderOptions.cs
index 0006a915..2b580490 100644
--- a/CryptoExchange.Net/SharedApis/V2/Orders/Futures/SubscribeFuturesOrder/SubscribeFuturesOrderOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Orders/Futures/SubscribeFuturesOrder/SubscribeFuturesOrderOptions.cs
@@ -12,10 +12,15 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Subscribe to futures order updates";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Optional(x => x.TradingMode, "Filter futures order updates by trading mode", TradingMode.PerpetualLinear),
+ };
+
///
/// ctor
///
- public SubscribeFuturesOrderOptions(string exchange, bool needsAuthentication) : base(exchange, needsAuthentication, nameof(ISubscribeFuturesOrdersSocket.SubscribeToFuturesOrderUpdatesAsync))
+ public SubscribeFuturesOrderOptions(string exchange, bool needsAuthentication) : base(exchange, needsAuthentication, nameof(ISubscribeFuturesOrdersSocket.SubscribeToFuturesOrderUpdatesAsync), _defaultParameterRules)
{
}
}
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/SubscribeFuturesOrderRequest.cs b/CryptoExchange.Net/SharedApis/V2/Orders/Futures/SubscribeFuturesOrder/SubscribeFuturesOrderRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/SubscribeFuturesOrderRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/Orders/Futures/SubscribeFuturesOrder/SubscribeFuturesOrderRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/GetClosedOrdersRequest.cs b/CryptoExchange.Net/SharedApis/V2/Orders/GetClosedOrdersRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/GetClosedOrdersRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/Orders/GetClosedOrdersRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/GetOpenOrdersRequest.cs b/CryptoExchange.Net/SharedApis/V2/Orders/GetOpenOrdersRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/GetOpenOrdersRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/Orders/GetOpenOrdersRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/GetOrderRequest.cs b/CryptoExchange.Net/SharedApis/V2/Orders/GetOrderRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/GetOrderRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/Orders/GetOrderRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/GetOrderTradesRequest.cs b/CryptoExchange.Net/SharedApis/V2/Orders/GetOrderTradesRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/GetOrderTradesRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/Orders/GetOrderTradesRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/V2/Orders/Spot/CancelAllSpotOrders/CancelAllSpotOrdersOptions.cs b/CryptoExchange.Net/SharedApis/V2/Orders/Spot/CancelAllSpotOrders/CancelAllSpotOrdersOptions.cs
index fe5499f5..7c1eac2d 100644
--- a/CryptoExchange.Net/SharedApis/V2/Orders/Spot/CancelAllSpotOrders/CancelAllSpotOrdersOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Orders/Spot/CancelAllSpotOrders/CancelAllSpotOrdersOptions.cs
@@ -13,10 +13,12 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Cancel all spot orders";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = [];
+
///
/// ctor
///
- public CancelAllSpotOrdersOptions(string exchange) : base(exchange, true, nameof(ICancelAllSpotOrders.CancelAllSpotOrdersAsync))
+ public CancelAllSpotOrdersOptions(string exchange) : base(exchange, true, nameof(ICancelAllSpotOrders.CancelAllSpotOrdersAsync), _defaultParameterRules)
{
}
}
diff --git a/CryptoExchange.Net/SharedApis/V2/Orders/Spot/CancelAllSpotOrders/ICancelAllSpotOrder.cs b/CryptoExchange.Net/SharedApis/V2/Orders/Spot/CancelAllSpotOrders/ICancelAllSpotOrder.cs
index 6da0bead..5713f617 100644
--- a/CryptoExchange.Net/SharedApis/V2/Orders/Spot/CancelAllSpotOrders/ICancelAllSpotOrder.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Orders/Spot/CancelAllSpotOrders/ICancelAllSpotOrder.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Spot cancel all orders request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
CancelAllSpotOrdersOptions CancelAllSpotOrdersOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/Orders/Spot/CancelAllSpotSymbolOrders/CancelAllSpotSymbolOrdersOptions.cs b/CryptoExchange.Net/SharedApis/V2/Orders/Spot/CancelAllSpotSymbolOrders/CancelAllSpotSymbolOrdersOptions.cs
index 7103ae36..7320686c 100644
--- a/CryptoExchange.Net/SharedApis/V2/Orders/Spot/CancelAllSpotSymbolOrders/CancelAllSpotSymbolOrdersOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Orders/Spot/CancelAllSpotSymbolOrders/CancelAllSpotSymbolOrdersOptions.cs
@@ -12,10 +12,16 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Cancel all open Spot orders for a specific symbol";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Symbol, "The symbol of the orders to cancel", new SharedSymbol(TradingMode.Spot, "ETH", "USDT")),
+ };
+
///
/// ctor
///
- public CancelAllSpotSymbolOrdersOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ICancelAllSpotSymbolOrders.CancelAllSpotSymbolOrdersAsync))
+ public CancelAllSpotSymbolOrdersOptions(string exchange, bool authenticated)
+ : base(exchange, authenticated, nameof(ICancelAllSpotSymbolOrders.CancelAllSpotSymbolOrdersAsync), _defaultParameterRules)
{
}
}
diff --git a/CryptoExchange.Net/SharedApis/V2/Orders/Spot/CancelAllSpotSymbolOrders/ICancelAllSpotSymbolOrders.cs b/CryptoExchange.Net/SharedApis/V2/Orders/Spot/CancelAllSpotSymbolOrders/ICancelAllSpotSymbolOrders.cs
index 1dde9b8e..9064f86c 100644
--- a/CryptoExchange.Net/SharedApis/V2/Orders/Spot/CancelAllSpotSymbolOrders/ICancelAllSpotSymbolOrders.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Orders/Spot/CancelAllSpotSymbolOrders/ICancelAllSpotSymbolOrders.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Spot cancel order request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
CancelAllSpotSymbolOrdersOptions CancelAllSpotSymbolOrdersOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/Orders/Spot/CancelSpotOrder/CancelSpotOrderOptions.cs b/CryptoExchange.Net/SharedApis/V2/Orders/Spot/CancelSpotOrder/CancelSpotOrderOptions.cs
index 3da8d199..f781676b 100644
--- a/CryptoExchange.Net/SharedApis/V2/Orders/Spot/CancelSpotOrder/CancelSpotOrderOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Orders/Spot/CancelSpotOrder/CancelSpotOrderOptions.cs
@@ -13,10 +13,17 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Cancel a spot order";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Symbol, "The symbol of the order to cancel", new SharedSymbol(TradingMode.Spot, "ETH", "USDT")),
+ RequestParameterRule.Required(x => x.OrderId, "The order id of the order to cancel", "123")
+ };
+
///
/// ctor
///
- public CancelSpotOrderOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ICancelSpotOrder.CancelSpotOrderAsync))
+ public CancelSpotOrderOptions(string exchange, bool authenticated)
+ : base(exchange, authenticated, nameof(ICancelSpotOrder.CancelSpotOrderAsync), _defaultParameterRules)
{
}
diff --git a/CryptoExchange.Net/SharedApis/V2/Orders/Spot/CancelSpotOrder/ICancelSpotOrder.cs b/CryptoExchange.Net/SharedApis/V2/Orders/Spot/CancelSpotOrder/ICancelSpotOrder.cs
index 101f4d0b..e6a9fd71 100644
--- a/CryptoExchange.Net/SharedApis/V2/Orders/Spot/CancelSpotOrder/ICancelSpotOrder.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Orders/Spot/CancelSpotOrder/ICancelSpotOrder.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Spot cancel order request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
CancelSpotOrderOptions CancelSpotOrderOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/Orders/Spot/CancelSpotOrderByClientOrderId/CancelSpotOrderByClientOrderIdOptions.cs b/CryptoExchange.Net/SharedApis/V2/Orders/Spot/CancelSpotOrderByClientOrderId/CancelSpotOrderByClientOrderIdOptions.cs
index 2f104b52..120332d2 100644
--- a/CryptoExchange.Net/SharedApis/V2/Orders/Spot/CancelSpotOrderByClientOrderId/CancelSpotOrderByClientOrderIdOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Orders/Spot/CancelSpotOrderByClientOrderId/CancelSpotOrderByClientOrderIdOptions.cs
@@ -13,10 +13,17 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Cancel a spot order by its client order id";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Symbol, "The symbol of the order to cancel", new SharedSymbol(TradingMode.Spot, "ETH", "USDT")),
+ RequestParameterRule.Required(x => x.OrderId, "The client order id of the order to cancel", "123")
+ };
+
///
/// ctor
///
- public CancelSpotOrderByClientOrderIdOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ICancelSpotOrderByClientOrderIdRest.CancelSpotOrderByClientOrderIdAsync))
+ public CancelSpotOrderByClientOrderIdOptions(string exchange, bool authenticated)
+ : base(exchange, authenticated, nameof(ICancelSpotOrderByClientOrderIdRest.CancelSpotOrderByClientOrderIdAsync), _defaultParameterRules)
{
}
diff --git a/CryptoExchange.Net/SharedApis/V2/Orders/Spot/CancelSpotOrderByClientOrderId/ICancelSpotOrderByClientOrderId.cs b/CryptoExchange.Net/SharedApis/V2/Orders/Spot/CancelSpotOrderByClientOrderId/ICancelSpotOrderByClientOrderId.cs
index 1137597a..dc472b46 100644
--- a/CryptoExchange.Net/SharedApis/V2/Orders/Spot/CancelSpotOrderByClientOrderId/ICancelSpotOrderByClientOrderId.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Orders/Spot/CancelSpotOrderByClientOrderId/ICancelSpotOrderByClientOrderId.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Spot cancel order by client order id request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
CancelSpotOrderByClientOrderIdOptions CancelSpotOrderByClientOrderIdOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/Orders/Spot/EditSpotOrder/EditSpotOrderOptions.cs b/CryptoExchange.Net/SharedApis/V2/Orders/Spot/EditSpotOrder/EditSpotOrderOptions.cs
index 36f7bfc3..7afe50af 100644
--- a/CryptoExchange.Net/SharedApis/V2/Orders/Spot/EditSpotOrder/EditSpotOrderOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Orders/Spot/EditSpotOrder/EditSpotOrderOptions.cs
@@ -12,11 +12,19 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Edit an existing spot order";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Symbol, "The symbol of the order to edit", new SharedSymbol(TradingMode.Spot, "ETH", "USDT")),
+ RequestParameterRule.Required(x => x.OrderId, "The order id of the order to edit", "123"),
+ RequestParameterRule.Optional(x => x.Quantity, "The new order quantity", SharedQuantity.Base(1)),
+ RequestParameterRule.Optional(x => x.Price, "The new order price", 0.1m),
+ };
///
/// ctor
///
- public EditSpotOrderOptions(string exchange) : base(exchange, true, nameof(IEditSpotOrder.EditSpotOrderAsync))
+ public EditSpotOrderOptions(string exchange)
+ : base(exchange, true, nameof(IEditSpotOrder.EditSpotOrderAsync), _defaultParameterRules)
{
}
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/EditSpotOrderRequest.cs b/CryptoExchange.Net/SharedApis/V2/Orders/Spot/EditSpotOrder/EditSpotOrderRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/EditSpotOrderRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/Orders/Spot/EditSpotOrder/EditSpotOrderRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/V2/Orders/Spot/EditSpotOrder/IEditSpotOrder.cs b/CryptoExchange.Net/SharedApis/V2/Orders/Spot/EditSpotOrder/IEditSpotOrder.cs
index 4f0cd8db..fbd10d06 100644
--- a/CryptoExchange.Net/SharedApis/V2/Orders/Spot/EditSpotOrder/IEditSpotOrder.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Orders/Spot/EditSpotOrder/IEditSpotOrder.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Spot edit order request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
EditSpotOrderOptions EditSpotOrderOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/Orders/Spot/GetClosedSpotOrders/GetSpotClosedOrdersOptions.cs b/CryptoExchange.Net/SharedApis/V2/Orders/Spot/GetClosedSpotOrders/GetSpotClosedOrdersOptions.cs
index 54128c92..6f27cef1 100644
--- a/CryptoExchange.Net/SharedApis/V2/Orders/Spot/GetClosedSpotOrders/GetSpotClosedOrdersOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Orders/Spot/GetClosedSpotOrders/GetSpotClosedOrdersOptions.cs
@@ -12,11 +12,20 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Retrieve closed spot orders";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Symbol, "The symbol to retrieve closed spot orders for", new SharedSymbol(TradingMode.Spot, "ETH", "USDT")),
+ RequestParameterRule.Optional(x => x.StartTime, "Filter the result set by start time", DateTime.UtcNow.AddDays(-1)),
+ RequestParameterRule.Optional(x => x.EndTime, "Filter the result set by end time", DateTime.UtcNow.AddHours(-1)),
+ RequestParameterRule.Optional(x => x.Limit, "Limit the result set to a maximum number of items", 100),
+ RequestParameterRule.Optional(x => x.Direction, "The direction in which to retrieve the results", DataDirection.Descending),
+ };
+
///
/// ctor
///
public GetSpotClosedOrdersOptions(string exchange, bool supportsAscending, bool supportsDescending, bool timeFilterSupported, int maxLimit)
- : base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, true, nameof(IGetClosedSpotOrdersRest.GetClosedSpotOrdersAsync))
+ : base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, true, nameof(IGetClosedSpotOrdersRest.GetClosedSpotOrdersAsync), _defaultParameterRules)
{
}
diff --git a/CryptoExchange.Net/SharedApis/V2/Orders/Spot/GetClosedSpotOrders/IGetClosedSpotOrders.cs b/CryptoExchange.Net/SharedApis/V2/Orders/Spot/GetClosedSpotOrders/IGetClosedSpotOrders.cs
index 3b824095..2bdb6149 100644
--- a/CryptoExchange.Net/SharedApis/V2/Orders/Spot/GetClosedSpotOrders/IGetClosedSpotOrders.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Orders/Spot/GetClosedSpotOrders/IGetClosedSpotOrders.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Spot get closed orders request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
GetSpotClosedOrdersOptions GetClosedSpotOrdersOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/Orders/Spot/GetOpenSpotOrders/GetOpenSpotOrdersOptions.cs b/CryptoExchange.Net/SharedApis/V2/Orders/Spot/GetOpenSpotOrders/GetOpenSpotOrdersOptions.cs
index 4855d6fd..c3ee8ee9 100644
--- a/CryptoExchange.Net/SharedApis/V2/Orders/Spot/GetOpenSpotOrders/GetOpenSpotOrdersOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Orders/Spot/GetOpenSpotOrders/GetOpenSpotOrdersOptions.cs
@@ -11,11 +11,17 @@ namespace CryptoExchange.Net.SharedApis
{
///
public override string Description => "Retrieve open spot orders";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Optional(x => x.TradingMode, "Filter the open orders by trading mode", TradingMode.Spot),
+ RequestParameterRule.Optional(x => x.Symbol, "The symbol to retrieve open spot orders for", new SharedSymbol(TradingMode.Spot, "ETH", "USDT")),
+ };
///
/// ctor
///
- public GetOpenSpotOrdersOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetOpenSpotOrdersRest.GetOpenSpotOrdersAsync))
+ public GetOpenSpotOrdersOptions(string exchange, bool authenticated)
+ : base(exchange, authenticated, nameof(IGetOpenSpotOrdersRest.GetOpenSpotOrdersAsync), _defaultParameterRules)
{
}
}
diff --git a/CryptoExchange.Net/SharedApis/V2/Orders/Spot/GetOpenSpotOrders/IGetOpenSpotOrders.cs b/CryptoExchange.Net/SharedApis/V2/Orders/Spot/GetOpenSpotOrders/IGetOpenSpotOrders.cs
index 327b4374..75db4e59 100644
--- a/CryptoExchange.Net/SharedApis/V2/Orders/Spot/GetOpenSpotOrders/IGetOpenSpotOrders.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Orders/Spot/GetOpenSpotOrders/IGetOpenSpotOrders.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Spot get open orders request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
GetOpenSpotOrdersOptions GetOpenSpotOrdersOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/Orders/Spot/GetSpotOrder/GetSpotOrderOptions.cs b/CryptoExchange.Net/SharedApis/V2/Orders/Spot/GetSpotOrder/GetSpotOrderOptions.cs
index df2d1993..9a2f8ee2 100644
--- a/CryptoExchange.Net/SharedApis/V2/Orders/Spot/GetSpotOrder/GetSpotOrderOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Orders/Spot/GetSpotOrder/GetSpotOrderOptions.cs
@@ -13,10 +13,17 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Retrieve a spot order";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Symbol, "The symbol of the order to retrieve", new SharedSymbol(TradingMode.Spot, "ETH", "USDT")),
+ RequestParameterRule.Required(x => x.OrderId, "The order id of the order to retrieve", "123")
+ };
+
///
/// ctor
///
- public GetSpotOrderOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetSpotOrderRest.GetSpotOrderAsync))
+ public GetSpotOrderOptions(string exchange, bool authenticated)
+ : base(exchange, authenticated, nameof(IGetSpotOrderRest.GetSpotOrderAsync), _defaultParameterRules)
{
}
diff --git a/CryptoExchange.Net/SharedApis/V2/Orders/Spot/GetSpotOrder/IGetSpotOrder.cs b/CryptoExchange.Net/SharedApis/V2/Orders/Spot/GetSpotOrder/IGetSpotOrder.cs
index de63c849..2a0a4f13 100644
--- a/CryptoExchange.Net/SharedApis/V2/Orders/Spot/GetSpotOrder/IGetSpotOrder.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Orders/Spot/GetSpotOrder/IGetSpotOrder.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Spot get order request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
GetSpotOrderOptions GetSpotOrderOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/Orders/Spot/GetSpotOrderByClientOrderId/GetSpotOrderByClientOrderIdOptions.cs b/CryptoExchange.Net/SharedApis/V2/Orders/Spot/GetSpotOrderByClientOrderId/GetSpotOrderByClientOrderIdOptions.cs
index d306fa7c..2fb0ab95 100644
--- a/CryptoExchange.Net/SharedApis/V2/Orders/Spot/GetSpotOrderByClientOrderId/GetSpotOrderByClientOrderIdOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Orders/Spot/GetSpotOrderByClientOrderId/GetSpotOrderByClientOrderIdOptions.cs
@@ -13,10 +13,17 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Retrieve a spot order by its client order id";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Symbol, "The symbol of the order to retrieve", new SharedSymbol(TradingMode.Spot, "ETH", "USDT")),
+ RequestParameterRule.Required(x => x.OrderId, "The client order id of the order to retrieve", "123")
+ };
+
///
/// ctor
///
- public GetSpotOrderByClientOrderIdOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetSpotOrderByClientOrderIdRest.GetSpotOrderByClientOrderIdAsync))
+ public GetSpotOrderByClientOrderIdOptions(string exchange, bool authenticated)
+ : base(exchange, authenticated, nameof(IGetSpotOrderByClientOrderIdRest.GetSpotOrderByClientOrderIdAsync), _defaultParameterRules)
{
}
diff --git a/CryptoExchange.Net/SharedApis/V2/Orders/Spot/GetSpotOrderByClientOrderId/IGetSpotOrderByClientOrderId.cs b/CryptoExchange.Net/SharedApis/V2/Orders/Spot/GetSpotOrderByClientOrderId/IGetSpotOrderByClientOrderId.cs
index c266b71f..e01273fe 100644
--- a/CryptoExchange.Net/SharedApis/V2/Orders/Spot/GetSpotOrderByClientOrderId/IGetSpotOrderByClientOrderId.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Orders/Spot/GetSpotOrderByClientOrderId/IGetSpotOrderByClientOrderId.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Spot get order by client order id request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
GetSpotOrderByClientOrderIdOptions GetSpotOrderByClientOrderIdOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/Orders/Spot/PlaceSpotOrder/IPlaceSpotOrder.cs b/CryptoExchange.Net/SharedApis/V2/Orders/Spot/PlaceSpotOrder/IPlaceSpotOrder.cs
index 073a6186..06d75a63 100644
--- a/CryptoExchange.Net/SharedApis/V2/Orders/Spot/PlaceSpotOrder/IPlaceSpotOrder.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Orders/Spot/PlaceSpotOrder/IPlaceSpotOrder.cs
@@ -41,7 +41,7 @@ namespace CryptoExchange.Net.SharedApis
///
/// Spot place order request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
PlaceSpotOrderOptions PlaceSpotOrderOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/Orders/Spot/PlaceSpotOrder/PlaceSpotOrderOptions.cs b/CryptoExchange.Net/SharedApis/V2/Orders/Spot/PlaceSpotOrder/PlaceSpotOrderOptions.cs
index 6aa9b518..3201c16c 100644
--- a/CryptoExchange.Net/SharedApis/V2/Orders/Spot/PlaceSpotOrder/PlaceSpotOrderOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Orders/Spot/PlaceSpotOrder/PlaceSpotOrderOptions.cs
@@ -1,5 +1,6 @@
using CryptoExchange.Net.Objects;
using System;
+using System.Collections;
using System.Linq;
namespace CryptoExchange.Net.SharedApis
@@ -12,11 +13,23 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Place a new spot order";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Symbol, "Symbol", new SharedSymbol(TradingMode.Spot, "ETH", "USDT")),
+ RequestParameterRule.Required(x => x.OrderType, "Order type", SharedOrderType.Limit),
+ RequestParameterRule.Required(x => x.Side, "Order side", SharedOrderSide.Buy),
+ RequestParameterRule.Optional(x => x.TimeInForce, "Time in force", SharedTimeInForce.GoodTillCanceled),
+ RequestParameterRule.Optional(x => x.Quantity, "Order quantity", SharedQuantity.Base(0.1m)),
+ RequestParameterRule.Optional(x => x.Price, "Order price", 1m),
+ RequestParameterRule.Optional(x => x.ClientOrderId, "Client order id", "123")
+ };
+
///
/// ctor
///
- public PlaceSpotOrderOptions(string exchange) : base(exchange, true, nameof(IPlaceSpotOrder.PlaceSpotOrderAsync))
+ public PlaceSpotOrderOptions(string exchange)
+ : base(exchange, true, nameof(IPlaceSpotOrder.PlaceSpotOrderAsync), _defaultParameterRules)
{
}
@@ -27,6 +40,10 @@ namespace CryptoExchange.Net.SharedApis
PlaceSpotOrderRequest request,
IPlaceSpotOrder client)
{
+ var error = base.ValidateRequest(request, client);
+ if (error != null)
+ return error;
+
if (request.Symbol!.TradingMode != TradingMode.Spot)
return ArgumentError.Invalid("TradingMode", $"TradingMode.{request.Symbol!.TradingMode} is not supported, should be Spot");
@@ -43,7 +60,7 @@ namespace CryptoExchange.Net.SharedApis
if (quantityError != null)
return quantityError;
- return base.ValidateRequest(request, client);
+ return null;
}
}
}
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/PlaceSpotOrderRequest.cs b/CryptoExchange.Net/SharedApis/V2/Orders/Spot/PlaceSpotOrder/PlaceSpotOrderRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/PlaceSpotOrderRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/Orders/Spot/PlaceSpotOrder/PlaceSpotOrderRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/V2/Orders/Spot/SubscribeSpotOrder/SubscribeSpotOrderOptions.cs b/CryptoExchange.Net/SharedApis/V2/Orders/Spot/SubscribeSpotOrder/SubscribeSpotOrderOptions.cs
index b81d7aef..72a3009f 100644
--- a/CryptoExchange.Net/SharedApis/V2/Orders/Spot/SubscribeSpotOrder/SubscribeSpotOrderOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Orders/Spot/SubscribeSpotOrder/SubscribeSpotOrderOptions.cs
@@ -12,10 +12,13 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Subscribe to spot order updates";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = [];
+
///
/// ctor
///
- public SubscribeSpotOrderOptions(string exchange, bool needsAuthentication) : base(exchange, needsAuthentication, nameof(ISubscribeSpotOrdersSocket.SubscribeToSpotOrderUpdatesAsync))
+ public SubscribeSpotOrderOptions(string exchange, bool needsAuthentication)
+ : base(exchange, needsAuthentication, nameof(ISubscribeSpotOrdersSocket.SubscribeToSpotOrderUpdatesAsync), _defaultParameterRules)
{
}
}
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/SubscribeSpotOrderRequest.cs b/CryptoExchange.Net/SharedApis/V2/Orders/Spot/SubscribeSpotOrder/SubscribeSpotOrderRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/SubscribeSpotOrderRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/Orders/Spot/SubscribeSpotOrder/SubscribeSpotOrderRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/V2/PositionMode/GetPositionMode/GetPositionModeOptions.cs b/CryptoExchange.Net/SharedApis/V2/PositionMode/GetPositionMode/GetPositionModeOptions.cs
index 552b96a7..8335d327 100644
--- a/CryptoExchange.Net/SharedApis/V2/PositionMode/GetPositionMode/GetPositionModeOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/PositionMode/GetPositionMode/GetPositionModeOptions.cs
@@ -8,10 +8,16 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Retrieve the current futures position mode";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Optional(x => x.TradingMode, "The trading mode to retrieve the position mode for", TradingMode.PerpetualLinear),
+ RequestParameterRule.Optional(x => x.Symbol, "The symbol to retrieve the position mode for", new SharedSymbol(TradingMode.PerpetualLinear, "ETH", "USDT")),
+ };
+
///
/// ctor
///
- public GetPositionModeOptions(string exchange) : base(exchange, true, nameof(IGetPositionModeRest.GetPositionModeAsync))
+ public GetPositionModeOptions(string exchange) : base(exchange, true, nameof(IGetPositionModeRest.GetPositionModeAsync), _defaultParameterRules)
{
}
}
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/GetPositionModeRequest.cs b/CryptoExchange.Net/SharedApis/V2/PositionMode/GetPositionMode/GetPositionModeRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/GetPositionModeRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/PositionMode/GetPositionMode/GetPositionModeRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/V2/PositionMode/GetPositionMode/IGetPositionMode.cs b/CryptoExchange.Net/SharedApis/V2/PositionMode/GetPositionMode/IGetPositionMode.cs
index 4cb2569e..acc1fe39 100644
--- a/CryptoExchange.Net/SharedApis/V2/PositionMode/GetPositionMode/IGetPositionMode.cs
+++ b/CryptoExchange.Net/SharedApis/V2/PositionMode/GetPositionMode/IGetPositionMode.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Position mode request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
GetPositionModeOptions GetPositionModeOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/PositionMode/SetPositionMode/ISetPositionMode.cs b/CryptoExchange.Net/SharedApis/V2/PositionMode/SetPositionMode/ISetPositionMode.cs
index 342deabb..272ad24e 100644
--- a/CryptoExchange.Net/SharedApis/V2/PositionMode/SetPositionMode/ISetPositionMode.cs
+++ b/CryptoExchange.Net/SharedApis/V2/PositionMode/SetPositionMode/ISetPositionMode.cs
@@ -19,7 +19,7 @@ namespace CryptoExchange.Net.SharedApis
///
/// Position mode set request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
SetPositionModeOptions SetPositionModeOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/PositionMode/SetPositionMode/SetPositionModeOptions.cs b/CryptoExchange.Net/SharedApis/V2/PositionMode/SetPositionMode/SetPositionModeOptions.cs
index 9cd8edbb..66941196 100644
--- a/CryptoExchange.Net/SharedApis/V2/PositionMode/SetPositionMode/SetPositionModeOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/PositionMode/SetPositionMode/SetPositionModeOptions.cs
@@ -8,10 +8,17 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Set the futures position mode";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Optional(x => x.TradingMode, "The trading mode to set the position mode for", TradingMode.PerpetualLinear),
+ RequestParameterRule.Optional(x => x.Symbol, "The symbol to set the position mode for", new SharedSymbol(TradingMode.PerpetualLinear, "ETH", "USDT")),
+ RequestParameterRule.Required(x => x.PositionMode, "The position mode to set", SharedPositionMode.OneWay),
+ };
+
///
/// ctor
///
- public SetPositionModeOptions(string exchange) : base(exchange, true, nameof(ISetPositionModeRest.SetPositionModeOptions))
+ public SetPositionModeOptions(string exchange) : base(exchange, true, nameof(ISetPositionModeRest.SetPositionModeOptions), _defaultParameterRules)
{
}
}
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/SetPositionModeRequest.cs b/CryptoExchange.Net/SharedApis/V2/PositionMode/SetPositionMode/SetPositionModeRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/SetPositionModeRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/PositionMode/SetPositionMode/SetPositionModeRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/V2/Positions/ClosePosition/ClosePositionOptions.cs b/CryptoExchange.Net/SharedApis/V2/Positions/ClosePosition/ClosePositionOptions.cs
index e3221410..1fca44cf 100644
--- a/CryptoExchange.Net/SharedApis/V2/Positions/ClosePosition/ClosePositionOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Positions/ClosePosition/ClosePositionOptions.cs
@@ -12,10 +12,19 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Close an open futures position";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Symbol, "The symbol of the position to close", new SharedSymbol(TradingMode.PerpetualLinear, "ETH", "USDT")),
+ RequestParameterRule.Required(x => x.PositionMode, "The current position mode of the account", SharedPositionMode.OneWay),
+ RequestParameterRule.Optional(x => x.PositionSide, "The side of the position to close", SharedPositionSide.Long),
+ RequestParameterRule.Optional(x => x.MarginMode, "The margin mode of the position", SharedMarginMode.Cross),
+ RequestParameterRule.Optional(x => x.Quantity, "The quantity of the position to close", 1m),
+ };
+
///
/// ctor
///
- public ClosePositionOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IClosePositionRest.ClosePositionAsync))
+ public ClosePositionOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IClosePositionRest.ClosePositionAsync), _defaultParameterRules)
{
}
}
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/ClosePositionRequest.cs b/CryptoExchange.Net/SharedApis/V2/Positions/ClosePosition/ClosePositionRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/ClosePositionRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/Positions/ClosePosition/ClosePositionRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/V2/Positions/ClosePosition/IClosePosition.cs b/CryptoExchange.Net/SharedApis/V2/Positions/ClosePosition/IClosePosition.cs
index 4651ab3b..32fcf35e 100644
--- a/CryptoExchange.Net/SharedApis/V2/Positions/ClosePosition/IClosePosition.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Positions/ClosePosition/IClosePosition.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Close position order request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
ClosePositionOptions ClosePositionOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/Positions/GetPositionHistory/GetPositionHistoryOptions.cs b/CryptoExchange.Net/SharedApis/V2/Positions/GetPositionHistory/GetPositionHistoryOptions.cs
index cfa220e0..b70c6dc0 100644
--- a/CryptoExchange.Net/SharedApis/V2/Positions/GetPositionHistory/GetPositionHistoryOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Positions/GetPositionHistory/GetPositionHistoryOptions.cs
@@ -12,11 +12,21 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Retrieve historical futures positions";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Optional(x => x.TradingMode, "Filter the result set by trading mode", TradingMode.PerpetualLinear),
+ RequestParameterRule.Optional(x => x.Symbol, "Filter the result set by symbol", new SharedSymbol(TradingMode.PerpetualLinear, "ETH", "USDT")),
+ RequestParameterRule.Optional(x => x.StartTime, "Filter the result set by start time", DateTime.UtcNow.AddDays(-1)),
+ RequestParameterRule.Optional(x => x.EndTime, "Filter the result set by end time", DateTime.UtcNow.AddHours(-1)),
+ RequestParameterRule.Optional(x => x.Limit, "Limit the result set to a maximum number of items", 100),
+ RequestParameterRule.Optional(x => x.Direction, "The direction in which to retrieve the results", DataDirection.Descending),
+ };
+
///
/// ctor
///
public GetPositionHistoryOptions(string exchange, bool supportsAscending, bool supportsDescending, bool timeFilterSupported, int maxLimit)
- : base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, true, nameof(IGetPositionHistoryRest.GetPositionHistoryAsync))
+ : base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, true, nameof(IGetPositionHistoryRest.GetPositionHistoryAsync), _defaultParameterRules)
{
}
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/GetPositionHistoryRequest.cs b/CryptoExchange.Net/SharedApis/V2/Positions/GetPositionHistory/GetPositionHistoryRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/GetPositionHistoryRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/Positions/GetPositionHistory/GetPositionHistoryRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/V2/Positions/GetPositionHistory/IGetPositionHistory.cs b/CryptoExchange.Net/SharedApis/V2/Positions/GetPositionHistory/IGetPositionHistory.cs
index 8b215eda..0327af2d 100644
--- a/CryptoExchange.Net/SharedApis/V2/Positions/GetPositionHistory/IGetPositionHistory.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Positions/GetPositionHistory/IGetPositionHistory.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Position history request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
GetPositionHistoryOptions GetPositionHistoryOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/Positions/GetPositions/GetPositionsOptions.cs b/CryptoExchange.Net/SharedApis/V2/Positions/GetPositions/GetPositionsOptions.cs
index 49d63baa..3e5dbc44 100644
--- a/CryptoExchange.Net/SharedApis/V2/Positions/GetPositions/GetPositionsOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Positions/GetPositions/GetPositionsOptions.cs
@@ -12,10 +12,16 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Retrieve open futures positions";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Optional(x => x.TradingMode, "Filter the result set by trading mode", TradingMode.PerpetualLinear),
+ RequestParameterRule.Optional(x => x.Symbol, "Filter the result set by symbol", new SharedSymbol(TradingMode.PerpetualLinear, "ETH", "USDT")),
+ };
+
///
/// ctor
///
- public GetPositionsOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetPositionsRest.GetPositionsAsync))
+ public GetPositionsOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetPositionsRest.GetPositionsAsync), _defaultParameterRules)
{
}
}
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/GetPositionsRequest.cs b/CryptoExchange.Net/SharedApis/V2/Positions/GetPositions/GetPositionsRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/GetPositionsRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/Positions/GetPositions/GetPositionsRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/V2/Positions/GetPositions/IGetPositions.cs b/CryptoExchange.Net/SharedApis/V2/Positions/GetPositions/IGetPositions.cs
index e19fc1d1..77c1e12b 100644
--- a/CryptoExchange.Net/SharedApis/V2/Positions/GetPositions/IGetPositions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Positions/GetPositions/IGetPositions.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Positions request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
GetPositionsOptions GetPositionsOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/Positions/SubscribePositions/SubscribePositionOptions.cs b/CryptoExchange.Net/SharedApis/V2/Positions/SubscribePositions/SubscribePositionOptions.cs
index 55bd75a0..fe66a255 100644
--- a/CryptoExchange.Net/SharedApis/V2/Positions/SubscribePositions/SubscribePositionOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Positions/SubscribePositions/SubscribePositionOptions.cs
@@ -12,10 +12,15 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Subscribe to futures position updates";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Optional(x => x.TradingMode, "Filter position updates by trading mode", TradingMode.PerpetualLinear),
+ };
+
///
/// ctor
///
- public SubscribePositionOptions(string exchange, bool needsAuthentication) : base(exchange, needsAuthentication, nameof(ISubscribePositionsSocket.SubscribeToPositionUpdatesAsync))
+ public SubscribePositionOptions(string exchange, bool needsAuthentication) : base(exchange, needsAuthentication, nameof(ISubscribePositionsSocket.SubscribeToPositionUpdatesAsync), _defaultParameterRules)
{
}
}
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/SubscribePositionRequest.cs b/CryptoExchange.Net/SharedApis/V2/Positions/SubscribePositions/SubscribePositionRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/SubscribePositionRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/Positions/SubscribePositions/SubscribePositionRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/Models/SharedRequest.cs b/CryptoExchange.Net/SharedApis/V2/SharedRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/SharedRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/SharedRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/Models/SharedSymbolRequest.cs b/CryptoExchange.Net/SharedApis/V2/SharedSymbolRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/SharedSymbolRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/SharedSymbolRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/V2/Symbols/GetFuturesSymbols/GetFuturesSymbolsOptions.cs b/CryptoExchange.Net/SharedApis/V2/Symbols/GetFuturesSymbols/GetFuturesSymbolsOptions.cs
index 8fd2d12f..9e1684c5 100644
--- a/CryptoExchange.Net/SharedApis/V2/Symbols/GetFuturesSymbols/GetFuturesSymbolsOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Symbols/GetFuturesSymbols/GetFuturesSymbolsOptions.cs
@@ -13,10 +13,19 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Retrieve supported futures symbols and their trading rules";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Optional(x => x.TradingMode, "Filter the symbols by trading mode", TradingMode.PerpetualLinear),
+ RequestParameterRule.Optional(x => x.BaseAssetType, "Filter by base asset type", SharedAssetType.Crypto),
+ RequestParameterRule.Optional(x => x.BaseAssetSubType, "Filter by base asset subtype", SharedAssetSubType.StableCoin),
+ RequestParameterRule.Optional(x => x.QuoteAssetType, "Filter by quote asset type", SharedAssetType.Crypto),
+ RequestParameterRule.Optional(x => x.QuoteAssetSubType, "Filter by quote asset subtype", SharedAssetSubType.StableCoin),
+ };
+
///
/// ctor
///
- public GetFuturesSymbolsOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetFuturesSymbolsRest.GetFuturesSymbolsAsync))
+ public GetFuturesSymbolsOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetFuturesSymbolsRest.GetFuturesSymbolsAsync), _defaultParameterRules)
{
}
diff --git a/CryptoExchange.Net/SharedApis/V2/Symbols/GetFuturesSymbols/IGetFuturesSymbols.cs b/CryptoExchange.Net/SharedApis/V2/Symbols/GetFuturesSymbols/IGetFuturesSymbols.cs
index 7a59e6d6..4ff2acb5 100644
--- a/CryptoExchange.Net/SharedApis/V2/Symbols/GetFuturesSymbols/IGetFuturesSymbols.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Symbols/GetFuturesSymbols/IGetFuturesSymbols.cs
@@ -19,7 +19,7 @@ namespace CryptoExchange.Net.SharedApis
///
/// Futures symbol request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
GetFuturesSymbolsOptions GetFuturesSymbolsOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/Symbols/GetSpotSymbols/GetSpotSymbolsOptions.cs b/CryptoExchange.Net/SharedApis/V2/Symbols/GetSpotSymbols/GetSpotSymbolsOptions.cs
index 34dcb4c3..e1e03fdf 100644
--- a/CryptoExchange.Net/SharedApis/V2/Symbols/GetSpotSymbols/GetSpotSymbolsOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Symbols/GetSpotSymbols/GetSpotSymbolsOptions.cs
@@ -13,10 +13,19 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Retrieve supported spot symbols and their trading rules";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Optional(x => x.TradingMode, "Filter the symbols by trading mode", TradingMode.Spot),
+ RequestParameterRule.Optional(x => x.BaseAssetType, "Filter by base asset type", SharedAssetType.Crypto),
+ RequestParameterRule.Optional(x => x.BaseAssetSubType, "Filter by base asset subtype", SharedAssetSubType.StableCoin),
+ RequestParameterRule.Optional(x => x.QuoteAssetType, "Filter by quote asset type", SharedAssetType.Crypto),
+ RequestParameterRule.Optional(x => x.QuoteAssetSubType, "Filter by quote asset subtype", SharedAssetSubType.StableCoin),
+ };
+
///
/// ctor
///
- public GetSpotSymbolsOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetSpotSymbolsRest.GetSpotSymbolsAsync))
+ public GetSpotSymbolsOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetSpotSymbolsRest.GetSpotSymbolsAsync), _defaultParameterRules)
{
}
diff --git a/CryptoExchange.Net/SharedApis/V2/Symbols/GetSpotSymbols/IGetSpotSymbols.cs b/CryptoExchange.Net/SharedApis/V2/Symbols/GetSpotSymbols/IGetSpotSymbols.cs
index fa946e9f..6fa70296 100644
--- a/CryptoExchange.Net/SharedApis/V2/Symbols/GetSpotSymbols/IGetSpotSymbols.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Symbols/GetSpotSymbols/IGetSpotSymbols.cs
@@ -37,7 +37,7 @@ namespace CryptoExchange.Net.SharedApis
///
/// Spot symbols request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
GetSpotSymbolsOptions GetSpotSymbolsOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/GetSymbolsRequest.cs b/CryptoExchange.Net/SharedApis/V2/Symbols/GetSymbolsRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/GetSymbolsRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/Symbols/GetSymbolsRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/V2/Tickers/Futures/GetAllFuturesTicker/GetAllFuturesTickersOptions.cs b/CryptoExchange.Net/SharedApis/V2/Tickers/Futures/GetAllFuturesTicker/GetAllFuturesTickersOptions.cs
index 214317a7..af2fede2 100644
--- a/CryptoExchange.Net/SharedApis/V2/Tickers/Futures/GetAllFuturesTicker/GetAllFuturesTickersOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Tickers/Futures/GetAllFuturesTicker/GetAllFuturesTickersOptions.cs
@@ -10,6 +10,11 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Retrieve price ticker information for all futures symbols";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Optional(x => x.TradingMode, "Filter the tickers by trading mode", TradingMode.PerpetualLinear),
+ };
+
///
/// Type of ticker calculation
///
@@ -18,7 +23,7 @@ namespace CryptoExchange.Net.SharedApis
///
/// ctor
///
- public GetAllFuturesTickersOptions(string exchange, SharedTickerType? tickerCalcType = null) : base(exchange, false, nameof(IGetAllFuturesTickersRest.GetAllFuturesTickersAsync))
+ public GetAllFuturesTickersOptions(string exchange, SharedTickerType? tickerCalcType = null) : base(exchange, false, nameof(IGetAllFuturesTickersRest.GetAllFuturesTickersAsync), _defaultParameterRules)
{
TickerType = tickerCalcType ?? SharedTickerType.Day24H;
}
diff --git a/CryptoExchange.Net/SharedApis/V2/Tickers/Futures/GetAllFuturesTicker/IGetAllFuturesTickers.cs b/CryptoExchange.Net/SharedApis/V2/Tickers/Futures/GetAllFuturesTicker/IGetAllFuturesTickers.cs
index 5ec05819..45f53dd4 100644
--- a/CryptoExchange.Net/SharedApis/V2/Tickers/Futures/GetAllFuturesTicker/IGetAllFuturesTickers.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Tickers/Futures/GetAllFuturesTicker/IGetAllFuturesTickers.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Futures get tickers request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
GetAllFuturesTickersOptions GetAllFuturesTickersOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/Tickers/Futures/GetFuturesTicker/GetFuturesTickerOptions.cs b/CryptoExchange.Net/SharedApis/V2/Tickers/Futures/GetFuturesTicker/GetFuturesTickerOptions.cs
index 2a25f533..ecfd749c 100644
--- a/CryptoExchange.Net/SharedApis/V2/Tickers/Futures/GetFuturesTicker/GetFuturesTickerOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Tickers/Futures/GetFuturesTicker/GetFuturesTickerOptions.cs
@@ -10,6 +10,11 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Retrieve price ticker information for a futures symbol";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Symbol, "The symbol to retrieve ticker information for", new SharedSymbol(TradingMode.PerpetualLinear, "ETH", "USDT")),
+ };
+
///
/// Type of ticker calculation
///
@@ -18,7 +23,7 @@ namespace CryptoExchange.Net.SharedApis
///
/// ctor
///
- public GetFuturesTickerOptions(string exchange, SharedTickerType? tickerCalcType = null) : base(exchange, false, nameof(IGetFuturesTickerRest.GetFuturesTickerAsync))
+ public GetFuturesTickerOptions(string exchange, SharedTickerType? tickerCalcType = null) : base(exchange, false, nameof(IGetFuturesTickerRest.GetFuturesTickerAsync), _defaultParameterRules)
{
TickerType = tickerCalcType ?? SharedTickerType.Day24H;
}
diff --git a/CryptoExchange.Net/SharedApis/V2/Tickers/Futures/GetFuturesTicker/IGetFuturesTicker.cs b/CryptoExchange.Net/SharedApis/V2/Tickers/Futures/GetFuturesTicker/IGetFuturesTicker.cs
index 56c09813..f25de2ef 100644
--- a/CryptoExchange.Net/SharedApis/V2/Tickers/Futures/GetFuturesTicker/IGetFuturesTicker.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Tickers/Futures/GetFuturesTicker/IGetFuturesTicker.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Futures get ticker request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
GetFuturesTickerOptions GetFuturesTickerOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/GetTickerRequest.cs b/CryptoExchange.Net/SharedApis/V2/Tickers/GetTickerRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/GetTickerRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/Tickers/GetTickerRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/GetTickersRequest.cs b/CryptoExchange.Net/SharedApis/V2/Tickers/GetTickersRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/GetTickersRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/Tickers/GetTickersRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/V2/Tickers/Spot/GetAllSpotTickers/GetAllSpotTickersOptions.cs b/CryptoExchange.Net/SharedApis/V2/Tickers/Spot/GetAllSpotTickers/GetAllSpotTickersOptions.cs
index de26be50..77446379 100644
--- a/CryptoExchange.Net/SharedApis/V2/Tickers/Spot/GetAllSpotTickers/GetAllSpotTickersOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Tickers/Spot/GetAllSpotTickers/GetAllSpotTickersOptions.cs
@@ -10,6 +10,11 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Retrieve price ticker information for all spot symbols";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Optional(x => x.TradingMode, "Filter the tickers by trading mode", TradingMode.Spot),
+ };
+
///
/// Type of ticker calculation
///
@@ -18,7 +23,7 @@ namespace CryptoExchange.Net.SharedApis
///
/// ctor
///
- public GetAllSpotTickersOptions(string exchange, SharedTickerType? tickerCalcType = null) : base(exchange, false, nameof(IGetAllSpotTickersRest.GetAllSpotTickersAsync))
+ public GetAllSpotTickersOptions(string exchange, SharedTickerType? tickerCalcType = null) : base(exchange, false, nameof(IGetAllSpotTickersRest.GetAllSpotTickersAsync), _defaultParameterRules)
{
TickerType = tickerCalcType ?? SharedTickerType.Day24H;
}
diff --git a/CryptoExchange.Net/SharedApis/V2/Tickers/Spot/GetAllSpotTickers/IGetAllSpotTickers.cs b/CryptoExchange.Net/SharedApis/V2/Tickers/Spot/GetAllSpotTickers/IGetAllSpotTickers.cs
index c8042d5b..03bb6e56 100644
--- a/CryptoExchange.Net/SharedApis/V2/Tickers/Spot/GetAllSpotTickers/IGetAllSpotTickers.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Tickers/Spot/GetAllSpotTickers/IGetAllSpotTickers.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Spot tickers request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
GetAllSpotTickersOptions GetAllSpotTickersOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/Tickers/Spot/GetSpotTicker/GetSpotTickerOptions.cs b/CryptoExchange.Net/SharedApis/V2/Tickers/Spot/GetSpotTicker/GetSpotTickerOptions.cs
index f0a751e5..86734676 100644
--- a/CryptoExchange.Net/SharedApis/V2/Tickers/Spot/GetSpotTicker/GetSpotTickerOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Tickers/Spot/GetSpotTicker/GetSpotTickerOptions.cs
@@ -10,6 +10,11 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Retrieve price ticker information for a spot symbol";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Symbol, "The symbol to retrieve ticker information for", new SharedSymbol(TradingMode.Spot, "ETH", "USDT")),
+ };
+
///
/// Type of ticker calculation
///
@@ -18,7 +23,7 @@ namespace CryptoExchange.Net.SharedApis
///
/// ctor
///
- public GetSpotTickerOptions(string exchange, SharedTickerType? tickerCalcType = null) : base(exchange, false, nameof(IGetSpotTickerRest.GetSpotTickerAsync))
+ public GetSpotTickerOptions(string exchange, SharedTickerType? tickerCalcType = null) : base(exchange, false, nameof(IGetSpotTickerRest.GetSpotTickerAsync), _defaultParameterRules)
{
TickerType = tickerCalcType ?? SharedTickerType.Day24H;
}
diff --git a/CryptoExchange.Net/SharedApis/V2/Tickers/Spot/GetSpotTicker/IGetSpotTicker.cs b/CryptoExchange.Net/SharedApis/V2/Tickers/Spot/GetSpotTicker/IGetSpotTicker.cs
index 3757c2e7..60027aa8 100644
--- a/CryptoExchange.Net/SharedApis/V2/Tickers/Spot/GetSpotTicker/IGetSpotTicker.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Tickers/Spot/GetSpotTicker/IGetSpotTicker.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Spot ticker request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
GetSpotTickerOptions GetSpotTickerOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/SubscribeAllTickersRequest.cs b/CryptoExchange.Net/SharedApis/V2/Tickers/SubscribeAllTickers/SubscribeAllTickersRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/SubscribeAllTickersRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/Tickers/SubscribeAllTickers/SubscribeAllTickersRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/V2/Tickers/SubscribeAllTickers/SubscribeTickersOptions.cs b/CryptoExchange.Net/SharedApis/V2/Tickers/SubscribeAllTickers/SubscribeTickersOptions.cs
index 9973c039..6fd661b1 100644
--- a/CryptoExchange.Net/SharedApis/V2/Tickers/SubscribeAllTickers/SubscribeTickersOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Tickers/SubscribeAllTickers/SubscribeTickersOptions.cs
@@ -8,6 +8,11 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Subscribe to price ticker updates for all symbols";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Optional(x => x.TradingMode, "Filter ticker updates by trading mode", TradingMode.Spot),
+ };
+
///
/// Type of ticker calculation
///
@@ -16,7 +21,7 @@ namespace CryptoExchange.Net.SharedApis
///
/// ctor
///
- public SubscribeTickersOptions(string exchange, SharedTickerType? tickerCalcType = null) : base(exchange, false, nameof(ISubscribeAllTickersSocket.SubscribeToAllTickersUpdatesAsync))
+ public SubscribeTickersOptions(string exchange, SharedTickerType? tickerCalcType = null) : base(exchange, false, nameof(ISubscribeAllTickersSocket.SubscribeToAllTickersUpdatesAsync), _defaultParameterRules)
{
TickerType = tickerCalcType ?? SharedTickerType.Day24H;
}
diff --git a/CryptoExchange.Net/SharedApis/V2/Tickers/SubscribeBookTicker/SubscribeBookTickerOptions.cs b/CryptoExchange.Net/SharedApis/V2/Tickers/SubscribeBookTicker/SubscribeBookTickerOptions.cs
index 82e11dbe..90f19452 100644
--- a/CryptoExchange.Net/SharedApis/V2/Tickers/SubscribeBookTicker/SubscribeBookTickerOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Tickers/SubscribeBookTicker/SubscribeBookTickerOptions.cs
@@ -12,10 +12,16 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Subscribe to best bid and ask price updates";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Optional(x => x.Symbol, "The symbol to subscribe to", new SharedSymbol(TradingMode.Spot, "ETH", "USDT")),
+ RequestParameterRule.Optional(x => x.Symbols, "The symbols to subscribe to", new[] { new SharedSymbol(TradingMode.Spot, "ETH", "USDT") }),
+ };
+
///
/// ctor
///
- public SubscribeBookTickerOptions(string exchange, bool needsAuthentication) : base(exchange, needsAuthentication, nameof(ISubscribeBookTickerSocket.SubscribeToBookTickerUpdatesAsync))
+ public SubscribeBookTickerOptions(string exchange, bool needsAuthentication) : base(exchange, needsAuthentication, nameof(ISubscribeBookTickerSocket.SubscribeToBookTickerUpdatesAsync), _defaultParameterRules)
{
}
}
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/SubscribeBookTickerRequest.cs b/CryptoExchange.Net/SharedApis/V2/Tickers/SubscribeBookTicker/SubscribeBookTickerRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/SubscribeBookTickerRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/Tickers/SubscribeBookTicker/SubscribeBookTickerRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/V2/Tickers/SubscribeTicker/SubscribeTickerOptions.cs b/CryptoExchange.Net/SharedApis/V2/Tickers/SubscribeTicker/SubscribeTickerOptions.cs
index 92a6232e..06e5a97a 100644
--- a/CryptoExchange.Net/SharedApis/V2/Tickers/SubscribeTicker/SubscribeTickerOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Tickers/SubscribeTicker/SubscribeTickerOptions.cs
@@ -8,6 +8,12 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Subscribe to price ticker updates for a symbol";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Optional(x => x.Symbol, "The symbol to subscribe to", new SharedSymbol(TradingMode.Spot, "ETH", "USDT")),
+ RequestParameterRule.Optional(x => x.Symbols, "The symbols to subscribe to", new[] { new SharedSymbol(TradingMode.Spot, "ETH", "USDT") }),
+ };
+
///
/// Type of ticker calculation
///
@@ -16,7 +22,7 @@ namespace CryptoExchange.Net.SharedApis
///
/// ctor
///
- public SubscribeTickerOptions(string exchange, SharedTickerType? tickerCalcType = null) : base(exchange, false, nameof(ISubscribeTickerSocket.SubscribeToTickerUpdatesAsync))
+ public SubscribeTickerOptions(string exchange, SharedTickerType? tickerCalcType = null) : base(exchange, false, nameof(ISubscribeTickerSocket.SubscribeToTickerUpdatesAsync), _defaultParameterRules)
{
TickerType = tickerCalcType ?? SharedTickerType.Day24H;
}
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/SubscribeTickerRequest.cs b/CryptoExchange.Net/SharedApis/V2/Tickers/SubscribeTicker/SubscribeTickerRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/SubscribeTickerRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/Tickers/SubscribeTicker/SubscribeTickerRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/V2/TpSl/CancelFuturesTpSl/CancelFuturesTpSlOptions.cs b/CryptoExchange.Net/SharedApis/V2/TpSl/CancelFuturesTpSl/CancelFuturesTpSlOptions.cs
index 29385672..a908ef40 100644
--- a/CryptoExchange.Net/SharedApis/V2/TpSl/CancelFuturesTpSl/CancelFuturesTpSlOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/TpSl/CancelFuturesTpSl/CancelFuturesTpSlOptions.cs
@@ -12,10 +12,20 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Cancel a take profit or stop loss order for a futures position";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Symbol, "The symbol of the take profit or stop loss order to cancel", new SharedSymbol(TradingMode.PerpetualLinear, "ETH", "USDT")),
+ RequestParameterRule.Optional(x => x.OrderId, "The id of the take profit or stop loss order to cancel", "123"),
+ RequestParameterRule.Optional(x => x.PositionMode, "The position mode of the account", SharedPositionMode.OneWay),
+ RequestParameterRule.Optional(x => x.PositionSide, "The side of the position", SharedPositionSide.Long),
+ RequestParameterRule.Optional(x => x.TpSlSide, "The take profit or stop loss side to cancel", SharedTpSlSide.TakeProfit),
+ RequestParameterRule.Optional(x => x.MarginMode, "The margin mode of the position", SharedMarginMode.Cross),
+ };
+
///
/// ctor
///
- public CancelFuturesTpSlOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ICancelFuturesTpSlRest.CancelFuturesTpSlAsync))
+ public CancelFuturesTpSlOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ICancelFuturesTpSlRest.CancelFuturesTpSlAsync), _defaultParameterRules)
{
}
}
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/CancelTpSlRequest.cs b/CryptoExchange.Net/SharedApis/V2/TpSl/CancelFuturesTpSl/CancelTpSlRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/CancelTpSlRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/TpSl/CancelFuturesTpSl/CancelTpSlRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/V2/TpSl/CancelFuturesTpSl/ICancelFuturesTpSl.cs b/CryptoExchange.Net/SharedApis/V2/TpSl/CancelFuturesTpSl/ICancelFuturesTpSl.cs
index d8ffde02..dc752ae4 100644
--- a/CryptoExchange.Net/SharedApis/V2/TpSl/CancelFuturesTpSl/ICancelFuturesTpSl.cs
+++ b/CryptoExchange.Net/SharedApis/V2/TpSl/CancelFuturesTpSl/ICancelFuturesTpSl.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Cancel a take profit and/or stop loss options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
CancelFuturesTpSlOptions CancelFuturesTpSlOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/TpSl/SetFuturesTpSl/ISetFuturesTpSl.cs b/CryptoExchange.Net/SharedApis/V2/TpSl/SetFuturesTpSl/ISetFuturesTpSl.cs
index 1f81dbaa..b79065c5 100644
--- a/CryptoExchange.Net/SharedApis/V2/TpSl/SetFuturesTpSl/ISetFuturesTpSl.cs
+++ b/CryptoExchange.Net/SharedApis/V2/TpSl/SetFuturesTpSl/ISetFuturesTpSl.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Set take profit and/or stop loss options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
SetFuturesTpSlOptions SetFuturesTpSlOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/TpSl/SetFuturesTpSl/SetFuturesTpSlOptions.cs b/CryptoExchange.Net/SharedApis/V2/TpSl/SetFuturesTpSl/SetFuturesTpSlOptions.cs
index 07046d4c..81e10d8a 100644
--- a/CryptoExchange.Net/SharedApis/V2/TpSl/SetFuturesTpSl/SetFuturesTpSlOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/TpSl/SetFuturesTpSl/SetFuturesTpSlOptions.cs
@@ -12,10 +12,21 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Set take profit or stop loss values for a futures position";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Symbol, "The symbol to set take profit or stop loss for", new SharedSymbol(TradingMode.PerpetualLinear, "ETH", "USDT")),
+ RequestParameterRule.Optional(x => x.PositionMode, "The position mode of the account", SharedPositionMode.OneWay),
+ RequestParameterRule.Required(x => x.PositionSide, "The side of the position", SharedPositionSide.Long),
+ RequestParameterRule.Optional(x => x.MarginMode, "The margin mode of the position", SharedMarginMode.Cross),
+ RequestParameterRule.Required(x => x.TpSlSide, "Whether to set take profit or stop loss", SharedTpSlSide.TakeProfit),
+ RequestParameterRule.Optional(x => x.Quantity, "The quantity to close", 1m),
+ RequestParameterRule.Required(x => x.TriggerPrice, "The trigger price", 1m),
+ };
+
///
/// ctor
///
- public SetFuturesTpSlOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ISetFuturesTpSlRest.SetFuturesTpSlAsync))
+ public SetFuturesTpSlOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ISetFuturesTpSlRest.SetFuturesTpSlAsync), _defaultParameterRules)
{
}
}
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/SetTpSlRequest.cs b/CryptoExchange.Net/SharedApis/V2/TpSl/SetFuturesTpSl/SetTpSlRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/SetTpSlRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/TpSl/SetFuturesTpSl/SetTpSlRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/V2/Trades/GetRecentTrades/GetRecentTradesOptions.cs b/CryptoExchange.Net/SharedApis/V2/Trades/GetRecentTrades/GetRecentTradesOptions.cs
index a8157019..07011d27 100644
--- a/CryptoExchange.Net/SharedApis/V2/Trades/GetRecentTrades/GetRecentTradesOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Trades/GetRecentTrades/GetRecentTradesOptions.cs
@@ -11,6 +11,12 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Retrieve recent public trades for a symbol";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Symbol, "The symbol to retrieve recent trades for", new SharedSymbol(TradingMode.Spot, "ETH", "USDT")),
+ RequestParameterRule.Optional(x => x.Limit, "Limit the result set to a maximum number of items", 100),
+ };
+
///
/// The max number of trades that can be requested
///
@@ -20,7 +26,7 @@ namespace CryptoExchange.Net.SharedApis
/// ctor
///
public GetRecentTradesOptions(string exchange, int limit, bool authenticated)
- : base(exchange, authenticated, nameof(IGetRecentTradesRest.GetRecentTradesAsync))
+ : base(exchange, authenticated, nameof(IGetRecentTradesRest.GetRecentTradesAsync), _defaultParameterRules)
{
MaxLimit = limit;
}
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/GetRecentTradesRequest.cs b/CryptoExchange.Net/SharedApis/V2/Trades/GetRecentTrades/GetRecentTradesRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/GetRecentTradesRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/Trades/GetRecentTrades/GetRecentTradesRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/V2/Trades/GetRecentTrades/IGetRecentTrades.cs b/CryptoExchange.Net/SharedApis/V2/Trades/GetRecentTrades/IGetRecentTrades.cs
index a97a68a2..2cd21cbb 100644
--- a/CryptoExchange.Net/SharedApis/V2/Trades/GetRecentTrades/IGetRecentTrades.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Trades/GetRecentTrades/IGetRecentTrades.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Recent trades request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
GetRecentTradesOptions GetRecentTradesOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/Trades/GetTradeHistory/GetTradeHistoryOptions.cs b/CryptoExchange.Net/SharedApis/V2/Trades/GetTradeHistory/GetTradeHistoryOptions.cs
index 7325db2b..af54581c 100644
--- a/CryptoExchange.Net/SharedApis/V2/Trades/GetTradeHistory/GetTradeHistoryOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Trades/GetTradeHistory/GetTradeHistoryOptions.cs
@@ -12,11 +12,20 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Retrieve public trade history for a symbol";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Symbol, "The symbol to retrieve trade history for", new SharedSymbol(TradingMode.Spot, "ETH", "USDT")),
+ RequestParameterRule.Required(x => x.StartTime, "Filter the result set by start time", DateTime.UtcNow.AddDays(-1)),
+ RequestParameterRule.Optional(x => x.EndTime, "Filter the result set by end time", DateTime.UtcNow.AddHours(-1)),
+ RequestParameterRule.Optional(x => x.Limit, "Limit the result set to a maximum number of items", 100),
+ RequestParameterRule.Optional(x => x.Direction, "The direction in which to retrieve the results", DataDirection.Descending),
+ };
+
///
/// ctor
///
public GetTradeHistoryOptions(string exchange, bool supportsAscending, bool supportsDescending, bool timeFilterSupported, int maxLimit, bool needsAuthentication)
- : base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, needsAuthentication, nameof(IGetTradeHistoryRest.GetTradeHistoryAsync))
+ : base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, needsAuthentication, nameof(IGetTradeHistoryRest.GetTradeHistoryAsync), _defaultParameterRules)
{
}
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/GetTradeHistoryRequest.cs b/CryptoExchange.Net/SharedApis/V2/Trades/GetTradeHistory/GetTradeHistoryRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/GetTradeHistoryRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/Trades/GetTradeHistory/GetTradeHistoryRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/V2/Trades/GetTradeHistory/IGetTradeHistory.cs b/CryptoExchange.Net/SharedApis/V2/Trades/GetTradeHistory/IGetTradeHistory.cs
index 2a2c440d..e1fc1c70 100644
--- a/CryptoExchange.Net/SharedApis/V2/Trades/GetTradeHistory/IGetTradeHistory.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Trades/GetTradeHistory/IGetTradeHistory.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Trade history request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
GetTradeHistoryOptions GetTradeHistoryOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/Trades/SubscribeTrades/SubscribeTradeOptions.cs b/CryptoExchange.Net/SharedApis/V2/Trades/SubscribeTrades/SubscribeTradeOptions.cs
index 27bed500..2c81f7ae 100644
--- a/CryptoExchange.Net/SharedApis/V2/Trades/SubscribeTrades/SubscribeTradeOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Trades/SubscribeTrades/SubscribeTradeOptions.cs
@@ -12,10 +12,16 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Subscribe to public trade updates for a symbol";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Optional(x => x.Symbol, "The symbol to subscribe to", new SharedSymbol(TradingMode.Spot, "ETH", "USDT")),
+ RequestParameterRule.Optional(x => x.Symbols, "The symbols to subscribe to", new[] { new SharedSymbol(TradingMode.Spot, "ETH", "USDT") }),
+ };
+
///
/// ctor
///
- public SubscribeTradeOptions(string exchange, bool needsAuthentication) : base(exchange, needsAuthentication, nameof(ISubscribeTradesSocket.SubscribeToTradeUpdatesAsync))
+ public SubscribeTradeOptions(string exchange, bool needsAuthentication) : base(exchange, needsAuthentication, nameof(ISubscribeTradesSocket.SubscribeToTradeUpdatesAsync), _defaultParameterRules)
{
}
}
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/SubscribeTradeRequest.cs b/CryptoExchange.Net/SharedApis/V2/Trades/SubscribeTrades/SubscribeTradeRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/SubscribeTradeRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/Trades/SubscribeTrades/SubscribeTradeRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/V2/Transfers/ITransfer.cs b/CryptoExchange.Net/SharedApis/V2/Transfers/ITransfer.cs
index d87337a2..2a8109a0 100644
--- a/CryptoExchange.Net/SharedApis/V2/Transfers/ITransfer.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Transfers/ITransfer.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Transfer request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
TransferOptions TransferOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/Transfers/TransferOptions.cs b/CryptoExchange.Net/SharedApis/V2/Transfers/Transfer/TransferOptions.cs
similarity index 65%
rename from CryptoExchange.Net/SharedApis/V2/Transfers/TransferOptions.cs
rename to CryptoExchange.Net/SharedApis/V2/Transfers/Transfer/TransferOptions.cs
index a8956d48..754f881f 100644
--- a/CryptoExchange.Net/SharedApis/V2/Transfers/TransferOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Transfers/Transfer/TransferOptions.cs
@@ -12,6 +12,16 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Transfer funds between account types";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Asset, "The asset to transfer", "ETH"),
+ RequestParameterRule.Required(x => x.Quantity, "The quantity to transfer", 1m),
+ RequestParameterRule.Optional(x => x.FromSymbol, "The symbol of the source account", "ETH-USDT"),
+ RequestParameterRule.Optional(x => x.ToSymbol, "The symbol of the destination account", "ETH-USDT"),
+ RequestParameterRule.Required(x => x.FromAccountType, "The source account type", SharedAccountType.Spot),
+ RequestParameterRule.Required(x => x.ToAccountType, "The destination account type", SharedAccountType.Funding),
+ };
+
///
/// Supported account types
///
@@ -20,7 +30,7 @@ namespace CryptoExchange.Net.SharedApis
///
/// ctor
///
- public TransferOptions(string exchange, SharedAccountType[] accountTypes) : base(exchange, true, nameof(ITransferRest.TransferAsync))
+ public TransferOptions(string exchange, SharedAccountType[] accountTypes) : base(exchange, true, nameof(ITransferRest.TransferAsync), _defaultParameterRules)
{
SupportedAccountTypes = accountTypes;
}
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/TransferRequest.cs b/CryptoExchange.Net/SharedApis/V2/Transfers/Transfer/TransferRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/TransferRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/Transfers/Transfer/TransferRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Futures/CancelFuturesTriggerOrder/CancelFuturesTriggerOrderOptions.cs b/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Futures/CancelFuturesTriggerOrder/CancelFuturesTriggerOrderOptions.cs
index f32b6da8..100e02c5 100644
--- a/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Futures/CancelFuturesTriggerOrder/CancelFuturesTriggerOrderOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Futures/CancelFuturesTriggerOrder/CancelFuturesTriggerOrderOptions.cs
@@ -12,10 +12,16 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Cancel a futures trigger order";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Symbol, "The symbol of the order to cancel", new SharedSymbol(TradingMode.PerpetualLinear, "ETH", "USDT")),
+ RequestParameterRule.Required(x => x.OrderId, "The id of the order to cancel", "123"),
+ };
+
///
/// ctor
///
- public CancelFuturesTriggerOrderOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ICancelFuturesTriggerOrderRest.CancelFuturesTriggerOrderAsync))
+ public CancelFuturesTriggerOrderOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ICancelFuturesTriggerOrderRest.CancelFuturesTriggerOrderAsync), _defaultParameterRules)
{
}
}
diff --git a/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Futures/CancelFuturesTriggerOrder/ICancelFuturesTriggerOrder.cs b/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Futures/CancelFuturesTriggerOrder/ICancelFuturesTriggerOrder.cs
index a7be9807..9e2279f4 100644
--- a/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Futures/CancelFuturesTriggerOrder/ICancelFuturesTriggerOrder.cs
+++ b/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Futures/CancelFuturesTriggerOrder/ICancelFuturesTriggerOrder.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Cancel trigger order request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
CancelFuturesTriggerOrderOptions CancelFuturesTriggerOrderOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Futures/GetFuturesTriggerOrder/GetFuturesTriggerOrderOptions.cs b/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Futures/GetFuturesTriggerOrder/GetFuturesTriggerOrderOptions.cs
index eca06e4d..60dbf767 100644
--- a/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Futures/GetFuturesTriggerOrder/GetFuturesTriggerOrderOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Futures/GetFuturesTriggerOrder/GetFuturesTriggerOrderOptions.cs
@@ -12,10 +12,16 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Retrieve a futures trigger order";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Symbol, "The symbol of the order to retrieve", new SharedSymbol(TradingMode.PerpetualLinear, "ETH", "USDT")),
+ RequestParameterRule.Required(x => x.OrderId, "The id of the order to retrieve", "123"),
+ };
+
///
/// ctor
///
- public GetFuturesTriggerOrderOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetFuturesTriggerOrderRest.GetFuturesTriggerOrderAsync))
+ public GetFuturesTriggerOrderOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetFuturesTriggerOrderRest.GetFuturesTriggerOrderAsync), _defaultParameterRules)
{
}
}
diff --git a/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Futures/GetFuturesTriggerOrder/IGetFuturesTriggerOrder.cs b/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Futures/GetFuturesTriggerOrder/IGetFuturesTriggerOrder.cs
index 0322219e..9b175e53 100644
--- a/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Futures/GetFuturesTriggerOrder/IGetFuturesTriggerOrder.cs
+++ b/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Futures/GetFuturesTriggerOrder/IGetFuturesTriggerOrder.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Get trigger order request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
GetFuturesTriggerOrderOptions GetFuturesTriggerOrderOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Futures/PlaceFuturesTriggerOrder/IPlaceFuturesTriggerOrder.cs b/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Futures/PlaceFuturesTriggerOrder/IPlaceFuturesTriggerOrder.cs
index ea99632e..6a979243 100644
--- a/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Futures/PlaceFuturesTriggerOrder/IPlaceFuturesTriggerOrder.cs
+++ b/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Futures/PlaceFuturesTriggerOrder/IPlaceFuturesTriggerOrder.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Place futures trigger order options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
PlaceFuturesTriggerOrderOptions PlaceFuturesTriggerOrderOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Futures/PlaceFuturesTriggerOrder/PlaceFuturesTriggerOrderOptions.cs b/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Futures/PlaceFuturesTriggerOrder/PlaceFuturesTriggerOrderOptions.cs
index a674b63b..a26f1ec9 100644
--- a/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Futures/PlaceFuturesTriggerOrder/PlaceFuturesTriggerOrderOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Futures/PlaceFuturesTriggerOrder/PlaceFuturesTriggerOrderOptions.cs
@@ -10,6 +10,23 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Place a new futures trigger order";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Symbol, "The symbol to place the trigger order on", new SharedSymbol(TradingMode.PerpetualLinear, "ETH", "USDT")),
+ RequestParameterRule.Optional(x => x.ClientOrderId, "The client order id", "123"),
+ RequestParameterRule.Required(x => x.OrderDirection, "The direction of the order when triggered", SharedTriggerOrderDirection.Enter),
+ RequestParameterRule.Required(x => x.PriceDirection, "The price direction which activates the order", SharedTriggerPriceDirection.PriceAbove),
+ RequestParameterRule.Required(x => x.Quantity, "The order quantity", SharedQuantity.Base(0.1m)),
+ RequestParameterRule.Optional(x => x.OrderPrice, "The limit price of the order", 1m),
+ RequestParameterRule.Required(x => x.TriggerPrice, "The price at which the order activates", 1m),
+ RequestParameterRule.Optional(x => x.TimeInForce, "The order time in force", SharedTimeInForce.GoodTillCanceled),
+ RequestParameterRule.Optional(x => x.PositionMode, "The position mode of the account", SharedPositionMode.OneWay),
+ RequestParameterRule.Required(x => x.PositionSide, "The position side of the order", SharedPositionSide.Long),
+ RequestParameterRule.Optional(x => x.MarginMode, "The margin mode of the order", SharedMarginMode.Cross),
+ RequestParameterRule.Optional(x => x.Leverage, "The leverage for the position", 10m),
+ RequestParameterRule.Optional(x => x.TriggerPriceType, "The price type used to trigger the order", SharedTriggerPriceType.LastPrice),
+ };
+
///
/// When true the API holds the funds until the order is triggered or canceled. When false the funds will only be required when the order is triggered and will fail if the funds are not available at that time.
///
@@ -18,7 +35,7 @@ namespace CryptoExchange.Net.SharedApis
///
/// ctor
///
- public PlaceFuturesTriggerOrderOptions(string exchange, bool holdsFunds) : base(exchange, true, nameof(IPlaceFuturesTriggerOrderRest.PlaceFuturesTriggerOrderAsync))
+ public PlaceFuturesTriggerOrderOptions(string exchange, bool holdsFunds) : base(exchange, true, nameof(IPlaceFuturesTriggerOrderRest.PlaceFuturesTriggerOrderAsync), _defaultParameterRules)
{
HoldsFunds = holdsFunds;
}
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/PlaceFuturesTriggerOrderRequest.cs b/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Futures/PlaceFuturesTriggerOrder/PlaceFuturesTriggerOrderRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/PlaceFuturesTriggerOrderRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/TriggerOrders/Futures/PlaceFuturesTriggerOrder/PlaceFuturesTriggerOrderRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Spot/CancelSpotTriggerOrder/CancelSpotTriggerOrderOptions.cs b/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Spot/CancelSpotTriggerOrder/CancelSpotTriggerOrderOptions.cs
index a16c756f..e588718c 100644
--- a/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Spot/CancelSpotTriggerOrder/CancelSpotTriggerOrderOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Spot/CancelSpotTriggerOrder/CancelSpotTriggerOrderOptions.cs
@@ -13,10 +13,16 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Cancel a spot trigger order";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Symbol, "The symbol of the order to cancel", new SharedSymbol(TradingMode.Spot, "ETH", "USDT")),
+ RequestParameterRule.Required(x => x.OrderId, "The id of the order to cancel", "123"),
+ };
+
///
/// ctor
///
- public CancelSpotTriggerOrderOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ICancelSpotTriggerOrderRest.CancelSpotTriggerOrderAsync))
+ public CancelSpotTriggerOrderOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ICancelSpotTriggerOrderRest.CancelSpotTriggerOrderAsync), _defaultParameterRules)
{
}
diff --git a/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Spot/CancelSpotTriggerOrder/ICancelSpotTriggerOrder.cs b/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Spot/CancelSpotTriggerOrder/ICancelSpotTriggerOrder.cs
index fea3852a..5d0e2210 100644
--- a/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Spot/CancelSpotTriggerOrder/ICancelSpotTriggerOrder.cs
+++ b/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Spot/CancelSpotTriggerOrder/ICancelSpotTriggerOrder.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Cancel trigger order request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
CancelSpotTriggerOrderOptions CancelSpotTriggerOrderOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Spot/GetSpotTriggerOrder/GetSpotTriggerOrderOptions.cs b/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Spot/GetSpotTriggerOrder/GetSpotTriggerOrderOptions.cs
index 825fba62..58ac2e74 100644
--- a/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Spot/GetSpotTriggerOrder/GetSpotTriggerOrderOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Spot/GetSpotTriggerOrder/GetSpotTriggerOrderOptions.cs
@@ -13,10 +13,16 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Retrieve a spot trigger order";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Symbol, "The symbol of the order to retrieve", new SharedSymbol(TradingMode.Spot, "ETH", "USDT")),
+ RequestParameterRule.Required(x => x.OrderId, "The id of the order to retrieve", "123"),
+ };
+
///
/// ctor
///
- public GetSpotTriggerOrderOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetSpotTriggerOrderRest.GetSpotTriggerOrderAsync))
+ public GetSpotTriggerOrderOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetSpotTriggerOrderRest.GetSpotTriggerOrderAsync), _defaultParameterRules)
{
}
diff --git a/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Spot/GetSpotTriggerOrder/IGetSpotTriggerOrder.cs b/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Spot/GetSpotTriggerOrder/IGetSpotTriggerOrder.cs
index 513930e0..6199ebf0 100644
--- a/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Spot/GetSpotTriggerOrder/IGetSpotTriggerOrder.cs
+++ b/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Spot/GetSpotTriggerOrder/IGetSpotTriggerOrder.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Get trigger order request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
GetSpotTriggerOrderOptions GetSpotTriggerOrderOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Spot/PlaceSpotTriggerOrder/IPlaceSpotTriggerOrder.cs b/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Spot/PlaceSpotTriggerOrder/IPlaceSpotTriggerOrder.cs
index 0c4a2e4a..b9844e79 100644
--- a/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Spot/PlaceSpotTriggerOrder/IPlaceSpotTriggerOrder.cs
+++ b/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Spot/PlaceSpotTriggerOrder/IPlaceSpotTriggerOrder.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Place spot trigger order options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
PlaceSpotTriggerOrderOptions PlaceSpotTriggerOrderOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Spot/PlaceSpotTriggerOrder/PlaceSpotTriggerOrderOptions.cs b/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Spot/PlaceSpotTriggerOrder/PlaceSpotTriggerOrderOptions.cs
index 56f1942e..2c4272e9 100644
--- a/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Spot/PlaceSpotTriggerOrder/PlaceSpotTriggerOrderOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Spot/PlaceSpotTriggerOrder/PlaceSpotTriggerOrderOptions.cs
@@ -10,6 +10,18 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Place a new spot trigger order";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Symbol, "The symbol to place the trigger order on", new SharedSymbol(TradingMode.Spot, "ETH", "USDT")),
+ RequestParameterRule.Optional(x => x.ClientOrderId, "The client order id", "123"),
+ RequestParameterRule.Required(x => x.OrderSide, "The order side", SharedOrderSide.Buy),
+ RequestParameterRule.Required(x => x.PriceDirection, "The price direction which activates the order", SharedTriggerPriceDirection.PriceAbove),
+ RequestParameterRule.Optional(x => x.TimeInForce, "The order time in force", SharedTimeInForce.GoodTillCanceled),
+ RequestParameterRule.Required(x => x.Quantity, "The order quantity", SharedQuantity.Base(0.1m)),
+ RequestParameterRule.Optional(x => x.OrderPrice, "The limit price of the order", 1m),
+ RequestParameterRule.Required(x => x.TriggerPrice, "The price at which the order activates", 1m),
+ };
+
///
/// When true the API holds the funds until the order is triggered or canceled. When false the funds will only be required when the order is triggered and will fail if the funds are not available at that time.
///
@@ -18,7 +30,7 @@ namespace CryptoExchange.Net.SharedApis
///
/// ctor
///
- public PlaceSpotTriggerOrderOptions(string exchange, bool holdsFunds) : base(exchange, true, nameof(IPlaceSpotTriggerOrderRest.PlaceSpotTriggerOrderAsync))
+ public PlaceSpotTriggerOrderOptions(string exchange, bool holdsFunds) : base(exchange, true, nameof(IPlaceSpotTriggerOrderRest.PlaceSpotTriggerOrderAsync), _defaultParameterRules)
{
HoldsFunds = holdsFunds;
}
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/PlaceSpotTriggerOrderRequest.cs b/CryptoExchange.Net/SharedApis/V2/TriggerOrders/Spot/PlaceSpotTriggerOrder/PlaceSpotTriggerOrderRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/PlaceSpotTriggerOrderRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/TriggerOrders/Spot/PlaceSpotTriggerOrder/PlaceSpotTriggerOrderRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/V2/UserTrades/Futures/GetFuturesOrderTrades/GetFuturesOrderTradesOptions.cs b/CryptoExchange.Net/SharedApis/V2/UserTrades/Futures/GetFuturesOrderTrades/GetFuturesOrderTradesOptions.cs
index 90fccf8e..8a914b16 100644
--- a/CryptoExchange.Net/SharedApis/V2/UserTrades/Futures/GetFuturesOrderTrades/GetFuturesOrderTradesOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/UserTrades/Futures/GetFuturesOrderTrades/GetFuturesOrderTradesOptions.cs
@@ -12,10 +12,16 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Retrieve trades for a futures order";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Symbol, "The symbol of the order to retrieve trades for", new SharedSymbol(TradingMode.PerpetualLinear, "ETH", "USDT")),
+ RequestParameterRule.Required(x => x.OrderId, "The id of the order to retrieve trades for", "123"),
+ };
+
///
/// ctor
///
- public GetFuturesOrderTradesOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetFuturesOrderTradesRest.GetFuturesOrderTradesAsync))
+ public GetFuturesOrderTradesOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetFuturesOrderTradesRest.GetFuturesOrderTradesAsync), _defaultParameterRules)
{
}
}
diff --git a/CryptoExchange.Net/SharedApis/V2/UserTrades/Futures/GetFuturesOrderTrades/IGetFuturesOrderTrades.cs b/CryptoExchange.Net/SharedApis/V2/UserTrades/Futures/GetFuturesOrderTrades/IGetFuturesOrderTrades.cs
index c10fee8c..6e17c655 100644
--- a/CryptoExchange.Net/SharedApis/V2/UserTrades/Futures/GetFuturesOrderTrades/IGetFuturesOrderTrades.cs
+++ b/CryptoExchange.Net/SharedApis/V2/UserTrades/Futures/GetFuturesOrderTrades/IGetFuturesOrderTrades.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Futures get order trades request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
GetFuturesOrderTradesOptions GetFuturesOrderTradesOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/UserTrades/Futures/GetFuturesUserTradeHistory/GetFuturesUserTradeHistoryOptions.cs b/CryptoExchange.Net/SharedApis/V2/UserTrades/Futures/GetFuturesUserTradeHistory/GetFuturesUserTradeHistoryOptions.cs
index a1b5128a..ef799bc9 100644
--- a/CryptoExchange.Net/SharedApis/V2/UserTrades/Futures/GetFuturesUserTradeHistory/GetFuturesUserTradeHistoryOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/UserTrades/Futures/GetFuturesUserTradeHistory/GetFuturesUserTradeHistoryOptions.cs
@@ -12,11 +12,20 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Retrieve futures user trade history";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Symbol, "The symbol to retrieve user trades for", new SharedSymbol(TradingMode.PerpetualLinear, "ETH", "USDT")),
+ RequestParameterRule.Optional(x => x.StartTime, "Filter the result set by start time", DateTime.UtcNow.AddDays(-1)),
+ RequestParameterRule.Optional(x => x.EndTime, "Filter the result set by end time", DateTime.UtcNow.AddHours(-1)),
+ RequestParameterRule.Optional(x => x.Limit, "Limit the result set to a maximum number of items", 100),
+ RequestParameterRule.Optional(x => x.Direction, "The direction in which to retrieve the results", DataDirection.Descending),
+ };
+
///
/// ctor
///
public GetFuturesUserTradeHistoryOptions(string exchange, bool supportsAscending, bool supportsDescending, bool timeFilterSupported, int maxLimit)
- : base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, true, nameof(IGetFuturesUserTradeHistoryRest.GetFuturesUserTradeHistoryAsync))
+ : base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, true, nameof(IGetFuturesUserTradeHistoryRest.GetFuturesUserTradeHistoryAsync), _defaultParameterRules)
{
}
diff --git a/CryptoExchange.Net/SharedApis/V2/UserTrades/Futures/GetFuturesUserTradeHistory/IGetFuturesUserTradeHistory.cs b/CryptoExchange.Net/SharedApis/V2/UserTrades/Futures/GetFuturesUserTradeHistory/IGetFuturesUserTradeHistory.cs
index 4981670d..14a02ab9 100644
--- a/CryptoExchange.Net/SharedApis/V2/UserTrades/Futures/GetFuturesUserTradeHistory/IGetFuturesUserTradeHistory.cs
+++ b/CryptoExchange.Net/SharedApis/V2/UserTrades/Futures/GetFuturesUserTradeHistory/IGetFuturesUserTradeHistory.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Futures user trades request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
GetFuturesUserTradeHistoryOptions GetFuturesUserTradeHistoryOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/GetUserTradesRequest.cs b/CryptoExchange.Net/SharedApis/V2/UserTrades/GetUserTradesRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/GetUserTradesRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/UserTrades/GetUserTradesRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/V2/UserTrades/Spot/GetSpotOrderTrades/GetSpotOrderTradesOptions.cs b/CryptoExchange.Net/SharedApis/V2/UserTrades/Spot/GetSpotOrderTrades/GetSpotOrderTradesOptions.cs
index 88fcca1a..fce534f9 100644
--- a/CryptoExchange.Net/SharedApis/V2/UserTrades/Spot/GetSpotOrderTrades/GetSpotOrderTradesOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/UserTrades/Spot/GetSpotOrderTrades/GetSpotOrderTradesOptions.cs
@@ -13,10 +13,16 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Retrieve trades for a spot order";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Symbol, "The symbol of the order to retrieve trades for", new SharedSymbol(TradingMode.Spot, "ETH", "USDT")),
+ RequestParameterRule.Required(x => x.OrderId, "The id of the order to retrieve trades for", "123"),
+ };
+
///
/// ctor
///
- public GetSpotOrderTradesOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetSpotOrderTradesRest.GetSpotOrderTradesAsync))
+ public GetSpotOrderTradesOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetSpotOrderTradesRest.GetSpotOrderTradesAsync), _defaultParameterRules)
{
}
diff --git a/CryptoExchange.Net/SharedApis/V2/UserTrades/Spot/GetSpotOrderTrades/IGetSpotOrderTrades.cs b/CryptoExchange.Net/SharedApis/V2/UserTrades/Spot/GetSpotOrderTrades/IGetSpotOrderTrades.cs
index 7f0dcb19..fe472f86 100644
--- a/CryptoExchange.Net/SharedApis/V2/UserTrades/Spot/GetSpotOrderTrades/IGetSpotOrderTrades.cs
+++ b/CryptoExchange.Net/SharedApis/V2/UserTrades/Spot/GetSpotOrderTrades/IGetSpotOrderTrades.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Spot get order trades request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
GetSpotOrderTradesOptions GetSpotOrderTradesOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/UserTrades/Spot/GetSpotUserTradeHistory/GetSpotUserTradeHistoryOptions.cs b/CryptoExchange.Net/SharedApis/V2/UserTrades/Spot/GetSpotUserTradeHistory/GetSpotUserTradeHistoryOptions.cs
index 313f6d7e..6459ba66 100644
--- a/CryptoExchange.Net/SharedApis/V2/UserTrades/Spot/GetSpotUserTradeHistory/GetSpotUserTradeHistoryOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/UserTrades/Spot/GetSpotUserTradeHistory/GetSpotUserTradeHistoryOptions.cs
@@ -12,11 +12,20 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Retrieve spot user trade history";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Symbol, "The symbol to retrieve user trades for", new SharedSymbol(TradingMode.Spot, "ETH", "USDT")),
+ RequestParameterRule.Optional(x => x.StartTime, "Filter the result set by start time", DateTime.UtcNow.AddDays(-1)),
+ RequestParameterRule.Optional(x => x.EndTime, "Filter the result set by end time", DateTime.UtcNow.AddHours(-1)),
+ RequestParameterRule.Optional(x => x.Limit, "Limit the result set to a maximum number of items", 100),
+ RequestParameterRule.Optional(x => x.Direction, "The direction in which to retrieve the results", DataDirection.Descending),
+ };
+
///
/// ctor
///
public GetSpotUserTradeHistoryOptions(string exchange, bool supportsAscending, bool supportsDescending, bool timeFilterSupported, int maxLimit)
- : base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, true, nameof(IGetSpotUserTradeHistoryRest.GetSpotUserTradeHistoryAsync))
+ : base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, true, nameof(IGetSpotUserTradeHistoryRest.GetSpotUserTradeHistoryAsync), _defaultParameterRules)
{
}
diff --git a/CryptoExchange.Net/SharedApis/V2/UserTrades/Spot/GetSpotUserTradeHistory/IGetSpotUserTradeHistory.cs b/CryptoExchange.Net/SharedApis/V2/UserTrades/Spot/GetSpotUserTradeHistory/IGetSpotUserTradeHistory.cs
index f2154a27..be02e3b2 100644
--- a/CryptoExchange.Net/SharedApis/V2/UserTrades/Spot/GetSpotUserTradeHistory/IGetSpotUserTradeHistory.cs
+++ b/CryptoExchange.Net/SharedApis/V2/UserTrades/Spot/GetSpotUserTradeHistory/IGetSpotUserTradeHistory.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Spot user trades request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
GetSpotUserTradeHistoryOptions GetSpotUserTradeHistoryOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/UserTrades/SubscribeUserTrades/SubscribeUserTradeOptions.cs b/CryptoExchange.Net/SharedApis/V2/UserTrades/SubscribeUserTrades/SubscribeUserTradeOptions.cs
index 225d1ab2..c499c5d5 100644
--- a/CryptoExchange.Net/SharedApis/V2/UserTrades/SubscribeUserTrades/SubscribeUserTradeOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/UserTrades/SubscribeUserTrades/SubscribeUserTradeOptions.cs
@@ -12,10 +12,15 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Subscribe to user trade updates";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Optional(x => x.TradingMode, "Filter user trade updates by trading mode", TradingMode.Spot),
+ };
+
///
/// ctor
///
- public SubscribeUserTradeOptions(string exchange, bool needsAuthentication) : base(exchange, needsAuthentication, nameof(ISubscribeUserTradesSocket.SubscribeToUserTradeUpdatesAsync))
+ public SubscribeUserTradeOptions(string exchange, bool needsAuthentication) : base(exchange, needsAuthentication, nameof(ISubscribeUserTradesSocket.SubscribeToUserTradeUpdatesAsync), _defaultParameterRules)
{
}
}
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/SubscribeUserTradeRequest.cs b/CryptoExchange.Net/SharedApis/V2/UserTrades/SubscribeUserTrades/SubscribeUserTradeRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/SubscribeUserTradeRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/UserTrades/SubscribeUserTrades/SubscribeUserTradeRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/V2/Withdrawals/GetWithdrawalHistory/GetWithdrawalHistoryOptions.cs b/CryptoExchange.Net/SharedApis/V2/Withdrawals/GetWithdrawalHistory/GetWithdrawalHistoryOptions.cs
index 51d74af2..de10678e 100644
--- a/CryptoExchange.Net/SharedApis/V2/Withdrawals/GetWithdrawalHistory/GetWithdrawalHistoryOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Withdrawals/GetWithdrawalHistory/GetWithdrawalHistoryOptions.cs
@@ -12,11 +12,20 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Retrieve withdrawal history";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Optional(x => x.Asset, "Filter the result set by asset", "ETH"),
+ RequestParameterRule.Optional(x => x.StartTime, "Filter the result set by start time", DateTime.UtcNow.AddDays(-1)),
+ RequestParameterRule.Optional(x => x.EndTime, "Filter the result set by end time", DateTime.UtcNow.AddHours(-1)),
+ RequestParameterRule.Optional(x => x.Limit, "Limit the result set to a maximum number of items", 100),
+ RequestParameterRule.Optional(x => x.Direction, "The direction in which to retrieve the results", DataDirection.Descending),
+ };
+
///
/// ctor
///
public GetWithdrawalHistoryOptions(string exchange, bool supportsAscending, bool supportsDescending, bool timeFilterSupported, int maxLimit)
- : base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, true, nameof(IGetWithdrawalHistoryRest.GetWithdrawalHistoryAsync))
+ : base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, true, nameof(IGetWithdrawalHistoryRest.GetWithdrawalHistoryAsync), _defaultParameterRules)
{
}
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/GetWithdrawalsRequest.cs b/CryptoExchange.Net/SharedApis/V2/Withdrawals/GetWithdrawalHistory/GetWithdrawalsRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/GetWithdrawalsRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/Withdrawals/GetWithdrawalHistory/GetWithdrawalsRequest.cs
diff --git a/CryptoExchange.Net/SharedApis/V2/Withdrawals/GetWithdrawalHistory/IGetWithdrawalHistory.cs b/CryptoExchange.Net/SharedApis/V2/Withdrawals/GetWithdrawalHistory/IGetWithdrawalHistory.cs
index 88af4da1..fbc0a357 100644
--- a/CryptoExchange.Net/SharedApis/V2/Withdrawals/GetWithdrawalHistory/IGetWithdrawalHistory.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Withdrawals/GetWithdrawalHistory/IGetWithdrawalHistory.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Withdrawal records request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
GetWithdrawalHistoryOptions GetWithdrawalHistoryOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/Withdrawals/Withdraw/IWithdraw.cs b/CryptoExchange.Net/SharedApis/V2/Withdrawals/Withdraw/IWithdraw.cs
index 347e3a2f..745c43e1 100644
--- a/CryptoExchange.Net/SharedApis/V2/Withdrawals/Withdraw/IWithdraw.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Withdrawals/Withdraw/IWithdraw.cs
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
{
///
/// Withdraw request options.
- /// Use , and to check for required and optional parameters for the request.
+ /// Use and to check for required and optional parameters for the request.
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
///
WithdrawOptions WithdrawOptions { get; }
diff --git a/CryptoExchange.Net/SharedApis/V2/Withdrawals/Withdraw/WithdrawOptions.cs b/CryptoExchange.Net/SharedApis/V2/Withdrawals/Withdraw/WithdrawOptions.cs
index 4221c7a2..24eb9bc7 100644
--- a/CryptoExchange.Net/SharedApis/V2/Withdrawals/Withdraw/WithdrawOptions.cs
+++ b/CryptoExchange.Net/SharedApis/V2/Withdrawals/Withdraw/WithdrawOptions.cs
@@ -8,10 +8,19 @@ namespace CryptoExchange.Net.SharedApis
///
public override string Description => "Withdraw an asset";
+ private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
+ {
+ RequestParameterRule.Required(x => x.Asset, "The asset to withdraw", "ETH"),
+ RequestParameterRule.Required(x => x.Address, "The address to withdraw to", "0x123"),
+ RequestParameterRule.Required(x => x.Quantity, "The quantity to withdraw", 1m),
+ RequestParameterRule.Optional(x => x.AddressTag, "The address tag or memo", "123"),
+ RequestParameterRule.Optional(x => x.Network, "The network to use for the withdrawal", "ERC20"),
+ };
+
///
/// ctor
///
- public WithdrawOptions(string exchange) : base(exchange, true, nameof(IWithdrawRest.WithdrawAsync))
+ public WithdrawOptions(string exchange) : base(exchange, true, nameof(IWithdrawRest.WithdrawAsync), _defaultParameterRules)
{
}
}
diff --git a/CryptoExchange.Net/SharedApis/Models/Requests/WithdrawRequest.cs b/CryptoExchange.Net/SharedApis/V2/Withdrawals/WithdrawRequest.cs
similarity index 100%
rename from CryptoExchange.Net/SharedApis/Models/Requests/WithdrawRequest.cs
rename to CryptoExchange.Net/SharedApis/V2/Withdrawals/WithdrawRequest.cs
diff --git a/CryptoExchange.Net/Trackers/UserData/ItemTrackers/FuturesOrderTracker.cs b/CryptoExchange.Net/Trackers/UserData/ItemTrackers/FuturesOrderTracker.cs
index e1e3025c..201f540e 100644
--- a/CryptoExchange.Net/Trackers/UserData/ItemTrackers/FuturesOrderTracker.cs
+++ b/CryptoExchange.Net/Trackers/UserData/ItemTrackers/FuturesOrderTracker.cs
@@ -49,7 +49,8 @@ namespace CryptoExchange.Net.Trackers.UserData.ItemTrackers
_socketClient = socketClient;
_exchangeParameters = exchangeParameters;
- _requiresSymbolParameterOpenOrders = openRestClient.GetOpenFuturesOrdersOptions.RequiredRequestParameters.Any(x => x.Names.Contains("Symbol"));
+ _requiresSymbolParameterOpenOrders = openRestClient.GetOpenFuturesOrdersOptions.RequestParameterRules
+ .Any(x => x.Name == nameof(GetOpenOrdersRequest.Symbol) && x.Support == RequestParameterSupport.Required);
_timeFilterSupportedClosedOrders = closedRestClient.GetClosedFuturesOrdersOptions.TimePeriodFilterSupport;
}
diff --git a/CryptoExchange.Net/Trackers/UserData/ItemTrackers/SpotOrderTracker.cs b/CryptoExchange.Net/Trackers/UserData/ItemTrackers/SpotOrderTracker.cs
index 4a98df30..76eb7888 100644
--- a/CryptoExchange.Net/Trackers/UserData/ItemTrackers/SpotOrderTracker.cs
+++ b/CryptoExchange.Net/Trackers/UserData/ItemTrackers/SpotOrderTracker.cs
@@ -49,7 +49,8 @@ namespace CryptoExchange.Net.Trackers.UserData.ItemTrackers
_socketClient = socketClient;
_exchangeParameters = exchangeParameters;
- _requiresSymbolParameterOpenOrders = openOrderClient.GetOpenSpotOrdersOptions.RequiredRequestParameters.Any(x => x.Names.Contains("Symbol"));
+ _requiresSymbolParameterOpenOrders = openOrderClient.GetOpenSpotOrdersOptions.RequestParameterRules
+ .Any(x => x.Name == nameof(GetOpenOrdersRequest.Symbol) && x.Support == RequestParameterSupport.Required);
_timeFilterSupportedClosedOrders = closedOrderClient.GetClosedSpotOrdersOptions.TimePeriodFilterSupport;
}