mirror of
https://github.com/JKorf/CryptoExchange.Net.git
synced 2026-10-14 07:01:46 +00:00
wip
This commit is contained in:
@@ -0,0 +1,170 @@
|
||||
using CryptoExchange.Net.SharedApis;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace CryptoExchange.Net.UnitTests
|
||||
{
|
||||
[TestFixture]
|
||||
internal class SharedApiClientTests
|
||||
{
|
||||
[Test]
|
||||
public void GetCapability_ShouldUseCapabilityTradingModes()
|
||||
{
|
||||
var sharedApi = new TestSharedApi(
|
||||
[TradingMode.Spot, TradingMode.PerpetualLinear],
|
||||
[TradingMode.Spot]);
|
||||
var client = new TestSharedApiClient(sharedApi);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(client.GetCapability<ITestCapability>(TradingMode.Spot), Is.SameAs(sharedApi));
|
||||
Assert.That(client.GetCapability<ITestCapability>(TradingMode.PerpetualLinear), Is.Null);
|
||||
Assert.That(client.GetCapabilities<ITestCapability>(TradingMode.Spot), Has.Count.EqualTo(1));
|
||||
Assert.That(client.GetCapabilities<ITestCapability>(TradingMode.PerpetualLinear), Is.Empty);
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CapabilityTradingModes_ShouldDefaultToSharedApiTradingModes()
|
||||
{
|
||||
var sharedApi = new TestSharedApi(
|
||||
[TradingMode.Spot, TradingMode.PerpetualLinear],
|
||||
null);
|
||||
var client = new TestSharedApiClient(sharedApi);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(client.GetCapability<ITestCapability>(TradingMode.Spot), Is.SameAs(sharedApi));
|
||||
Assert.That(client.GetCapability<ITestCapability>(TradingMode.PerpetualLinear), Is.SameAs(sharedApi));
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CapabilityTradingModes_ShouldIntersectApiApplicableAndOverrideModes()
|
||||
{
|
||||
var sharedApi = new TestSharedApi(
|
||||
[TradingMode.Spot, TradingMode.PerpetualLinear, TradingMode.DeliveryLinear],
|
||||
[TradingMode.Spot, TradingMode.PerpetualLinear],
|
||||
[TradingMode.PerpetualLinear, TradingMode.DeliveryLinear]);
|
||||
|
||||
Assert.That(
|
||||
sharedApi.CapabilityOptions.SupportedTradingModes,
|
||||
Is.EqualTo(new[] { TradingMode.PerpetualLinear }));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CapabilityOptions_ShouldApplyIntrinsicTradingModes()
|
||||
{
|
||||
var apiModes = new[]
|
||||
{
|
||||
TradingMode.Spot,
|
||||
TradingMode.PerpetualLinear,
|
||||
TradingMode.DeliveryLinear,
|
||||
TradingMode.PerpetualInverse,
|
||||
TradingMode.DeliveryInverse
|
||||
};
|
||||
var spotOptions = new PlaceSpotOrderOptions("TestExchange");
|
||||
var futuresOptions = new GetPositionsOptions("TestExchange", false);
|
||||
var perpetualOptions = new GetFundingRateHistoryOptions(
|
||||
"TestExchange",
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
100,
|
||||
false);
|
||||
var unrestrictedOptions = new GetTickerOptions("TestExchange");
|
||||
|
||||
_ = new TestOptionsHost(apiModes, spotOptions);
|
||||
_ = new TestOptionsHost(apiModes, futuresOptions);
|
||||
_ = new TestOptionsHost(apiModes, perpetualOptions);
|
||||
_ = new TestOptionsHost(apiModes, unrestrictedOptions);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(spotOptions.SupportedTradingModes, Is.EqualTo(new[] { TradingMode.Spot }));
|
||||
Assert.That(futuresOptions.SupportedTradingModes, Is.EqualTo(new[]
|
||||
{
|
||||
TradingMode.PerpetualLinear,
|
||||
TradingMode.DeliveryLinear,
|
||||
TradingMode.PerpetualInverse,
|
||||
TradingMode.DeliveryInverse
|
||||
}));
|
||||
Assert.That(perpetualOptions.SupportedTradingModes, Is.EqualTo(new[]
|
||||
{
|
||||
TradingMode.PerpetualLinear,
|
||||
TradingMode.PerpetualInverse
|
||||
}));
|
||||
Assert.That(unrestrictedOptions.SupportedTradingModes, Is.EqualTo(apiModes));
|
||||
});
|
||||
}
|
||||
|
||||
private interface ITestCapability : ISharedApiCapability
|
||||
{
|
||||
}
|
||||
|
||||
private sealed class TestCapabilityOptions : CapabilityOptions<SharedRequest, ITestCapability>
|
||||
{
|
||||
public override string Description => "Test capability";
|
||||
|
||||
public TestCapabilityOptions(TradingMode[]? applicableTradingModes)
|
||||
: base("TestExchange", false, "TestOperation", [], applicableTradingModes)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class TestSharedApi : SharedApiBase, ITestCapability
|
||||
{
|
||||
public TestCapabilityOptions CapabilityOptions { get; }
|
||||
|
||||
public TestSharedApi(TradingMode[] apiTradingModes, TradingMode[]? capabilityTradingModes)
|
||||
: this(apiTradingModes, capabilityTradingModes, null)
|
||||
{
|
||||
}
|
||||
|
||||
public TestSharedApi(
|
||||
TradingMode[] apiTradingModes,
|
||||
TradingMode[]? capabilityTradingModes,
|
||||
TradingMode[]? applicableTradingModes)
|
||||
: base(
|
||||
SharedTransport.Rest,
|
||||
"TestExchange",
|
||||
apiTradingModes,
|
||||
() => false,
|
||||
(baseAsset, quoteAsset, tradingMode, deliverDate) => $"{baseAsset}{quoteAsset}")
|
||||
{
|
||||
var options = new TestCapabilityOptions(applicableTradingModes)
|
||||
{
|
||||
SupportedTradingModeOverrides = capabilityTradingModes
|
||||
};
|
||||
|
||||
SetCapabilities(options);
|
||||
CapabilityOptions = options;
|
||||
}
|
||||
|
||||
public override SharedClientInfo Discover() => new();
|
||||
}
|
||||
|
||||
private sealed class TestOptionsHost : SharedApiBase
|
||||
{
|
||||
public TestOptionsHost(TradingMode[] apiTradingModes, CapabilityOptions capabilityOptions)
|
||||
: base(
|
||||
SharedTransport.Rest,
|
||||
"TestExchange",
|
||||
apiTradingModes,
|
||||
() => false,
|
||||
(baseAsset, quoteAsset, tradingMode, deliverDate) => $"{baseAsset}{quoteAsset}")
|
||||
{
|
||||
SetCapabilities(capabilityOptions);
|
||||
}
|
||||
|
||||
public override SharedClientInfo Discover() => new();
|
||||
}
|
||||
|
||||
private sealed class TestSharedApiClient : SharedApiClientBase
|
||||
{
|
||||
public TestSharedApiClient(params ISharedApiCapability[] sharedApis)
|
||||
: base([SharedTransport.Rest, SharedTransport.Socket], sharedApis)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -91,6 +91,66 @@ namespace CryptoExchange.Net.UnitTests
|
||||
string.Join(Environment.NewLine, failures));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void RequiredExchangeParameter_ShouldAcceptNameOrAnyAlias()
|
||||
{
|
||||
const string exchange = "TestExchange";
|
||||
var options = new GetTickerOptions(exchange)
|
||||
{
|
||||
ExchangeParameterRules =
|
||||
[
|
||||
ExchangeParameterRule.Required(
|
||||
"Parameter",
|
||||
"Test parameter",
|
||||
1,
|
||||
"Alias1",
|
||||
"Alias2")
|
||||
]
|
||||
};
|
||||
|
||||
var missingResult = options.ValidateRequest(null, null, [TradingMode.Spot]);
|
||||
var nameResult = options.ValidateRequest(
|
||||
new ExchangeParameters(new ExchangeParameter(exchange, "Parameter", 1)),
|
||||
null,
|
||||
[TradingMode.Spot]);
|
||||
var firstAliasResult = options.ValidateRequest(
|
||||
new ExchangeParameters(new ExchangeParameter(exchange, "Alias1", 1)),
|
||||
null,
|
||||
[TradingMode.Spot]);
|
||||
var secondAliasResult = options.ValidateRequest(
|
||||
new ExchangeParameters(new ExchangeParameter(exchange, "Alias2", 1)),
|
||||
null,
|
||||
[TradingMode.Spot]);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(missingResult, Is.Not.Null);
|
||||
Assert.That(nameResult, Is.Null);
|
||||
Assert.That(firstAliasResult, Is.Null);
|
||||
Assert.That(secondAliasResult, Is.Null);
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void RequiredExchangeParameterWithoutAliases_ShouldBeRequired()
|
||||
{
|
||||
const string exchange = "TestExchange";
|
||||
var options = new GetTickerOptions(exchange)
|
||||
{
|
||||
ExchangeParameterRules =
|
||||
[
|
||||
ExchangeParameterRule.Required(
|
||||
"Parameter",
|
||||
"Test parameter",
|
||||
1)
|
||||
]
|
||||
};
|
||||
|
||||
var result = options.ValidateRequest(null, null, [TradingMode.Spot]);
|
||||
|
||||
Assert.That(result, Is.Not.Null);
|
||||
}
|
||||
|
||||
private static Type? GetGenericOptionsType(Type optionsType)
|
||||
{
|
||||
for (var type = optionsType; type != null; type = type.BaseType)
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
/// <summary>
|
||||
/// Capability lookup result
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Capability type</typeparam>
|
||||
public class SharedCapabilityResolution<T>
|
||||
where T : ISharedApiCapability
|
||||
{
|
||||
/// <summary>
|
||||
/// The capability
|
||||
/// </summary>
|
||||
public T Capability { get; }
|
||||
/// <summary>
|
||||
/// The capability options
|
||||
/// </summary>
|
||||
public CapabilityOptions Options { get; }
|
||||
|
||||
internal SharedCapabilityResolution(
|
||||
T capability,
|
||||
CapabilityOptions options)
|
||||
{
|
||||
Capability = capability;
|
||||
Options = options;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// References for a capability available through REST.
|
||||
/// </summary>
|
||||
public sealed class SharedRestCapability<TCapability, TRest>
|
||||
: SharedCapabilityReference<TCapability>
|
||||
where TCapability : ISharedApiCapability
|
||||
where TRest : TCapability, ISharedRest
|
||||
{
|
||||
|
||||
@@ -23,12 +23,6 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <inheritdoc />
|
||||
public override Type CapabilityType => typeof(IFuturesOrderRestClient);
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual RequestParameterRuleOverride[] ParameterRuleOverrides
|
||||
{
|
||||
set => SetRequestParameters(value);
|
||||
}
|
||||
|
||||
private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
|
||||
{
|
||||
RequestParameterRule<ClosePositionRequest>.Required(x => x.Symbol, "The symbol of the position to close", new SharedSymbol(TradingMode.PerpetualLinear, "ETH", "USDT")),
|
||||
@@ -41,7 +35,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public ClosePositionOptions(string exchange, bool authenticated) : base(exchange, nameof(IFuturesOrderRestClient.ClosePositionAsync), true, _defaultParameterRules)
|
||||
public ClosePositionOptions(string exchange, bool authenticated) : base(exchange, nameof(IFuturesOrderRestClient.ClosePositionAsync), true, _defaultParameterRules, SharedTradingModeSets.Futures)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
public ExchangeParameterDescription[] ExchangeParameterRules { get; set; } = [];
|
||||
|
||||
private readonly RequestParameterDescription[] _defaultParameterRules;
|
||||
private readonly TradingMode[]? _applicableTradingModes;
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -84,6 +85,26 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// </summary>
|
||||
public bool Supported { get; set; } = true;
|
||||
/// <summary>
|
||||
/// Trading modes supported by this capability on the containing Shared API.
|
||||
/// </summary>
|
||||
public TradingMode[] SupportedTradingModes { get; private set; } = [];
|
||||
/// <summary>
|
||||
/// Implementation-specific overrides for the default request parameter rules.
|
||||
/// </summary>
|
||||
public RequestParameterRuleOverride[] ParameterRuleOverrides
|
||||
{
|
||||
init
|
||||
{
|
||||
RequestParameterRules = CombineParameters(_defaultParameterRules, value);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Optional implementation-specific restriction of the trading modes supported by this capability.
|
||||
/// The final supported modes are the intersection of this value, the modes applicable to the capability,
|
||||
/// and the modes supported by the containing Shared API.
|
||||
/// </summary>
|
||||
public TradingMode[]? SupportedTradingModeOverrides { private get; init; }
|
||||
/// <summary>
|
||||
/// Description of the endpoint
|
||||
/// </summary>
|
||||
public abstract string Description { get; }
|
||||
@@ -99,7 +120,8 @@ namespace CryptoExchange.Net.SharedApis
|
||||
string exchange,
|
||||
string operationName,
|
||||
bool needAuthentication,
|
||||
IEnumerable<RequestParameterDescription> defaultParameterRules)
|
||||
IEnumerable<RequestParameterDescription> defaultParameterRules,
|
||||
IEnumerable<TradingMode>? applicableTradingModes = null)
|
||||
{
|
||||
Exchange = exchange;
|
||||
OperationName = operationName;
|
||||
@@ -112,15 +134,19 @@ namespace CryptoExchange.Net.SharedApis
|
||||
RequestParameterRules = CombineParameters(
|
||||
_defaultParameterRules,
|
||||
Array.Empty<RequestParameterRuleOverride>());
|
||||
|
||||
_applicableTradingModes = applicableTradingModes?.Distinct().ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set request parameter overrides for this instance
|
||||
/// </summary>
|
||||
/// <param name="overrides">The parameter overrides</param>
|
||||
protected void SetRequestParameters(IEnumerable<RequestParameterRuleOverride> overrides)
|
||||
internal void InitializeSupportedTradingModes(TradingMode[] apiSupportedTradingModes)
|
||||
{
|
||||
RequestParameterRules = CombineParameters(_defaultParameterRules, overrides);
|
||||
IEnumerable<TradingMode> supportedModes = apiSupportedTradingModes;
|
||||
if (_applicableTradingModes != null)
|
||||
supportedModes = supportedModes.Intersect(_applicableTradingModes);
|
||||
if (SupportedTradingModeOverrides != null)
|
||||
supportedModes = supportedModes.Intersect(SupportedTradingModeOverrides);
|
||||
|
||||
SupportedTradingModes = supportedModes.Distinct().ToArray();
|
||||
}
|
||||
|
||||
private RequestParameterDescription[] CombineParameters(
|
||||
@@ -167,8 +193,9 @@ namespace CryptoExchange.Net.SharedApis
|
||||
|
||||
foreach (var param in RequiredExchangeParameters)
|
||||
{
|
||||
if (ExchangeParameters.HasValue(exchangeParameters, Exchange, param.Name, param.ValueType) != true
|
||||
&& param.Aliases.Any(x => ExchangeParameters.HasValue(exchangeParameters, Exchange, x, param.ValueType) != true))
|
||||
var hasValue = ExchangeParameters.HasValue(exchangeParameters, Exchange, param.Name, param.ValueType)
|
||||
|| param.Aliases.Any(x => ExchangeParameters.HasValue(exchangeParameters, Exchange, x, param.ValueType));
|
||||
if (!hasValue)
|
||||
{
|
||||
if (param.Aliases.Length == 0)
|
||||
return ArgumentError.Invalid(param.Name, $"Exchange parameter `{param.Name}` for exchange `{Exchange}` should be provided. Example: {param.ExampleValue}");
|
||||
@@ -234,17 +261,16 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <inheritdoc />
|
||||
public override Type CapabilityType => typeof(TCapability);
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual RequestParameterRuleOverride[] ParameterRuleOverrides
|
||||
{
|
||||
set => SetRequestParameters(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public CapabilityOptions(string exchange, bool needsAuthentication, string requestName, IEnumerable<RequestParameterDescription> defaultParameterRules)
|
||||
: base(exchange, requestName, needsAuthentication, defaultParameterRules)
|
||||
public CapabilityOptions(
|
||||
string exchange,
|
||||
bool needsAuthentication,
|
||||
string requestName,
|
||||
IEnumerable<RequestParameterDescription> defaultParameterRules,
|
||||
IEnumerable<TradingMode>? applicableTradingModes = null)
|
||||
: base(exchange, requestName, needsAuthentication, defaultParameterRules, applicableTradingModes)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -307,7 +333,10 @@ namespace CryptoExchange.Net.SharedApis
|
||||
|
||||
}
|
||||
|
||||
return ValidateRequest(request.ExchangeParameters, request.TradingMode, client.SupportedTradingModes);
|
||||
return ValidateRequest(
|
||||
request.ExchangeParameters,
|
||||
request.TradingMode,
|
||||
SupportedTradingModes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,8 +31,9 @@ namespace CryptoExchange.Net.SharedApis
|
||||
string exchange,
|
||||
string operationName,
|
||||
bool needsAuthentication,
|
||||
IEnumerable<RequestParameterDescription> defaultParameterRules)
|
||||
: base(exchange, operationName, needsAuthentication, defaultParameterRules)
|
||||
IEnumerable<RequestParameterDescription> defaultParameterRules,
|
||||
IEnumerable<TradingMode>? applicableTradingModes = null)
|
||||
: base(exchange, operationName, needsAuthentication, defaultParameterRules, applicableTradingModes)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,8 @@ namespace CryptoExchange.Net.SharedApis
|
||||
int maxLimit,
|
||||
bool needsAuthentication,
|
||||
string requestName,
|
||||
IEnumerable<RequestParameterDescription> defaultParameterRules) : base(exchange, needsAuthentication, requestName, defaultParameterRules)
|
||||
IEnumerable<RequestParameterDescription> defaultParameterRules,
|
||||
IEnumerable<TradingMode>? applicableTradingModes = null) : base(exchange, needsAuthentication, requestName, defaultParameterRules, applicableTradingModes)
|
||||
{
|
||||
SupportsAscending = supportsAscending;
|
||||
SupportsDescending = supportsDescending;
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
internal static class SharedTradingModeSets
|
||||
{
|
||||
internal static TradingMode[] Spot { get; } =
|
||||
[
|
||||
TradingMode.Spot
|
||||
];
|
||||
|
||||
internal static TradingMode[] Futures { get; } =
|
||||
[
|
||||
TradingMode.PerpetualLinear,
|
||||
TradingMode.DeliveryLinear,
|
||||
TradingMode.PerpetualInverse,
|
||||
TradingMode.DeliveryInverse
|
||||
];
|
||||
|
||||
internal static TradingMode[] Perpetual { get; } =
|
||||
[
|
||||
TradingMode.PerpetualLinear,
|
||||
TradingMode.PerpetualInverse
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -48,6 +48,9 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <inheritdoc />
|
||||
protected void SetCapabilities(params CapabilityOptions[] capabilities)
|
||||
{
|
||||
foreach (var capability in capabilities)
|
||||
capability.InitializeSupportedTradingModes(SupportedTradingModes);
|
||||
|
||||
_capabilities = Array.AsReadOnly(capabilities);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,11 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// </summary>
|
||||
public interface ISharedApiClientBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Shared API's available on this client
|
||||
/// </summary>
|
||||
IReadOnlyList<ISharedApi> SharedApis { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Get all capabilities matching the provided capability type.
|
||||
/// Example:
|
||||
@@ -18,7 +23,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <typeparam name="T">The capability type</typeparam>
|
||||
/// <param name="tradingMode">Filter by supported trading mode</param>
|
||||
/// <param name="transport">Filter by transport method</param>
|
||||
IReadOnlyList<T> GetCapabilities<T>(TradingMode? tradingMode = null, SharedTransport? transport = null)
|
||||
IReadOnlyList<SharedCapabilityResolution<T>> GetCapabilities<T>(TradingMode? tradingMode = null, SharedTransport? transport = null)
|
||||
where T : ISharedApiCapability;
|
||||
|
||||
/// <summary>
|
||||
@@ -30,7 +35,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <typeparam name="T">The capability type</typeparam>
|
||||
/// <param name="transport">The transport method</param>
|
||||
/// <returns>The requested capability type or null if not found</returns>
|
||||
T? GetCapability<T>(SharedTransport? transport = null)
|
||||
SharedCapabilityResolution<T>? GetCapability<T>(SharedTransport? transport = null)
|
||||
where T : ISharedApiCapability;
|
||||
|
||||
/// <summary>
|
||||
@@ -42,7 +47,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <param name="tradingMode">The trading mode</param>
|
||||
/// <param name="transport">The transport method</param>
|
||||
/// <returns>The requested capability type or null if not found</returns>
|
||||
T? GetCapability<T>(TradingMode tradingMode, SharedTransport? transport = null)
|
||||
SharedCapabilityResolution<T>? GetCapability<T>(TradingMode tradingMode, SharedTransport? transport = null)
|
||||
where T : ISharedApiCapability;
|
||||
|
||||
/// <summary>
|
||||
@@ -54,7 +59,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <typeparam name="T">The capability type</typeparam>
|
||||
/// <param name="capability">The capability reference</param>
|
||||
/// <returns>The requested capability type or null if not found</returns>
|
||||
T? GetCapability<T>(SharedCapabilityReference<T> capability)
|
||||
SharedCapabilityResolution<T>? GetCapability<T>(SharedCapabilityReference<T> capability)
|
||||
where T : ISharedApiCapability;
|
||||
|
||||
/// <summary>
|
||||
@@ -67,7 +72,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <param name="capability">The capability reference</param>
|
||||
/// <param name="tradingMode">The trading mode</param>
|
||||
/// <returns>The requested capability type or null if not found</returns>
|
||||
T? GetCapability<T>(SharedCapabilityReference<T> capability, TradingMode tradingMode)
|
||||
SharedCapabilityResolution<T>? GetCapability<T>(SharedCapabilityReference<T> capability, TradingMode tradingMode)
|
||||
where T : ISharedApiCapability;
|
||||
}
|
||||
|
||||
@@ -76,79 +81,125 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// </summary>
|
||||
public abstract class SharedApiClientBase : ISharedApiClientBase
|
||||
{
|
||||
private readonly ISharedApiCapability[] _sharedApis;
|
||||
private readonly ISharedApi[] _sharedApis;
|
||||
private readonly SharedTransport[] _preferredTransports;
|
||||
|
||||
/// <inheritdoc />
|
||||
public IReadOnlyList<ISharedApi> SharedApis => _sharedApis;
|
||||
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public SharedApiClientBase(SharedTransport[] transportPref, params ISharedApiCapability[] allCapabilities)
|
||||
public SharedApiClientBase(
|
||||
IEnumerable<SharedTransport> transportPreference,
|
||||
params ISharedApi[] sharedApis)
|
||||
{
|
||||
_preferredTransports = transportPref;
|
||||
_sharedApis = allCapabilities.ToArray();
|
||||
_preferredTransports = transportPreference.Distinct().ToArray();
|
||||
_sharedApis = sharedApis.Distinct().ToArray();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IReadOnlyList<T> GetCapabilities<T>(TradingMode? tradingMode = null, SharedTransport? transport = null)
|
||||
where T : ISharedApiCapability
|
||||
{
|
||||
return _sharedApis
|
||||
.OfType<T>()
|
||||
.Where(x =>
|
||||
(tradingMode == null || x.SupportedTradingModes.Contains(tradingMode.Value))
|
||||
&& (transport == null || x.Transport == transport)
|
||||
)
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public T? GetCapability<T>(SharedTransport? transport = null)
|
||||
public SharedCapabilityResolution<T>? GetCapability<T>(SharedTransport? transport = null)
|
||||
where T : ISharedApiCapability
|
||||
{
|
||||
return GetCapabilityCore<T>(null, transport);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public T? GetCapability<T>(TradingMode tradingMode, SharedTransport? transport = null)
|
||||
public SharedCapabilityResolution<T>? GetCapability<T>(TradingMode tradingMode, SharedTransport? transport = null)
|
||||
where T : ISharedApiCapability
|
||||
{
|
||||
return GetCapabilityCore<T>(tradingMode, transport);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public T? GetCapability<T>(SharedCapabilityReference<T> capability)
|
||||
public SharedCapabilityResolution<T>? GetCapability<T>(SharedCapabilityReference<T> capability)
|
||||
where T : ISharedApiCapability
|
||||
{
|
||||
return GetCapabilityCore<T>(null, null);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public T? GetCapability<T>(SharedCapabilityReference<T> capability, TradingMode tradingMode)
|
||||
public SharedCapabilityResolution<T>? GetCapability<T>(SharedCapabilityReference<T> capability, TradingMode tradingMode)
|
||||
where T : ISharedApiCapability
|
||||
{
|
||||
return GetCapabilityCore<T>(tradingMode, null);
|
||||
}
|
||||
|
||||
private T? GetCapabilityCore<T>(TradingMode? tradingMode, SharedTransport? selectedTransport = null)
|
||||
where T : ISharedApiCapability
|
||||
/// <inheritdoc />
|
||||
public IReadOnlyList<SharedCapabilityResolution<T>> GetCapabilities<T>(
|
||||
TradingMode? tradingMode = null,
|
||||
SharedTransport? transport = null)
|
||||
where T : ISharedApiCapability
|
||||
{
|
||||
var implementations = _sharedApis
|
||||
.OfType<T>()
|
||||
.Where(x => tradingMode == null
|
||||
|| x.SupportedTradingModes.Contains(tradingMode.Value))
|
||||
.ToArray();
|
||||
var result = new List<SharedCapabilityResolution<T>>();
|
||||
|
||||
foreach (var transport in selectedTransport != null ? new[] { selectedTransport! } : _preferredTransports)
|
||||
foreach (var sharedApi in _sharedApis)
|
||||
{
|
||||
var matching = implementations
|
||||
.Where(x => x.Transport == transport)
|
||||
.ToArray();
|
||||
if (sharedApi is not T capability)
|
||||
continue;
|
||||
|
||||
if (matching.Length > 0)
|
||||
return matching[0];
|
||||
if (transport != null && sharedApi.Transport != transport)
|
||||
continue;
|
||||
|
||||
var options = GetMatchingOptions<T>(sharedApi, tradingMode);
|
||||
if (options == null)
|
||||
continue;
|
||||
|
||||
result.Add(new SharedCapabilityResolution<T>(
|
||||
capability,
|
||||
options));
|
||||
}
|
||||
|
||||
return default;
|
||||
// Preserve Shared API registration order within each transport.
|
||||
return result
|
||||
.OrderBy(x => GetTransportPriority(x.Capability.Transport))
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
private SharedCapabilityResolution<T>? GetCapabilityCore<T>(
|
||||
TradingMode? tradingMode,
|
||||
SharedTransport? selectedTransport = null)
|
||||
where T : ISharedApiCapability
|
||||
{
|
||||
return GetCapabilities<T>(tradingMode, selectedTransport)
|
||||
.FirstOrDefault();
|
||||
}
|
||||
|
||||
private static CapabilityOptions? GetMatchingOptions<T>(
|
||||
ISharedApi sharedApi,
|
||||
TradingMode? tradingMode)
|
||||
where T : ISharedApiCapability
|
||||
{
|
||||
var requestedType = typeof(T);
|
||||
|
||||
return sharedApi.Capabilities
|
||||
.Where(options =>
|
||||
options.Supported
|
||||
&& IsCapabilityTypeMatch(
|
||||
requestedType,
|
||||
options.CapabilityType)
|
||||
&& (tradingMode == null
|
||||
|| options.SupportedTradingModes.Contains(
|
||||
tradingMode.Value)))
|
||||
// Prefer options declared for the exact requested interface.
|
||||
.OrderByDescending(options =>
|
||||
options.CapabilityType == requestedType)
|
||||
.FirstOrDefault();
|
||||
}
|
||||
|
||||
private static bool IsCapabilityTypeMatch(
|
||||
Type requestedType,
|
||||
Type optionsCapabilityType)
|
||||
{
|
||||
return optionsCapabilityType.IsAssignableFrom(requestedType)
|
||||
|| requestedType.IsAssignableFrom(optionsCapabilityType);
|
||||
}
|
||||
|
||||
private int GetTransportPriority(SharedTransport transport)
|
||||
{
|
||||
var index = Array.IndexOf(_preferredTransports, transport);
|
||||
return index == -1 ? int.MaxValue : index;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// </summary>
|
||||
public override Error? ValidateRequest(
|
||||
GetBalancesRequest request,
|
||||
IGetBalancesRest client)
|
||||
IGetBalances client)
|
||||
{
|
||||
var error = base.ValidateRequest(request, client);
|
||||
if (error != null)
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetFundingInfoOptions(string exchange, bool supportsAscending, bool supportsDescending, bool timeFilterSupported, int maxLimit, bool needsAuthentication)
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, needsAuthentication, nameof(IGetFundingInfoRest.GetFundingInfoAsync), _defaultParameterRules)
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, needsAuthentication, nameof(IGetFundingInfoRest.GetFundingInfoAsync), _defaultParameterRules, SharedTradingModeSets.Perpetual)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetFundingRateHistoryOptions(string exchange, bool supportsAscending, bool supportsDescending, bool timeFilterSupported, int maxLimit, bool needsAuthentication)
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, needsAuthentication, nameof(IGetFundingRateHistoryRest.GetFundingRateHistoryAsync), _defaultParameterRules)
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, needsAuthentication, nameof(IGetFundingRateHistoryRest.GetFundingRateHistoryAsync), _defaultParameterRules, SharedTradingModeSets.Perpetual)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetUserFundingHistoryOptions(string exchange, bool supportsAscending, bool supportsDescending, bool timeFilterSupported, int maxLimit, bool needsAuthentication)
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, needsAuthentication, nameof(IGetUserFundingHistoryRest.GetUserFundingHistoryAsync), _defaultParameterRules)
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, needsAuthentication, nameof(IGetUserFundingHistoryRest.GetUserFundingHistoryAsync), _defaultParameterRules, SharedTradingModeSets.Perpetual)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetAllIndexPricesOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetAllIndexPricesRest.GetAllIndexPricesAsync), _defaultParameterRules)
|
||||
public GetAllIndexPricesOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetAllIndexPricesRest.GetAllIndexPricesAsync), _defaultParameterRules, SharedTradingModeSets.Futures)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetIndexPriceOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetIndexPriceRest.GetIndexPriceAsync), _defaultParameterRules)
|
||||
public GetIndexPriceOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetIndexPriceRest.GetIndexPriceAsync), _defaultParameterRules, SharedTradingModeSets.Futures)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -14,15 +14,15 @@ namespace CryptoExchange.Net.SharedApis
|
||||
|
||||
private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
|
||||
{
|
||||
RequestParameterRule<SubscribeIndexPriceRequest>.Optional(x => x.Symbol, "The symbol to subscribe to", new SharedSymbol(TradingMode.Spot, "ETH", "USDT")),
|
||||
RequestParameterRule<SubscribeIndexPriceRequest>.Optional(x => x.Symbols, "The symbols to subscribe to", new[] { new SharedSymbol(TradingMode.Spot, "ETH", "USDT") }),
|
||||
RequestParameterRule<SubscribeIndexPriceRequest>.Optional(x => x.Symbol, "The symbol to subscribe to", new SharedSymbol(TradingMode.PerpetualLinear, "ETH", "USDT")),
|
||||
RequestParameterRule<SubscribeIndexPriceRequest>.Optional(x => x.Symbols, "The symbols to subscribe to", new[] { new SharedSymbol(TradingMode.PerpetualLinear, "ETH", "USDT") }),
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public SubscribeIndexPriceOptions(string exchange, bool needsAuthentication)
|
||||
: base(exchange, needsAuthentication, nameof(ISubscribeIndexPriceSocket.SubscribeToIndexPriceUpdatesAsync), _defaultParameterRules)
|
||||
: base(exchange, needsAuthentication, nameof(ISubscribeIndexPriceSocket.SubscribeToIndexPriceUpdatesAsync), _defaultParameterRules, SharedTradingModeSets.Futures)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -36,7 +36,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetIndexPriceKlinesOptions(string exchange, bool supportsAscending, bool supportsDescending, bool timeFilterSupported, int maxLimit, bool needsAuthentication)
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, needsAuthentication, nameof(IGetIndexPriceKlinesRest.GetIndexPriceKlinesAsync), _defaultParameterRules)
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, needsAuthentication, nameof(IGetIndexPriceKlinesRest.GetIndexPriceKlinesAsync), _defaultParameterRules, SharedTradingModeSets.Futures)
|
||||
{
|
||||
SupportIntervals = new[]
|
||||
{
|
||||
@@ -61,7 +61,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// ctor
|
||||
/// </summary>
|
||||
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), _defaultParameterRules)
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, needsAuthentication, nameof(IIndexPriceKlineRestClient.GetIndexPriceKlinesAsync), _defaultParameterRules, SharedTradingModeSets.Futures)
|
||||
{
|
||||
SupportIntervals = intervals;
|
||||
}
|
||||
|
||||
+2
-2
@@ -36,7 +36,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetMarkPriceKlinesOptions(string exchange, bool supportsAscending, bool supportsDescending, bool timeFilterSupported, int maxLimit, bool needsAuthentication)
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, needsAuthentication, nameof(IGetMarkPriceKlinesRest.GetMarkPriceKlinesAsync), _defaultParameterRules)
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, needsAuthentication, nameof(IGetMarkPriceKlinesRest.GetMarkPriceKlinesAsync), _defaultParameterRules, SharedTradingModeSets.Futures)
|
||||
{
|
||||
SupportIntervals = new[]
|
||||
{
|
||||
@@ -61,7 +61,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetMarkPriceKlinesOptions(string exchange, bool supportsAscending, bool supportsDescending, bool timeFilterSupported, int maxLimit, bool needsAuthentication, params SharedKlineInterval[] intervals)
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, needsAuthentication, nameof(IGetMarkPriceKlinesRest.GetMarkPriceKlinesAsync), _defaultParameterRules)
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, needsAuthentication, nameof(IGetMarkPriceKlinesRest.GetMarkPriceKlinesAsync), _defaultParameterRules, SharedTradingModeSets.Futures)
|
||||
{
|
||||
SupportIntervals = intervals;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetLeverageOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetLeverageRest.GetLeverageAsync), _defaultParameterRules)
|
||||
public GetLeverageOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetLeverageRest.GetLeverageAsync), _defaultParameterRules, SharedTradingModeSets.Futures)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetLeverageTiersOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetLeverageTiersRest.GetLeverageTiersAsync), _defaultParameterRules)
|
||||
public GetLeverageTiersOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetLeverageTiersRest.GetLeverageTiersAsync), _defaultParameterRules, SharedTradingModeSets.Futures)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public SetLeverageOptions(string exchange) : base(exchange, true, nameof(ISetLeverageRest.SetLeverageAsync), _defaultParameterRules)
|
||||
public SetLeverageOptions(string exchange) : base(exchange, true, nameof(ISetLeverageRest.SetLeverageAsync), _defaultParameterRules, SharedTradingModeSets.Futures)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetAllMarkPricesOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetAllMarkPricesRest.GetAllMarkPricesAsync), _defaultParameterRules)
|
||||
public GetAllMarkPricesOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetAllMarkPricesRest.GetAllMarkPricesAsync), _defaultParameterRules, SharedTradingModeSets.Futures)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetMarkPriceOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetMarkPriceRest.GetMarkPriceAsync), _defaultParameterRules)
|
||||
public GetMarkPriceOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetMarkPriceRest.GetMarkPriceAsync), _defaultParameterRules, SharedTradingModeSets.Futures)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -14,15 +14,15 @@ namespace CryptoExchange.Net.SharedApis
|
||||
|
||||
private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
|
||||
{
|
||||
RequestParameterRule<SubscribeMarkPriceRequest>.Optional(x => x.Symbol, "The symbol to subscribe to", new SharedSymbol(TradingMode.Spot, "ETH", "USDT")),
|
||||
RequestParameterRule<SubscribeMarkPriceRequest>.Optional(x => x.Symbols, "The symbols to subscribe to", new[] { new SharedSymbol(TradingMode.Spot, "ETH", "USDT") }),
|
||||
RequestParameterRule<SubscribeMarkPriceRequest>.Optional(x => x.Symbol, "The symbol to subscribe to", new SharedSymbol(TradingMode.PerpetualLinear, "ETH", "USDT")),
|
||||
RequestParameterRule<SubscribeMarkPriceRequest>.Optional(x => x.Symbols, "The symbols to subscribe to", new[] { new SharedSymbol(TradingMode.PerpetualLinear, "ETH", "USDT") }),
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public SubscribeMarkPriceOptions(string exchange, bool needsAuthentication)
|
||||
: base(exchange, needsAuthentication, nameof(ISubscribeMarkPriceSocket.SubscribeToMarkPriceUpdatesAsync), _defaultParameterRules)
|
||||
: base(exchange, needsAuthentication, nameof(ISubscribeMarkPriceSocket.SubscribeToMarkPriceUpdatesAsync), _defaultParameterRules, SharedTradingModeSets.Futures)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetOpenInterestOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetOpenInterestRest.GetOpenInterestAsync), _defaultParameterRules)
|
||||
public GetOpenInterestOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetOpenInterestRest.GetOpenInterestAsync), _defaultParameterRules, SharedTradingModeSets.Futures)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override Error? ValidateRequest(GetOrderBookRequest request, IGetOrderBookRest client)
|
||||
public override Error? ValidateRequest(GetOrderBookRequest request, IGetOrderBook client)
|
||||
{
|
||||
var error = base.ValidateRequest(request, client);
|
||||
if (error != null)
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public CancelAllFuturesOrdersOptions(string exchange) : base(exchange, true, nameof(ICancelAllFuturesOrders.CancelAllFuturesOrdersAsync), _defaultParameterRules)
|
||||
public CancelAllFuturesOrdersOptions(string exchange) : base(exchange, true, nameof(ICancelAllFuturesOrders.CancelAllFuturesOrdersAsync), _defaultParameterRules, SharedTradingModeSets.Futures)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public CancelAllFuturesSymbolOrdersOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ICancelAllFuturesSymbolOrders.CancelAllFuturesSymbolOrdersAsync), _defaultParameterRules)
|
||||
public CancelAllFuturesSymbolOrdersOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ICancelAllFuturesSymbolOrders.CancelAllFuturesSymbolOrdersAsync), _defaultParameterRules, SharedTradingModeSets.Futures)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public CancelFuturesOrderOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ICancelFuturesOrder.CancelFuturesOrderAsync), _defaultParameterRules)
|
||||
public CancelFuturesOrderOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ICancelFuturesOrder.CancelFuturesOrderAsync), _defaultParameterRules, SharedTradingModeSets.Futures)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public CancelFuturesOrderByClientOrderIdOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ICancelFuturesOrderByClientOrderId.CancelFuturesOrderByClientOrderIdAsync), _defaultParameterRules)
|
||||
public CancelFuturesOrderByClientOrderIdOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ICancelFuturesOrderByClientOrderId.CancelFuturesOrderByClientOrderIdAsync), _defaultParameterRules, SharedTradingModeSets.Futures)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public EditFuturesOrderOptions(string exchange) : base(exchange, true, nameof(IEditFuturesOrder.EditFuturesOrderAsync), _defaultParameterRules)
|
||||
public EditFuturesOrderOptions(string exchange) : base(exchange, true, nameof(IEditFuturesOrder.EditFuturesOrderAsync), _defaultParameterRules, SharedTradingModeSets.Futures)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public EditFuturesOrderByClientOrderIdOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IEditFuturesOrderByClientOrderId.EditFuturesOrderByClientOrderIdAsync), _defaultParameterRules)
|
||||
public EditFuturesOrderByClientOrderIdOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IEditFuturesOrderByClientOrderId.EditFuturesOrderByClientOrderIdAsync), _defaultParameterRules, SharedTradingModeSets.Futures)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetFuturesClosedOrdersOptions(string exchange, bool supportsAscending, bool supportsDescending, bool timeFilterSupported, int maxLimit)
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, true, nameof(IGetClosedFuturesOrdersRest.GetClosedFuturesOrdersAsync), _defaultParameterRules)
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, true, nameof(IGetClosedFuturesOrdersRest.GetClosedFuturesOrdersAsync), _defaultParameterRules, SharedTradingModeSets.Futures)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetFuturesOrderOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetFuturesOrder.GetFuturesOrderAsync), _defaultParameterRules)
|
||||
public GetFuturesOrderOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetFuturesOrder.GetFuturesOrderAsync), _defaultParameterRules, SharedTradingModeSets.Futures)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetFuturesOrderByClientOrderIdOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetFuturesOrderByClientOrderId.GetFuturesOrderByClientOrderIdAsync), _defaultParameterRules)
|
||||
public GetFuturesOrderByClientOrderIdOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetFuturesOrderByClientOrderId.GetFuturesOrderByClientOrderIdAsync), _defaultParameterRules, SharedTradingModeSets.Futures)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetOpenFuturesOrdersOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetOpenFuturesOrders.GetOpenFuturesOrdersAsync), _defaultParameterRules)
|
||||
public GetOpenFuturesOrdersOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetOpenFuturesOrders.GetOpenFuturesOrdersAsync), _defaultParameterRules, SharedTradingModeSets.Futures)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public PlaceFuturesOrderOptions(string exchange, bool supportsTpSl) : base(exchange, true, nameof(IPlaceFuturesOrder.PlaceFuturesOrderAsync), _defaultParameterRules)
|
||||
public PlaceFuturesOrderOptions(string exchange, bool supportsTpSl) : base(exchange, true, nameof(IPlaceFuturesOrder.PlaceFuturesOrderAsync), _defaultParameterRules, SharedTradingModeSets.Futures)
|
||||
{
|
||||
SupportsTpSl = supportsTpSl;
|
||||
}
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public PlaceMultipleFuturesOrdersOptions(string exchange)
|
||||
: base(exchange, true, nameof(IPlaceMultipleFuturesOrders.PlaceMultipleFuturesOrdersAsync), _defaultParameterRules)
|
||||
: base(exchange, true, nameof(IPlaceMultipleFuturesOrders.PlaceMultipleFuturesOrdersAsync), _defaultParameterRules, SharedTradingModeSets.Futures)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public SubscribeFuturesOrderOptions(string exchange, bool needsAuthentication) : base(exchange, needsAuthentication, nameof(ISubscribeFuturesOrdersSocket.SubscribeToFuturesOrderUpdatesAsync), _defaultParameterRules)
|
||||
public SubscribeFuturesOrderOptions(string exchange, bool needsAuthentication) : base(exchange, needsAuthentication, nameof(ISubscribeFuturesOrdersSocket.SubscribeToFuturesOrderUpdatesAsync), _defaultParameterRules, SharedTradingModeSets.Futures)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public CancelAllSpotOrdersOptions(string exchange) : base(exchange, true, nameof(ICancelAllSpotOrders.CancelAllSpotOrdersAsync), _defaultParameterRules)
|
||||
public CancelAllSpotOrdersOptions(string exchange) : base(exchange, true, nameof(ICancelAllSpotOrders.CancelAllSpotOrdersAsync), _defaultParameterRules, SharedTradingModeSets.Spot)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public CancelAllSpotSymbolOrdersOptions(string exchange, bool authenticated)
|
||||
: base(exchange, authenticated, nameof(ICancelAllSpotSymbolOrders.CancelAllSpotSymbolOrdersAsync), _defaultParameterRules)
|
||||
: base(exchange, authenticated, nameof(ICancelAllSpotSymbolOrders.CancelAllSpotSymbolOrdersAsync), _defaultParameterRules, SharedTradingModeSets.Spot)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public CancelSpotOrderOptions(string exchange, bool authenticated)
|
||||
: base(exchange, authenticated, nameof(ICancelSpotOrder.CancelSpotOrderAsync), _defaultParameterRules)
|
||||
: base(exchange, authenticated, nameof(ICancelSpotOrder.CancelSpotOrderAsync), _defaultParameterRules, SharedTradingModeSets.Spot)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public CancelSpotOrderByClientOrderIdOptions(string exchange, bool authenticated)
|
||||
: base(exchange, authenticated, nameof(ICancelSpotOrderByClientOrderIdRest.CancelSpotOrderByClientOrderIdAsync), _defaultParameterRules)
|
||||
: base(exchange, authenticated, nameof(ICancelSpotOrderByClientOrderIdRest.CancelSpotOrderByClientOrderIdAsync), _defaultParameterRules, SharedTradingModeSets.Spot)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public EditSpotOrderOptions(string exchange)
|
||||
: base(exchange, true, nameof(IEditSpotOrder.EditSpotOrderAsync), _defaultParameterRules)
|
||||
: base(exchange, true, nameof(IEditSpotOrder.EditSpotOrderAsync), _defaultParameterRules, SharedTradingModeSets.Spot)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -10,7 +10,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
|
||||
private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
|
||||
{
|
||||
RequestParameterRule<EditOrderRequest>.Required(x => x.Symbol, "The symbol of the order to edit", new SharedSymbol(TradingMode.PerpetualLinear, "ETH", "USDT")),
|
||||
RequestParameterRule<EditOrderRequest>.Required(x => x.Symbol, "The symbol of the order to edit", new SharedSymbol(TradingMode.Spot, "ETH", "USDT")),
|
||||
RequestParameterRule<EditOrderRequest>.Required(x => x.OrderId, "The client order id of the order to edit", "123"),
|
||||
RequestParameterRule<EditOrderRequest>.Optional(x => x.Quantity, "The new order quantity", SharedQuantity.Base(1)),
|
||||
RequestParameterRule<EditOrderRequest>.Optional(x => x.Price, "The new order price", 0.1m),
|
||||
@@ -19,7 +19,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public EditSpotOrderByClientOrderIdOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IEditSpotOrderByClientOrderId.EditSpotOrderByClientOrderIdAsync), _defaultParameterRules)
|
||||
public EditSpotOrderByClientOrderIdOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IEditSpotOrderByClientOrderId.EditSpotOrderByClientOrderIdAsync), _defaultParameterRules, SharedTradingModeSets.Spot)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetSpotClosedOrdersOptions(string exchange, bool supportsAscending, bool supportsDescending, bool timeFilterSupported, int maxLimit)
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, true, nameof(IGetClosedSpotOrdersRest.GetClosedSpotOrdersAsync), _defaultParameterRules)
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, true, nameof(IGetClosedSpotOrdersRest.GetClosedSpotOrdersAsync), _defaultParameterRules, SharedTradingModeSets.Spot)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetOpenSpotOrdersOptions(string exchange, bool authenticated)
|
||||
: base(exchange, authenticated, nameof(IGetOpenSpotOrders.GetOpenSpotOrdersAsync), _defaultParameterRules)
|
||||
: base(exchange, authenticated, nameof(IGetOpenSpotOrders.GetOpenSpotOrdersAsync), _defaultParameterRules, SharedTradingModeSets.Spot)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetSpotOrderOptions(string exchange, bool authenticated)
|
||||
: base(exchange, authenticated, nameof(IGetSpotOrder.GetSpotOrderAsync), _defaultParameterRules)
|
||||
: base(exchange, authenticated, nameof(IGetSpotOrder.GetSpotOrderAsync), _defaultParameterRules, SharedTradingModeSets.Spot)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetSpotOrderByClientOrderIdOptions(string exchange, bool authenticated)
|
||||
: base(exchange, authenticated, nameof(IGetSpotOrderByClientOrderIdRest.GetSpotOrderByClientOrderIdAsync), _defaultParameterRules)
|
||||
: base(exchange, authenticated, nameof(IGetSpotOrderByClientOrderIdRest.GetSpotOrderByClientOrderIdAsync), _defaultParameterRules, SharedTradingModeSets.Spot)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public PlaceMultipleSpotOrdersOptions(string exchange)
|
||||
: base(exchange, true, nameof(IPlaceMultipleSpotOrders.PlaceMultipleSpotOrdersAsync), _defaultParameterRules)
|
||||
: base(exchange, true, nameof(IPlaceMultipleSpotOrders.PlaceMultipleSpotOrdersAsync), _defaultParameterRules, SharedTradingModeSets.Spot)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public PlaceSpotOrderOptions(string exchange)
|
||||
: base(exchange, true, nameof(IPlaceSpotOrder.PlaceSpotOrderAsync), _defaultParameterRules)
|
||||
: base(exchange, true, nameof(IPlaceSpotOrder.PlaceSpotOrderAsync), _defaultParameterRules, SharedTradingModeSets.Spot)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public SubscribeSpotOrderOptions(string exchange, bool needsAuthentication)
|
||||
: base(exchange, needsAuthentication, nameof(ISubscribeSpotOrdersSocket.SubscribeToSpotOrderUpdatesAsync), _defaultParameterRules)
|
||||
: base(exchange, needsAuthentication, nameof(ISubscribeSpotOrdersSocket.SubscribeToSpotOrderUpdatesAsync), _defaultParameterRules, SharedTradingModeSets.Spot)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetPositionModeOptions(string exchange) : base(exchange, true, nameof(IGetPositionMode.GetPositionModeAsync), _defaultParameterRules)
|
||||
public GetPositionModeOptions(string exchange) : base(exchange, true, nameof(IGetPositionMode.GetPositionModeAsync), _defaultParameterRules, SharedTradingModeSets.Futures)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public SetPositionModeOptions(string exchange) : base(exchange, true, nameof(ISetPositionMode.SetPositionModeAsync), _defaultParameterRules)
|
||||
public SetPositionModeOptions(string exchange) : base(exchange, true, nameof(ISetPositionMode.SetPositionModeAsync), _defaultParameterRules, SharedTradingModeSets.Futures)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public CloseFullPositionOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ICloseFullPosition.CloseFullPositionAsync), _defaultParameterRules)
|
||||
public CloseFullPositionOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ICloseFullPosition.CloseFullPositionAsync), _defaultParameterRules, SharedTradingModeSets.Futures)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetPositionHistoryOptions(string exchange, bool supportsAscending, bool supportsDescending, bool timeFilterSupported, int maxLimit)
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, true, nameof(IGetPositionHistoryRest.GetPositionHistoryAsync), _defaultParameterRules)
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, true, nameof(IGetPositionHistoryRest.GetPositionHistoryAsync), _defaultParameterRules, SharedTradingModeSets.Futures)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetPositionsOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetPositions.GetPositionsAsync), _defaultParameterRules)
|
||||
public GetPositionsOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetPositions.GetPositionsAsync), _defaultParameterRules, SharedTradingModeSets.Futures)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public SubscribePositionOptions(string exchange, bool needsAuthentication) : base(exchange, needsAuthentication, nameof(ISubscribePositionsSocket.SubscribeToPositionUpdatesAsync), _defaultParameterRules)
|
||||
public SubscribePositionOptions(string exchange, bool needsAuthentication) : base(exchange, needsAuthentication, nameof(ISubscribePositionsSocket.SubscribeToPositionUpdatesAsync), _defaultParameterRules, SharedTradingModeSets.Futures)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetFuturesSymbolsOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetFuturesSymbols.GetFuturesSymbolsAsync), _defaultParameterRules)
|
||||
public GetFuturesSymbolsOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetFuturesSymbols.GetFuturesSymbolsAsync), _defaultParameterRules, SharedTradingModeSets.Futures)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetSpotSymbolsOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetSpotSymbols.GetSpotSymbolsAsync), _defaultParameterRules)
|
||||
public GetSpotSymbolsOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetSpotSymbols.GetSpotSymbolsAsync), _defaultParameterRules, SharedTradingModeSets.Spot)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public CancelFuturesTpSlOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ICancelFuturesTpSl.CancelFuturesTpSlAsync), _defaultParameterRules)
|
||||
public CancelFuturesTpSlOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ICancelFuturesTpSl.CancelFuturesTpSlAsync), _defaultParameterRules, SharedTradingModeSets.Futures)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public SetFuturesTpSlOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ISetFuturesTpSl.SetFuturesTpSlAsync), _defaultParameterRules)
|
||||
public SetFuturesTpSlOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ISetFuturesTpSl.SetFuturesTpSlAsync), _defaultParameterRules, SharedTradingModeSets.Futures)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public CancelFuturesTriggerOrderOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ICancelFuturesTriggerOrder.CancelFuturesTriggerOrderAsync), _defaultParameterRules)
|
||||
public CancelFuturesTriggerOrderOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ICancelFuturesTriggerOrder.CancelFuturesTriggerOrderAsync), _defaultParameterRules, SharedTradingModeSets.Futures)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetFuturesTriggerOrderOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetFuturesTriggerOrder.GetFuturesTriggerOrderAsync), _defaultParameterRules)
|
||||
public GetFuturesTriggerOrderOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetFuturesTriggerOrder.GetFuturesTriggerOrderAsync), _defaultParameterRules, SharedTradingModeSets.Futures)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public PlaceFuturesTriggerOrderOptions(string exchange, bool holdsFunds) : base(exchange, true, nameof(IPlaceFuturesTriggerOrder.PlaceFuturesTriggerOrderAsync), _defaultParameterRules)
|
||||
public PlaceFuturesTriggerOrderOptions(string exchange, bool holdsFunds) : base(exchange, true, nameof(IPlaceFuturesTriggerOrder.PlaceFuturesTriggerOrderAsync), _defaultParameterRules, SharedTradingModeSets.Futures)
|
||||
{
|
||||
HoldsFunds = holdsFunds;
|
||||
}
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public CancelSpotTriggerOrderOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ICancelSpotTriggerOrder.CancelSpotTriggerOrderAsync), _defaultParameterRules)
|
||||
public CancelSpotTriggerOrderOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(ICancelSpotTriggerOrder.CancelSpotTriggerOrderAsync), _defaultParameterRules, SharedTradingModeSets.Spot)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -22,12 +22,12 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetSpotTriggerOrderOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetSpotTriggerOrder.GetSpotTriggerOrderAsync), _defaultParameterRules)
|
||||
public GetSpotTriggerOrderOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetSpotTriggerOrder.GetSpotTriggerOrderAsync), _defaultParameterRules, SharedTradingModeSets.Spot)
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override Error? ValidateRequest(GetOrderRequest request, IGetSpotTriggerOrderRest client)
|
||||
public override Error? ValidateRequest(GetOrderRequest request, IGetSpotTriggerOrder client)
|
||||
{
|
||||
var error = base.ValidateRequest(request, client);
|
||||
if (error != null)
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public PlaceSpotTriggerOrderOptions(string exchange, bool holdsFunds) : base(exchange, true, nameof(IPlaceSpotTriggerOrder.PlaceSpotTriggerOrderAsync), _defaultParameterRules)
|
||||
public PlaceSpotTriggerOrderOptions(string exchange, bool holdsFunds) : base(exchange, true, nameof(IPlaceSpotTriggerOrder.PlaceSpotTriggerOrderAsync), _defaultParameterRules, SharedTradingModeSets.Spot)
|
||||
{
|
||||
HoldsFunds = holdsFunds;
|
||||
}
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetFuturesOrderTradesOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetFuturesOrderTrades.GetFuturesOrderTradesAsync), _defaultParameterRules)
|
||||
public GetFuturesOrderTradesOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetFuturesOrderTrades.GetFuturesOrderTradesAsync), _defaultParameterRules, SharedTradingModeSets.Futures)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetFuturesUserTradeHistoryOptions(string exchange, bool supportsAscending, bool supportsDescending, bool timeFilterSupported, int maxLimit)
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, true, nameof(IGetFuturesUserTradeHistoryRest.GetFuturesUserTradeHistoryAsync), _defaultParameterRules)
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, true, nameof(IGetFuturesUserTradeHistoryRest.GetFuturesUserTradeHistoryAsync), _defaultParameterRules, SharedTradingModeSets.Futures)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetSpotOrderTradesOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetSpotOrderTrades.GetSpotOrderTradesAsync), _defaultParameterRules)
|
||||
public GetSpotOrderTradesOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IGetSpotOrderTrades.GetSpotOrderTradesAsync), _defaultParameterRules, SharedTradingModeSets.Spot)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public GetSpotUserTradeHistoryOptions(string exchange, bool supportsAscending, bool supportsDescending, bool timeFilterSupported, int maxLimit)
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, true, nameof(IGetSpotUserTradeHistoryRest.GetSpotUserTradeHistoryAsync), _defaultParameterRules)
|
||||
: base(exchange, supportsAscending, supportsDescending, timeFilterSupported, maxLimit, true, nameof(IGetSpotUserTradeHistoryRest.GetSpotUserTradeHistoryAsync), _defaultParameterRules, SharedTradingModeSets.Spot)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user