mirror of
https://github.com/JKorf/CryptoExchange.Net.git
synced 2026-10-14 15:11:44 +00:00
wip
This commit is contained in:
@@ -0,0 +1,89 @@
|
||||
using CryptoExchange.Net.SharedApis;
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
namespace CryptoExchange.Net.UnitTests
|
||||
{
|
||||
[TestFixture]
|
||||
internal class SharedCapabilitiesTests
|
||||
{
|
||||
[Test]
|
||||
public void AllSharedApiCapabilities_ShouldBeListedInSharedCapabilities()
|
||||
{
|
||||
var markerTypes = new[]
|
||||
{
|
||||
typeof(ISharedApiCapability),
|
||||
typeof(ISharedRest),
|
||||
typeof(ISharedSocket),
|
||||
typeof(ISharedSubscription)
|
||||
};
|
||||
|
||||
var expectedCapabilities = typeof(ISharedApiCapability).Assembly
|
||||
.GetTypes()
|
||||
.Where(x => x.IsInterface
|
||||
&& typeof(ISharedApiCapability).IsAssignableFrom(x)
|
||||
&& !markerTypes.Contains(x))
|
||||
.OrderBy(x => x.FullName)
|
||||
.ToArray();
|
||||
|
||||
var listedCapabilities = GetTypeAndNestedTypes(typeof(SharedCapabilities))
|
||||
.SelectMany(x => x.GetProperties(
|
||||
BindingFlags.Public | BindingFlags.Static | BindingFlags.DeclaredOnly))
|
||||
.SelectMany(x => x.PropertyType.GetGenericArguments())
|
||||
.Where(x => x.IsInterface
|
||||
&& typeof(ISharedApiCapability).IsAssignableFrom(x))
|
||||
.ToArray();
|
||||
|
||||
var missingCapabilities = expectedCapabilities
|
||||
.Except(listedCapabilities)
|
||||
.Select(x => x.Name)
|
||||
.ToArray();
|
||||
|
||||
var unknownCapabilities = listedCapabilities
|
||||
.Except(expectedCapabilities)
|
||||
.Select(x => x.Name)
|
||||
.ToArray();
|
||||
|
||||
var duplicateCapabilities = listedCapabilities
|
||||
.GroupBy(x => x)
|
||||
.Where(x => x.Count() > 1)
|
||||
.Select(x => x.Key.Name)
|
||||
.ToArray();
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(
|
||||
missingCapabilities,
|
||||
Is.Empty,
|
||||
$"Capabilities missing from SharedCapabilities: " +
|
||||
string.Join(", ", missingCapabilities));
|
||||
|
||||
Assert.That(
|
||||
unknownCapabilities,
|
||||
Is.Empty,
|
||||
$"Unknown capabilities listed in SharedCapabilities: " +
|
||||
string.Join(", ", unknownCapabilities));
|
||||
|
||||
Assert.That(
|
||||
duplicateCapabilities,
|
||||
Is.Empty,
|
||||
$"Capabilities listed multiple times in SharedCapabilities: " +
|
||||
string.Join(", ", duplicateCapabilities));
|
||||
});
|
||||
}
|
||||
|
||||
private static IEnumerable<Type> GetTypeAndNestedTypes(Type type)
|
||||
{
|
||||
yield return type;
|
||||
|
||||
foreach (var nestedType in type.GetNestedTypes(BindingFlags.Public))
|
||||
{
|
||||
foreach (var result in GetTypeAndNestedTypes(nestedType))
|
||||
yield return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
/// <summary>
|
||||
/// Catalog of Shared API capability references.
|
||||
/// </summary>
|
||||
public partial class SharedCapabilities
|
||||
{
|
||||
/// <summary>
|
||||
/// Asset capabilities.
|
||||
/// </summary>
|
||||
public static class Assets
|
||||
{
|
||||
/// <summary>
|
||||
/// Get asset capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IGetAsset, IGetAssetRest> GetAsset { get; } = new();
|
||||
/// <summary>
|
||||
/// Get all assets capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IGetAllAssets, IGetAllAssetsRest> GetAllAssets { get; } = new();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
public partial class SharedCapabilities
|
||||
{
|
||||
/// <summary>
|
||||
/// Balance capabilities.
|
||||
/// </summary>
|
||||
public static class Balances
|
||||
{
|
||||
/// <summary>
|
||||
/// Get balances capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IGetBalances, IGetBalancesRest> GetBalances { get; } = new();
|
||||
/// <summary>
|
||||
/// Subscribe to balance updates capability.
|
||||
/// </summary>
|
||||
public static SharedCapabilityReference<ISubscribeBalancesSocket> SubscribeBalances { get; } = new();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
public partial class SharedCapabilities
|
||||
{
|
||||
/// <summary>
|
||||
/// Deposit capabilities.
|
||||
/// </summary>
|
||||
public static class Deposits
|
||||
{
|
||||
/// <summary>
|
||||
/// Get deposit addresses capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IGetDepositAddresses, IGetDepositAddressesRest> GetDepositAddresses { get; } = new();
|
||||
/// <summary>
|
||||
/// Get deposit history capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IGetDepositHistory, IGetDepositHistoryRest> GetDepositHistory { get; } = new();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
public partial class SharedCapabilities
|
||||
{
|
||||
/// <summary>
|
||||
/// Fee capabilities.
|
||||
/// </summary>
|
||||
public static class Fees
|
||||
{
|
||||
/// <summary>
|
||||
/// Get fees capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IGetFees, IGetFeesRest> GetFees { get; } = new();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
public partial class SharedCapabilities
|
||||
{
|
||||
/// <summary>
|
||||
/// Funding capabilities.
|
||||
/// </summary>
|
||||
public static class Funding
|
||||
{
|
||||
/// <summary>
|
||||
/// Get current funding information capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IGetFundingInfo, IGetFundingInfoRest> GetFundingInfo { get; } = new();
|
||||
/// <summary>
|
||||
/// Get funding rate history capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IGetFundingRateHistory, IGetFundingRateHistoryRest> GetFundingRateHistory { get; } = new();
|
||||
/// <summary>
|
||||
/// Get user funding history capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IGetUserFundingHistory, IGetUserFundingHistoryRest> GetUserFundingHistory { get; } = new();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
public partial class SharedCapabilities
|
||||
{
|
||||
/// <summary>
|
||||
/// Index price capabilities.
|
||||
/// </summary>
|
||||
public static class IndexPrices
|
||||
{
|
||||
/// <summary>
|
||||
/// Get an index price capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IGetIndexPrice, IGetIndexPriceRest> GetIndexPrice { get; } = new();
|
||||
/// <summary>
|
||||
/// Get all index prices capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IGetAllIndexPrices, IGetAllIndexPricesRest> GetAllIndexPrices { get; } = new();
|
||||
/// <summary>
|
||||
/// Subscribe to index price updates capability.
|
||||
/// </summary>
|
||||
public static SharedCapabilityReference<ISubscribeIndexPriceSocket> SubscribeIndexPrice { get; } = new();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
public partial class SharedCapabilities
|
||||
{
|
||||
/// <summary>
|
||||
/// Kline capabilities.
|
||||
/// </summary>
|
||||
public static class Klines
|
||||
{
|
||||
/// <summary>
|
||||
/// Get klines capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IGetKlines, IGetKlinesRest> GetKlines { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Get mark price klines capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IGetMarkPriceKlines, IGetMarkPriceKlinesRest> GetMarkPriceKlines { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Get index price klines capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IGetIndexPriceKlines, IGetIndexPriceKlinesRest> GetIndexPriceKlines { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Subscribe to kline updates capability.
|
||||
/// </summary>
|
||||
public static SharedCapabilityReference<ISubscribeKlinesSocket> SubscribeKlines { get; } = new();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
public partial class SharedCapabilities
|
||||
{
|
||||
/// <summary>
|
||||
/// Ledger capabilities.
|
||||
/// </summary>
|
||||
public static class Ledger
|
||||
{
|
||||
/// <summary>
|
||||
/// Get ledger entries capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IGetLedger, IGetLedgerRest> GetLedger { get; } = new();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
public partial class SharedCapabilities
|
||||
{
|
||||
/// <summary>
|
||||
/// Leverage capabilities.
|
||||
/// </summary>
|
||||
public static class Leverage
|
||||
{
|
||||
/// <summary>
|
||||
/// Get leverage capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IGetLeverage, IGetLeverageRest> GetLeverage { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Set leverage capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<ISetLeverage, ISetLeverageRest> SetLeverage { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Get leverage tiers capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IGetLeverageTiers, IGetLeverageTiersRest> GetLeverageTiers { get; } = new();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
public partial class SharedCapabilities
|
||||
{
|
||||
/// <summary>
|
||||
/// Mark price capabilities.
|
||||
/// </summary>
|
||||
public static class MarkPrices
|
||||
{
|
||||
/// <summary>
|
||||
/// Get a mark price capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IGetMarkPrice, IGetMarkPriceRest> GetMarkPrice { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Get all mark prices capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IGetAllMarkPrices, IGetAllMarkPricesRest> GetAllMarkPrices { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Subscribe to mark price updates capability.
|
||||
/// </summary>
|
||||
public static SharedCapabilityReference<ISubscribeMarkPriceSocket> SubscribeMarkPrice { get; } = new();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
public partial class SharedCapabilities
|
||||
{
|
||||
/// <summary>
|
||||
/// Open interest capabilities.
|
||||
/// </summary>
|
||||
public static class OpenInterest
|
||||
{
|
||||
/// <summary>
|
||||
/// Get open interest capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IGetOpenInterest, IGetOpenInterestRest> GetOpenInterest { get; } = new();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
public partial class SharedCapabilities
|
||||
{
|
||||
/// <summary>
|
||||
/// Order book capabilities.
|
||||
/// </summary>
|
||||
public static class OrderBooks
|
||||
{
|
||||
/// <summary>
|
||||
/// Get an order book capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IGetOrderBook, IGetOrderBookRest> GetOrderBook { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Get a book ticker capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IGetBookTicker, IGetBookTickerRest> GetBookTicker { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Subscribe to order book updates capability.
|
||||
/// </summary>
|
||||
public static SharedCapabilityReference<ISubscribeOrderBookSocket> SubscribeOrderBook { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Subscribe to incremental order book updates capability.
|
||||
/// </summary>
|
||||
public static SharedCapabilityReference<ISubscribeIncrementalOrderBookSocket> SubscribeIncrementalOrderBook { get; } = new();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
public partial class SharedCapabilities
|
||||
{
|
||||
/// <summary>
|
||||
/// Order capabilities.
|
||||
/// </summary>
|
||||
public static class Orders
|
||||
{
|
||||
/// <summary>
|
||||
/// Spot order capabilities.
|
||||
/// </summary>
|
||||
public static class Spot
|
||||
{
|
||||
/// <summary>
|
||||
/// Place a spot order capability.
|
||||
/// </summary>
|
||||
public static SharedRestSocketCapability<IPlaceSpotOrder, IPlaceSpotOrderRest, IPlaceSpotOrderSocket> PlaceOrder { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Place multiple spot orders capability.
|
||||
/// </summary>
|
||||
public static SharedRestSocketCapability<IPlaceMultipleSpotOrders, IPlaceMultipleSpotOrdersRest, IPlaceMultipleSpotOrdersSocket> PlaceMultipleOrders { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Edit a spot order capability.
|
||||
/// </summary>
|
||||
public static SharedRestSocketCapability<IEditSpotOrder, IEditSpotOrderRest, IEditSpotOrderSocket> EditOrder { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Edit a spot order by client order id capability.
|
||||
/// </summary>
|
||||
public static SharedRestSocketCapability<IEditSpotOrderByClientOrderId, IEditSpotOrderByClientOrderIdRest, IEditSpotOrderByClientOrderIdSocket> EditOrderByClientOrderId { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Cancel a spot order capability.
|
||||
/// </summary>
|
||||
public static SharedRestSocketCapability<ICancelSpotOrder, ICancelSpotOrderRest, ICancelSpotOrderSocket> CancelOrder { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Cancel a spot order by client order id capability.
|
||||
/// </summary>
|
||||
public static SharedRestSocketCapability<ICancelSpotOrderByClientOrderId, ICancelSpotOrderByClientOrderIdRest, ICancelSpotOrderByClientOrderIdSocket> CancelOrderByClientOrderId { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Cancel all spot orders capability.
|
||||
/// </summary>
|
||||
public static SharedRestSocketCapability<ICancelAllSpotOrders, ICancelAllSpotOrdersRest, ICancelAllSpotOrdersSocket> CancelAllOrders { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Cancel all spot orders for a symbol capability.
|
||||
/// </summary>
|
||||
public static SharedRestSocketCapability<ICancelAllSpotSymbolOrders, ICancelAllSpotSymbolOrdersRest, ICancelAllSpotSymbolOrdersSocket> CancelAllSymbolOrders { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Get a spot order capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IGetSpotOrder, IGetSpotOrderRest> GetOrder { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Get a spot order by client order id capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IGetSpotOrderByClientOrderId, IGetSpotOrderByClientOrderIdRest> GetOrderByClientOrderId { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Get open spot orders capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IGetOpenSpotOrders, IGetOpenSpotOrdersRest> GetOpenOrders { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Get closed spot orders capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IGetClosedSpotOrders, IGetClosedSpotOrdersRest> GetClosedOrders { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Subscribe to spot order updates capability.
|
||||
/// </summary>
|
||||
public static SharedCapabilityReference<ISubscribeSpotOrdersSocket> SubscribeOrders { get; } = new();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Futures order capabilities.
|
||||
/// </summary>
|
||||
public static class Futures
|
||||
{
|
||||
/// <summary>
|
||||
/// Place a futures order capability.
|
||||
/// </summary>
|
||||
public static SharedRestSocketCapability<IPlaceFuturesOrder, IPlaceFuturesOrderRest, IPlaceFuturesOrderSocket> PlaceOrder { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Place multiple futures orders capability.
|
||||
/// </summary>
|
||||
public static SharedRestSocketCapability<IPlaceMultipleFuturesOrders, IPlaceMultipleFuturesOrdersRest, IPlaceMultipleFuturesOrdersSocket> PlaceMultipleOrders { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Edit a futures order capability.
|
||||
/// </summary>
|
||||
public static SharedRestSocketCapability<IEditFuturesOrder, IEditFuturesOrderRest, IEditFuturesOrderSocket> EditOrder { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Edit a futures order by client order id capability.
|
||||
/// </summary>
|
||||
public static SharedRestSocketCapability<IEditFuturesOrderByClientOrderId, IEditFuturesOrderByClientOrderIdRest, IEditFuturesOrderByClientOrderIdSocket> EditOrderByClientOrderId { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Cancel a futures order capability.
|
||||
/// </summary>
|
||||
public static SharedRestSocketCapability<ICancelFuturesOrder, ICancelFuturesOrderRest, ICancelFuturesOrderSocket> CancelOrder { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Cancel a futures order by client order id capability.
|
||||
/// </summary>
|
||||
public static SharedRestSocketCapability<ICancelFuturesOrderByClientOrderId, ICancelFuturesOrderByClientOrderIdRest, ICancelFuturesOrderByClientOrderIdSocket> CancelOrderByClientOrderId { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Cancel all futures orders capability.
|
||||
/// </summary>
|
||||
public static SharedRestSocketCapability<ICancelAllFuturesOrders, ICancelAllFuturesOrdersRest, ICancelAllFuturesOrdersSocket> CancelAllOrders { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Cancel all futures orders for a symbol capability.
|
||||
/// </summary>
|
||||
public static SharedRestSocketCapability<ICancelAllFuturesSymbolOrders, ICancelAllFuturesSymbolOrdersRest, ICancelAllFuturesSymbolOrdersSocket> CancelAllSymbolOrders { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Get a futures order capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IGetFuturesOrder, IGetFuturesOrderRest> GetOrder { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Get a futures order by client order id capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IGetFuturesOrderByClientOrderId, IGetFuturesOrderByClientOrderIdRest> GetOrderByClientOrderId { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Get open futures orders capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IGetOpenFuturesOrders, IGetOpenFuturesOrdersRest> GetOpenOrders { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Get closed futures orders capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IGetClosedFuturesOrders, IGetClosedFuturesOrdersRest> GetClosedOrders { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Subscribe to futures order updates capability.
|
||||
/// </summary>
|
||||
public static SharedCapabilityReference<ISubscribeFuturesOrdersSocket> SubscribeOrders { get; } = new();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
public partial class SharedCapabilities
|
||||
{
|
||||
/// <summary>
|
||||
/// Position mode capabilities.
|
||||
/// </summary>
|
||||
public static class PositionMode
|
||||
{
|
||||
/// <summary>
|
||||
/// Get position mode capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IGetPositionMode, IGetPositionModeRest> GetPositionMode { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Set position mode capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<ISetPositionMode, ISetPositionModeRest> SetPositionMode { get; } = new();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
public partial class SharedCapabilities
|
||||
{
|
||||
/// <summary>
|
||||
/// Position capabilities.
|
||||
/// </summary>
|
||||
public static class Positions
|
||||
{
|
||||
/// <summary>
|
||||
/// Get positions capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IGetPositions, IGetPositionsRest> GetPositions { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Get position history capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IGetPositionHistory, IGetPositionHistoryRest> GetPositionHistory { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Close a full position capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<ICloseFullPosition, ICloseFullPositionRest> CloseFullPosition { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Subscribe to position updates capability.
|
||||
/// </summary>
|
||||
public static SharedCapabilityReference<ISubscribePositionsSocket> SubscribePositions { get; } = new();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
public partial class SharedCapabilities
|
||||
{
|
||||
/// <summary>
|
||||
/// Symbol capabilities.
|
||||
/// </summary>
|
||||
public static class Symbols
|
||||
{
|
||||
/// <summary>
|
||||
/// Get spot symbols capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IGetSpotSymbols, IGetSpotSymbolsRest> GetSpotSymbols { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Get futures symbols capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IGetFuturesSymbols, IGetFuturesSymbolsRest> GetFuturesSymbols { get; } = new();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
public partial class SharedCapabilities
|
||||
{
|
||||
/// <summary>
|
||||
/// Ticker capabilities.
|
||||
/// </summary>
|
||||
public static class Tickers
|
||||
{
|
||||
/// <summary>
|
||||
/// Get a ticker capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IGetTicker, IGetTickerRest> GetTicker { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Get all tickers capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IGetAllTickers, IGetAllTickersRest> GetAllTickers { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Subscribe to ticker updates capability.
|
||||
/// </summary>
|
||||
public static SharedCapabilityReference<ISubscribeTickerSocket> SubscribeTicker { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Subscribe to all ticker updates capability.
|
||||
/// </summary>
|
||||
public static SharedCapabilityReference<ISubscribeAllTickersSocket> SubscribeAllTickers { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Subscribe to book ticker updates capability.
|
||||
/// </summary>
|
||||
public static SharedCapabilityReference<ISubscribeBookTickerSocket> SubscribeBookTicker { get; } = new();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
public partial class SharedCapabilities
|
||||
{
|
||||
/// <summary>
|
||||
/// Take profit and stop loss capabilities.
|
||||
/// </summary>
|
||||
public static class TpSl
|
||||
{
|
||||
/// <summary>
|
||||
/// Set futures take profit or stop loss capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<ISetFuturesTpSl, ISetFuturesTpSlRest> SetFuturesTpSl { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Cancel futures take profit or stop loss capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<ICancelFuturesTpSl, ICancelFuturesTpSlRest> CancelFuturesTpSl { get; } = new();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
public partial class SharedCapabilities
|
||||
{
|
||||
/// <summary>
|
||||
/// Public trade capabilities.
|
||||
/// </summary>
|
||||
public static class Trades
|
||||
{
|
||||
/// <summary>
|
||||
/// Get recent trades capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IGetRecentTrades, IGetRecentTradesRest> GetRecentTrades { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Get trade history capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IGetTradeHistory, IGetTradeHistoryRest> GetTradeHistory { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Subscribe to trade updates capability.
|
||||
/// </summary>
|
||||
public static SharedCapabilityReference<ISubscribeTradesSocket> SubscribeTrades { get; } = new();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
public partial class SharedCapabilities
|
||||
{
|
||||
/// <summary>
|
||||
/// Transfer capabilities.
|
||||
/// </summary>
|
||||
public static class Transfers
|
||||
{
|
||||
/// <summary>
|
||||
/// Transfer assets capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<ITransfer, ITransferRest> Transfer { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Get transfer history capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IGetTransferHistory, IGetTransferHistoryRest> GetTransferHistory { get; } = new();
|
||||
}
|
||||
}
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
public partial class SharedCapabilities
|
||||
{
|
||||
/// <summary>
|
||||
/// Trigger order capabilities.
|
||||
/// </summary>
|
||||
public static class TriggerOrders
|
||||
{
|
||||
/// <summary>
|
||||
/// Spot trigger order capabilities.
|
||||
/// </summary>
|
||||
public static class Spot
|
||||
{
|
||||
/// <summary>
|
||||
/// Place a spot trigger order capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IPlaceSpotTriggerOrder, IPlaceSpotTriggerOrderRest> PlaceOrder { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Get a spot trigger order capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IGetSpotTriggerOrder, IGetSpotTriggerOrderRest> GetOrder { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Cancel a spot trigger order capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<ICancelSpotTriggerOrder, ICancelSpotTriggerOrderRest> CancelOrder { get; } = new();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Futures trigger order capabilities.
|
||||
/// </summary>
|
||||
public static class Futures
|
||||
{
|
||||
/// <summary>
|
||||
/// Place a futures trigger order capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IPlaceFuturesTriggerOrder, IPlaceFuturesTriggerOrderRest> PlaceOrder { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Get a futures trigger order capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IGetFuturesTriggerOrder, IGetFuturesTriggerOrderRest> GetOrder { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Cancel a futures trigger order capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<ICancelFuturesTriggerOrder, ICancelFuturesTriggerOrderRest> CancelOrder { get; } = new();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
public partial class SharedCapabilities
|
||||
{
|
||||
/// <summary>
|
||||
/// User trade capabilities.
|
||||
/// </summary>
|
||||
public static class UserTrades
|
||||
{
|
||||
/// <summary>
|
||||
/// Get trades for a spot order capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IGetSpotOrderTrades, IGetSpotOrderTradesRest> GetSpotOrderTrades { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Get spot user trade history capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IGetSpotUserTradeHistory, IGetSpotUserTradeHistoryRest> GetSpotTradeHistory { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Get trades for a futures order capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IGetFuturesOrderTrades, IGetFuturesOrderTradesRest> GetFuturesOrderTrades { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Get futures user trade history capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IGetFuturesUserTradeHistory, IGetFuturesUserTradeHistoryRest> GetFuturesTradeHistory { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Subscribe to user trade updates capability.
|
||||
/// </summary>
|
||||
public static SharedCapabilityReference<ISubscribeUserTradesSocket> SubscribeUserTrades { get; } = new();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
public partial class SharedCapabilities
|
||||
{
|
||||
/// <summary>
|
||||
/// Withdrawal capabilities.
|
||||
/// </summary>
|
||||
public static class Withdrawals
|
||||
{
|
||||
/// <summary>
|
||||
/// Withdraw assets capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IWithdraw, IWithdrawRest> Withdraw { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Get withdrawal history capability.
|
||||
/// </summary>
|
||||
public static SharedRestCapability<IGetWithdrawalHistory, IGetWithdrawalHistoryRest> GetWithdrawalHistory { get; } = new();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
/// <summary>
|
||||
/// Strongly typed reference to a Shared API capability.
|
||||
/// </summary>
|
||||
public class SharedCapabilityReference<T>
|
||||
where T : ISharedApiCapability
|
||||
{
|
||||
/// <summary>
|
||||
/// Capability interface type.
|
||||
/// </summary>
|
||||
public Type CapabilityType => typeof(T);
|
||||
|
||||
internal SharedCapabilityReference()
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string ToString() => typeof(T).Name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
/// <summary>
|
||||
/// References for a capability available through REST.
|
||||
/// </summary>
|
||||
public sealed class SharedRestCapability<TCapability, TRest>
|
||||
where TCapability : ISharedApiCapability
|
||||
where TRest : TCapability, ISharedRest
|
||||
{
|
||||
/// <summary>
|
||||
/// Transport-agnostic capability.
|
||||
/// </summary>
|
||||
public SharedCapabilityReference<TCapability> Any { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// REST capability.
|
||||
/// </summary>
|
||||
public SharedCapabilityReference<TRest> Rest { get; } = new();
|
||||
|
||||
internal SharedRestCapability()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
/// <summary>
|
||||
/// References for a capability available through REST and WebSocket.
|
||||
/// </summary>
|
||||
public sealed class SharedRestSocketCapability<TCapability, TRest, TSocket>
|
||||
: SharedCapabilityReference<TCapability>
|
||||
where TCapability : ISharedApiCapability
|
||||
where TRest : TCapability, ISharedRest
|
||||
where TSocket : TCapability, ISharedSocket
|
||||
{
|
||||
/// <summary>
|
||||
/// REST capability.
|
||||
/// </summary>
|
||||
public SharedCapabilityReference<TRest> Rest { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// WebSocket capability.
|
||||
/// </summary>
|
||||
public SharedCapabilityReference<TSocket> Socket { get; } = new();
|
||||
|
||||
internal SharedRestSocketCapability()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
/// <summary>
|
||||
/// Base interface for Shared API clients
|
||||
/// </summary>
|
||||
public interface ISharedApiClientBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Get all capabilities matching the provided capability type.
|
||||
/// Example:
|
||||
/// <code>client.GetCapability<IPlaceSpotOrder>()</code>
|
||||
/// </summary>
|
||||
/// <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)
|
||||
where T : ISharedApiCapability;
|
||||
|
||||
/// <summary>
|
||||
/// Get the requested capability type. If more than one implementation is available the first one is returned.
|
||||
/// In this case prefer using <see cref="GetCapability{T}(TradingMode, SharedTransport?)"/> to select a specific trading mode.
|
||||
/// Example:
|
||||
/// <code>client.GetCapability<IPlaceSpotOrder>(SharedTransport.Socket)</code>
|
||||
/// </summary>
|
||||
/// <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)
|
||||
where T : ISharedApiCapability;
|
||||
|
||||
/// <summary>
|
||||
/// Get the requested capability type for a specific trading mode.
|
||||
/// Example:
|
||||
/// <code>client.GetCapability<IPlaceFuturesOrder>(TradingMode.PerpetualLinear, SharedTransport.Rest)</code>
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The capability type</typeparam>
|
||||
/// <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)
|
||||
where T : ISharedApiCapability;
|
||||
|
||||
/// <summary>
|
||||
/// Get the capability matching the provided capability reference. Get a capability reference using <see cref="SharedCapabilities"/>.
|
||||
/// If more than one implementation is available the first one is returned.<br />
|
||||
/// Example:
|
||||
/// <code>client.GetCapability(SharedCapabilities.Orders.Spot.PlaceOrder.Rest)</code>
|
||||
/// </summary>
|
||||
/// <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)
|
||||
where T : ISharedApiCapability;
|
||||
|
||||
/// <summary>
|
||||
/// Get the capability matching the provided capability reference for a specific trading mode. Get a capability reference using <see cref="SharedCapabilities"/>.
|
||||
/// If more than one implementation is available the first one is returned.<br />
|
||||
/// Example:
|
||||
/// <code>client.GetCapability(SharedCapabilities.Orders.Futures.PlaceOrder.Rest, TradingMode.PerpetualLinear)</code>
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The capability type</typeparam>
|
||||
/// <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)
|
||||
where T : ISharedApiCapability;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Base client for Shared API clients
|
||||
/// </summary>
|
||||
public abstract class SharedApiClientBase : ISharedApiClientBase
|
||||
{
|
||||
private readonly ISharedApiCapability[] _sharedApis;
|
||||
private readonly SharedTransport[] _preferredTransports;
|
||||
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public SharedApiClientBase(SharedTransport[] transportPref, params ISharedApiCapability[] allCapabilities)
|
||||
{
|
||||
_preferredTransports = transportPref;
|
||||
_sharedApis = allCapabilities.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)
|
||||
where T : ISharedApiCapability
|
||||
{
|
||||
return GetCapabilityCore<T>(null, transport);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public T? GetCapability<T>(TradingMode tradingMode, SharedTransport? transport = null)
|
||||
where T : ISharedApiCapability
|
||||
{
|
||||
return GetCapabilityCore<T>(tradingMode, transport);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public T? GetCapability<T>(SharedCapabilityReference<T> capability)
|
||||
where T : ISharedApiCapability
|
||||
{
|
||||
return GetCapabilityCore<T>(null, null);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public 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
|
||||
{
|
||||
var implementations = _sharedApis
|
||||
.OfType<T>()
|
||||
.Where(x => tradingMode == null
|
||||
|| x.SupportedTradingModes.Contains(tradingMode.Value))
|
||||
.ToArray();
|
||||
|
||||
foreach (var transport in selectedTransport != null ? new[] { selectedTransport! } : _preferredTransports)
|
||||
{
|
||||
var matching = implementations
|
||||
.Where(x => x.Transport == transport)
|
||||
.ToArray();
|
||||
|
||||
if (matching.Length > 0)
|
||||
return matching[0];
|
||||
}
|
||||
|
||||
return default;
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
-1
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
@@ -31,6 +32,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// ctor
|
||||
/// </summary>
|
||||
/// <param name="symbols">The symbols to subscribe to</param>
|
||||
[Obsolete("Use SubscribeIndexPriceRequest(IEnumerable<SharedSymbol> symbols, ExchangeParameters? exchangeParameters = null) instead")]
|
||||
public SubscribeIndexPriceRequest(params SharedSymbol[] symbols) : base(symbols, null)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
@@ -41,6 +42,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// </summary>
|
||||
/// <param name="interval">Kline interval</param>
|
||||
/// <param name="symbols">The symbols to subscribe to</param>
|
||||
[Obsolete("Use SubscribeKlineRequest(IEnumerable<SharedSymbol> symbols, ExchangeParameters? exchangeParameters = null) instead")]
|
||||
public SubscribeKlineRequest(SharedKlineInterval interval, params SharedSymbol[] symbols) : base(symbols, null)
|
||||
{
|
||||
Interval = interval;
|
||||
|
||||
+3
-1
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
@@ -31,6 +32,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// ctor
|
||||
/// </summary>
|
||||
/// <param name="symbols">The symbols to subscribe to</param>
|
||||
[Obsolete("Use SubscribeMarkPriceRequest(IEnumerable<SharedSymbol> symbols, ExchangeParameters? exchangeParameters = null) instead")]
|
||||
public SubscribeMarkPriceRequest(params SharedSymbol[] symbols) : base(symbols, null)
|
||||
{
|
||||
}
|
||||
|
||||
+3
-1
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
@@ -38,6 +39,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// ctor
|
||||
/// </summary>
|
||||
/// <param name="symbols">The symbols to subscribe to</param>
|
||||
[Obsolete("Use SubscribeOrderBookRequest(IEnumerable<SharedSymbol> symbols, ExchangeParameters? exchangeParameters = null) instead")]
|
||||
public SubscribeOrderBookRequest(params SharedSymbol[] symbols) : base(symbols, null)
|
||||
{
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
/// <summary>
|
||||
/// Request to place a new spot order
|
||||
/// Request to edit an order
|
||||
/// </summary>
|
||||
public record EditSpotOrderRequest : SharedSymbolRequest
|
||||
public record EditOrderRequest : SharedSymbolRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Order id
|
||||
@@ -26,7 +26,7 @@
|
||||
/// <param name="quantity">New quantity of the order</param>
|
||||
/// <param name="price">New price of the order</param>
|
||||
/// <param name="exchangeParameters">Exchange specific parameters</param>
|
||||
public EditSpotOrderRequest(
|
||||
public EditOrderRequest(
|
||||
SharedSymbol symbol,
|
||||
string orderId,
|
||||
SharedQuantity? quantity = null,
|
||||
+5
-5
@@ -7,17 +7,17 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for editing an open Futures order
|
||||
/// </summary>
|
||||
public class EditFuturesOrderOptions : CapabilityOptions<EditFuturesOrderRequest, IEditFuturesOrder>
|
||||
public class EditFuturesOrderOptions : CapabilityOptions<EditOrderRequest, IEditFuturesOrder>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Edit an existing Futures order";
|
||||
|
||||
private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
|
||||
{
|
||||
RequestParameterRule<EditFuturesOrderRequest>.Required(x => x.Symbol, "The symbol of the order to edit", new SharedSymbol(TradingMode.PerpetualLinear, "ETH", "USDT")),
|
||||
RequestParameterRule<EditFuturesOrderRequest>.Required(x => x.OrderId, "The id of the order to edit", "123"),
|
||||
RequestParameterRule<EditFuturesOrderRequest>.Optional(x => x.Quantity, "The new order quantity", SharedQuantity.Base(1)),
|
||||
RequestParameterRule<EditFuturesOrderRequest>.Optional(x => x.Price, "The new order price", 0.1m),
|
||||
RequestParameterRule<EditOrderRequest>.Required(x => x.Symbol, "The symbol of the order to edit", new SharedSymbol(TradingMode.PerpetualLinear, "ETH", "USDT")),
|
||||
RequestParameterRule<EditOrderRequest>.Required(x => x.OrderId, "The 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),
|
||||
};
|
||||
|
||||
|
||||
|
||||
-41
@@ -1,41 +0,0 @@
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
/// <summary>
|
||||
/// Request to place a new Futures order
|
||||
/// </summary>
|
||||
public record EditFuturesOrderRequest : SharedSymbolRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Order id
|
||||
/// </summary>
|
||||
public string OrderId { get; set; }
|
||||
/// <summary>
|
||||
/// Quantity of the order
|
||||
/// </summary>
|
||||
public SharedQuantity? Quantity { get; set; }
|
||||
/// <summary>
|
||||
/// Price of the order
|
||||
/// </summary>
|
||||
public decimal? Price { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
/// <param name="symbol">Symbol to place the order on</param>
|
||||
/// <param name="orderId">The id of the order to edit</param>
|
||||
/// <param name="quantity">New quantity of the order</param>
|
||||
/// <param name="price">New price of the order</param>
|
||||
/// <param name="exchangeParameters">Exchange specific parameters</param>
|
||||
public EditFuturesOrderRequest(
|
||||
SharedSymbol symbol,
|
||||
string orderId,
|
||||
SharedQuantity? quantity = null,
|
||||
decimal? price = null,
|
||||
ExchangeParameters? exchangeParameters = null) : base(symbol, exchangeParameters)
|
||||
{
|
||||
OrderId = orderId;
|
||||
Quantity = quantity;
|
||||
Price = price;
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -25,7 +25,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <param name="request">Request info</param>
|
||||
/// <param name="ct">Cancellation token</param>
|
||||
Task<ICallResult<SharedId>> EditFuturesOrderAsync(
|
||||
EditFuturesOrderRequest request,
|
||||
EditOrderRequest request,
|
||||
CancellationToken ct = default);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
public interface IEditFuturesOrderRest : IEditFuturesOrder, ISharedRest
|
||||
{
|
||||
/// <inheritdoc />
|
||||
new Task<HttpResult<SharedId>> EditFuturesOrderAsync(EditFuturesOrderRequest request, CancellationToken ct = default);
|
||||
new Task<HttpResult<SharedId>> EditFuturesOrderAsync(EditOrderRequest request, CancellationToken ct = default);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -44,6 +44,6 @@ namespace CryptoExchange.Net.SharedApis
|
||||
public interface IEditFuturesOrderSocket : IEditFuturesOrder, ISharedSocket
|
||||
{
|
||||
/// <inheritdoc />
|
||||
new Task<QueryResult<SharedId>> EditFuturesOrderAsync(EditFuturesOrderRequest request, CancellationToken ct = default);
|
||||
new Task<QueryResult<SharedId>> EditFuturesOrderAsync(EditOrderRequest request, CancellationToken ct = default);
|
||||
}
|
||||
}
|
||||
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
/// <summary>
|
||||
/// Options for editing a futures order by client order id
|
||||
/// </summary>
|
||||
public class EditFuturesOrderByClientOrderIdOptions : CapabilityOptions<EditOrderRequest, IEditFuturesOrderByClientOrderIdRest>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Edit a futures order by its client order id";
|
||||
|
||||
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.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),
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public EditFuturesOrderByClientOrderIdOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IEditFuturesOrderByClientOrderIdRest.EditFuturesOrderByClientOrderIdAsync), _defaultParameterRules)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
using CryptoExchange.Net.Objects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
/// <summary>
|
||||
/// Operation for editing an open futures order by its client order id on an exchange.
|
||||
/// </summary>
|
||||
public interface IEditFuturesOrderByClientOrderId : ISharedApiCapability
|
||||
{
|
||||
/// <summary>
|
||||
/// Futures edit order by client order id request options.<br />
|
||||
/// Use <see cref="CapabilityOptions.RequestParameterRules"/> and <see cref="CapabilityOptions.ExchangeParameterRules"/> to check for required and optional parameters for the request. <br />
|
||||
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
|
||||
/// </summary>
|
||||
EditFuturesOrderByClientOrderIdOptions EditFuturesOrderByClientOrderIdOptions { get; }
|
||||
/// <summary>
|
||||
/// Edit a futures order using client order id, see <see cref="EditFuturesOrderByClientOrderIdOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||
/// </summary>
|
||||
/// <param name="request">Request info</param>
|
||||
/// <param name="ct">Cancellation token</param>
|
||||
Task<ICallResult<SharedId>> EditFuturesOrderByClientOrderIdAsync(EditOrderRequest request, CancellationToken ct = default);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Operation for editing an open futures order by its client order id on an exchange via the REST API.
|
||||
/// </summary>
|
||||
public interface IEditFuturesOrderByClientOrderIdRest : IEditFuturesOrderByClientOrderId, ISharedRest
|
||||
{
|
||||
/// <inheritdoc />
|
||||
new Task<HttpResult<SharedId>> EditFuturesOrderByClientOrderIdAsync(EditOrderRequest request, CancellationToken ct = default);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Operation for editing an open futures order by its client order id on an exchange via the WebSocket API.
|
||||
/// </summary>
|
||||
public interface IEditFuturesOrderByClientOrderIdSocket : IEditFuturesOrderByClientOrderId, ISharedSocket
|
||||
{
|
||||
/// <inheritdoc />
|
||||
new Task<QueryResult<SharedId>> EditFuturesOrderByClientOrderIdAsync(EditOrderRequest request, CancellationToken ct = default);
|
||||
}
|
||||
}
|
||||
@@ -7,17 +7,17 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// Options for editing an open spot order
|
||||
/// </summary>
|
||||
public class EditSpotOrderOptions : CapabilityOptions<EditSpotOrderRequest, IEditSpotOrder>
|
||||
public class EditSpotOrderOptions : CapabilityOptions<EditOrderRequest, IEditSpotOrder>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Edit an existing spot order";
|
||||
|
||||
private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
|
||||
{
|
||||
RequestParameterRule<EditSpotOrderRequest>.Required(x => x.Symbol, "The symbol of the order to edit", new SharedSymbol(TradingMode.Spot, "ETH", "USDT")),
|
||||
RequestParameterRule<EditSpotOrderRequest>.Required(x => x.OrderId, "The order id of the order to edit", "123"),
|
||||
RequestParameterRule<EditSpotOrderRequest>.Optional(x => x.Quantity, "The new order quantity", SharedQuantity.Base(1)),
|
||||
RequestParameterRule<EditSpotOrderRequest>.Optional(x => x.Price, "The new order price", 0.1m),
|
||||
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 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),
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@@ -32,7 +32,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// Validate a request
|
||||
/// </summary>
|
||||
public override Error? ValidateRequest(
|
||||
EditSpotOrderRequest request,
|
||||
EditOrderRequest request,
|
||||
IEditSpotOrder client)
|
||||
{
|
||||
var error = base.ValidateRequest(request, client);
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <param name="request">Request info</param>
|
||||
/// <param name="ct">Cancellation token</param>
|
||||
Task<ICallResult<SharedId>> EditSpotOrderAsync(
|
||||
EditSpotOrderRequest request,
|
||||
EditOrderRequest request,
|
||||
CancellationToken ct = default);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
public interface IEditSpotOrderRest : IEditSpotOrder, ISharedRest
|
||||
{
|
||||
/// <inheritdoc />
|
||||
new Task<HttpResult<SharedId>> EditSpotOrderAsync(EditSpotOrderRequest request, CancellationToken ct = default);
|
||||
new Task<HttpResult<SharedId>> EditSpotOrderAsync(EditOrderRequest request, CancellationToken ct = default);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -44,6 +44,6 @@ namespace CryptoExchange.Net.SharedApis
|
||||
public interface IEditSpotOrderSocket : IEditSpotOrder, ISharedSocket
|
||||
{
|
||||
/// <inheritdoc />
|
||||
new Task<QueryResult<SharedId>> EditSpotOrderAsync(EditSpotOrderRequest request, CancellationToken ct = default);
|
||||
new Task<QueryResult<SharedId>> EditSpotOrderAsync(EditOrderRequest request, CancellationToken ct = default);
|
||||
}
|
||||
}
|
||||
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
/// <summary>
|
||||
/// Options for editing a spot order by client order id
|
||||
/// </summary>
|
||||
public class EditSpotOrderByClientOrderIdOptions : CapabilityOptions<EditOrderRequest, IEditSpotOrderByClientOrderIdRest>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Edit a spot order by its client order id";
|
||||
|
||||
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.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),
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public EditSpotOrderByClientOrderIdOptions(string exchange, bool authenticated) : base(exchange, authenticated, nameof(IEditSpotOrderByClientOrderIdRest.EditSpotOrderByClientOrderIdAsync), _defaultParameterRules)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
using CryptoExchange.Net.Objects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
/// <summary>
|
||||
/// Operation for editing an open spot order by its client order id on an exchange.
|
||||
/// </summary>
|
||||
public interface IEditSpotOrderByClientOrderId : ISharedApiCapability
|
||||
{
|
||||
/// <summary>
|
||||
/// Spot edit order by client order id request options.<br />
|
||||
/// Use <see cref="CapabilityOptions.RequestParameterRules"/> and <see cref="CapabilityOptions.ExchangeParameterRules"/> to check for required and optional parameters for the request. <br />
|
||||
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
|
||||
/// </summary>
|
||||
EditSpotOrderByClientOrderIdOptions EditSpotOrderByClientOrderIdOptions { get; }
|
||||
/// <summary>
|
||||
/// Edit a spot order using client order id, see <see cref="EditSpotOrderByClientOrderIdOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||
/// </summary>
|
||||
/// <param name="request">Request info</param>
|
||||
/// <param name="ct">Cancellation token</param>
|
||||
Task<ICallResult<SharedId>> EditSpotOrderByClientOrderIdAsync(EditOrderRequest request, CancellationToken ct = default);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Operation for editing an open spot order by its client order id on an exchange via the REST API.
|
||||
/// </summary>
|
||||
public interface IEditSpotOrderByClientOrderIdRest : IEditSpotOrderByClientOrderId, ISharedRest
|
||||
{
|
||||
/// <inheritdoc />
|
||||
new Task<HttpResult<SharedId>> EditSpotOrderByClientOrderIdAsync(EditOrderRequest request, CancellationToken ct = default);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Operation for editing an open Spot order by its client order id on an exchange via the WebSocket API.
|
||||
/// </summary>
|
||||
public interface IEditSpotOrderByClientOrderIdSocket : IEditSpotOrderByClientOrderId, ISharedSocket
|
||||
{
|
||||
/// <inheritdoc />
|
||||
new Task<QueryResult<SharedId>> EditSpotOrderByClientOrderIdAsync(EditOrderRequest request, CancellationToken ct = default);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -18,7 +18,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
public SetPositionModeOptions(string exchange) : base(exchange, true, nameof(ISetPositionModeRest.SetPositionModeOptions), _defaultParameterRules)
|
||||
public SetPositionModeOptions(string exchange) : base(exchange, true, nameof(ISetPositionModeRest.SetPositionModeAsync), _defaultParameterRules)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
@@ -29,6 +30,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// ctor
|
||||
/// </summary>
|
||||
/// <param name="symbols">The symbols to subscribe to</param>
|
||||
[Obsolete("Use SubscribeBookTickerRequest(IEnumerable<SharedSymbol> symbols, ExchangeParameters? exchangeParameters = null) instead")]
|
||||
public SubscribeBookTickerRequest(params SharedSymbol[] symbols) : base(symbols, null)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
@@ -31,6 +32,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// ctor
|
||||
/// </summary>
|
||||
/// <param name="symbols">The symbols to subscribe to</param>
|
||||
[Obsolete("Use SubscribeTickerRequest(IEnumerable<SharedSymbol> symbols, ExchangeParameters? exchangeParameters = null) instead")]
|
||||
public SubscribeTickerRequest(params SharedSymbol[] symbols) : base(symbols, null)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -15,12 +15,12 @@ namespace CryptoExchange.Net.SharedApis
|
||||
private static readonly RequestParameterDescription[] _defaultParameterRules = new[]
|
||||
{
|
||||
RequestParameterRule<SetTpSlRequest>.Required(x => x.Symbol, "The symbol to set take profit or stop loss for", new SharedSymbol(TradingMode.PerpetualLinear, "ETH", "USDT")),
|
||||
RequestParameterRule<SetTpSlRequest>.Optional(x => x.PositionMode, "The position mode of the account", SharedPositionMode.OneWay),
|
||||
RequestParameterRule<SetTpSlRequest>.Required(x => x.PositionSide, "The side of the position", SharedPositionSide.Long),
|
||||
RequestParameterRule<SetTpSlRequest>.Optional(x => x.MarginMode, "The margin mode of the position", SharedMarginMode.Cross),
|
||||
RequestParameterRule<SetTpSlRequest>.Required(x => x.TpSlSide, "Whether to set take profit or stop loss", SharedTpSlSide.TakeProfit),
|
||||
RequestParameterRule<SetTpSlRequest>.Optional(x => x.Quantity, "The quantity to close", 1m),
|
||||
RequestParameterRule<SetTpSlRequest>.Required(x => x.TriggerPrice, "The trigger price", 1m),
|
||||
RequestParameterRule<SetTpSlRequest>.Optional(x => x.PositionMode, "The position mode of the account", SharedPositionMode.OneWay),
|
||||
RequestParameterRule<SetTpSlRequest>.Optional(x => x.MarginMode, "The margin mode of the position", SharedMarginMode.Cross),
|
||||
RequestParameterRule<SetTpSlRequest>.Optional(x => x.Quantity, "The quantity to close", 1m),
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CryptoExchange.Net.SharedApis
|
||||
{
|
||||
@@ -31,6 +32,7 @@ namespace CryptoExchange.Net.SharedApis
|
||||
/// ctor
|
||||
/// </summary>
|
||||
/// <param name="symbols">The symbols to subscribe to</param>
|
||||
[Obsolete("Use SubscribeTradeRequest(IEnumerable<SharedSymbol> symbols, ExchangeParameters? exchangeParameters = null) instead")]
|
||||
public SubscribeTradeRequest(params SharedSymbol[] symbols) : base(symbols, null)
|
||||
{
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user