mirror of
https://github.com/JKorf/CryptoExchange.Net.git
synced 2026-10-18 17:11:02 +00:00
Compare commits
40 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d0ce2563de | |||
| 407509e9cd | |||
| 3dd68dcad4 | |||
| ff43d202d4 | |||
| d1947e643b | |||
| 6fec65cd6a | |||
| 053bcf6ecc | |||
| 6957ba44f5 | |||
| c1af97dd4a | |||
| ecfe3cf392 | |||
| ac1e9cf2ab | |||
| 4987e6be70 | |||
| 9100c0d7f3 | |||
| 5b1ae30e4b | |||
| 36a06e8a9a | |||
| e7eb559074 | |||
| 79e2efec70 | |||
| c8c6d14329 | |||
| b8bd30a09d | |||
| c2b58ab19a | |||
| 90a031c595 | |||
| 860d753ad6 | |||
| e16c91792c | |||
| a3d95da9fa | |||
| 907399b878 | |||
| 9eab0d967e | |||
| 0dee68e8ae | |||
| d838d3377f | |||
| 2141ad9061 | |||
| 9be8798ccf | |||
| 4803ed91cd | |||
| 20bddd5c37 | |||
| 0e75ddb3d0 | |||
| 0e5b46002c | |||
| 8f7c71f9ce | |||
| 73377fbb87 | |||
| 3a00d6371a | |||
| caf6d36bcd | |||
| e078a373da | |||
| 007743f5a1 |
@@ -38,6 +38,14 @@ After calling `GetSpotSymbolsAsync`, `ISpotSymbolRestClient.SpotSymbolCatalog` m
|
|||||||
|
|
||||||
When implementing an exchange library, use `LibraryHelpers.IsStableCoin`, `IsCommodity`, and `IsEquity` only as best-effort classifiers and supply exchange-specific additions where needed.
|
When implementing an exchange library, use `LibraryHelpers.IsStableCoin`, `IsCommodity`, and `IsEquity` only as best-effort classifiers and supply exchange-specific additions where needed.
|
||||||
|
|
||||||
|
## Shared market-data quantities
|
||||||
|
|
||||||
|
In 12.4.0, use `SharedOrderQuantity`-valued `Volumes` on shared spot/futures tickers and klines, and `Quantities` on shared trades. The scalar `Volume`, `QuoteVolume`, and `Quantity` members are obsolete.
|
||||||
|
|
||||||
|
## WebSocket order commands
|
||||||
|
|
||||||
|
In 12.5.0, `ISpotOrderManagementSocketClient` and `IFuturesOrderManagementSocketClient` optionally provide place/cancel order commands over WebSocket. Their methods return `QueryResult<SharedId>`, not `WebSocketResult<UpdateSubscription>`. Check whether the exchange implements the interface.
|
||||||
|
|
||||||
## Result pattern
|
## Result pattern
|
||||||
|
|
||||||
REST methods return `HttpResult<T>` and websocket subscription methods return `WebSocketResult<UpdateSubscription>`. Always check `.Success`. `.Exchange` property identifies which exchange responded — useful for logging.
|
REST methods return `HttpResult<T>` and websocket subscription methods return `WebSocketResult<UpdateSubscription>`. Always check `.Success`. `.Exchange` property identifies which exchange responded — useful for logging.
|
||||||
@@ -45,7 +53,7 @@ REST methods return `HttpResult<T>` and websocket subscription methods return `W
|
|||||||
## Available shared interfaces
|
## Available shared interfaces
|
||||||
|
|
||||||
- REST tickers/symbols/orderbook/klines/trades, orders (spot/futures, regular/trigger/TP-SL), balances, positions, fees, deposits/withdrawals, transfers
|
- REST tickers/symbols/orderbook/klines/trades, orders (spot/futures, regular/trigger/TP-SL), balances, positions, fees, deposits/withdrawals, transfers
|
||||||
- WebSocket tickers, book tickers, order book, trades, klines, user data
|
- WebSocket tickers, book tickers, order book, trades, klines, user data, and optional spot/futures order management
|
||||||
|
|
||||||
Each exchange documents which it implements. Not every exchange supports every operation.
|
Each exchange documents which it implements. Not every exchange supports every operation.
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,14 @@ CryptoExchange.Net 12.2.0 classifies the base and quote sides of `SharedSpotSymb
|
|||||||
|
|
||||||
`ISpotSymbolRestClient.SpotSymbolCatalog` is populated by `GetSpotSymbolsAsync`; `IFuturesSymbolRestClient.FuturesSymbolCatalog` is populated by `GetFuturesSymbolsAsync`. Do not assume a catalog is available before that request. For exchange-library implementations, `LibraryHelpers.IsStableCoin`, `IsCommodity`, and `IsEquity` offer best-effort classification and can be extended with exchange-specific values.
|
`ISpotSymbolRestClient.SpotSymbolCatalog` is populated by `GetSpotSymbolsAsync`; `IFuturesSymbolRestClient.FuturesSymbolCatalog` is populated by `GetFuturesSymbolsAsync`. Do not assume a catalog is available before that request. For exchange-library implementations, `LibraryHelpers.IsStableCoin`, `IsCommodity`, and `IsEquity` offer best-effort classification and can be extended with exchange-specific values.
|
||||||
|
|
||||||
|
## Shared market-data quantities
|
||||||
|
|
||||||
|
CryptoExchange.Net 12.4.0 uses `SharedOrderQuantity` for market-data quantities. Prefer `Volumes` on `SharedSpotTicker`, `SharedFuturesTicker`, and `SharedKline`, and `Quantities` on `SharedTrade`; the scalar `Volume`, `QuoteVolume`, and `Quantity` members are obsolete.
|
||||||
|
|
||||||
|
## WebSocket order commands
|
||||||
|
|
||||||
|
CryptoExchange.Net 12.5.0 adds optional `ISpotOrderManagementSocketClient` and `IFuturesOrderManagementSocketClient` interfaces for placing and canceling orders over WebSocket. These command methods return `QueryResult<SharedId>` rather than a subscription result. Check exchange support before relying on either interface.
|
||||||
|
|
||||||
## Single-exchange code uses the exchange's own client
|
## Single-exchange code uses the exchange's own client
|
||||||
|
|
||||||
For Binance-only code, use `BinanceRestClient` directly (see Binance.Net repo `AGENTS.md`). SharedApis is for portability — use it when you need that.
|
For Binance-only code, use `BinanceRestClient` directly (see Binance.Net repo `AGENTS.md`). SharedApis is for portability — use it when you need that.
|
||||||
@@ -41,7 +49,7 @@ REST methods return `HttpResult<T>` and websocket subscription methods return `W
|
|||||||
## Available shared interfaces
|
## Available shared interfaces
|
||||||
|
|
||||||
REST: tickers, symbols, orderbook, klines, trades, orders (spot/futures, trigger, TP-SL), balances, positions, fees, deposits/withdrawals, transfers.
|
REST: tickers, symbols, orderbook, klines, trades, orders (spot/futures, trigger, TP-SL), balances, positions, fees, deposits/withdrawals, transfers.
|
||||||
WebSocket: tickers, book tickers, orderbook, trades, klines, user data.
|
WebSocket: tickers, book tickers, orderbook, trades, klines, user data, and optional spot/futures order management.
|
||||||
|
|
||||||
Each exchange library implements a subset. Check exchange docs for support matrix.
|
Each exchange library implements a subset. Check exchange docs for support matrix.
|
||||||
|
|
||||||
|
|||||||
@@ -85,6 +85,14 @@ After calling `GetSpotSymbolsAsync` or `GetFuturesSymbolsAsync`, use the client'
|
|||||||
|
|
||||||
For exchange-library implementations, `LibraryHelpers.IsStableCoin`, `IsCommodity`, and `IsEquity` provide best-effort classification of known assets and accept exchange-specific additions. These helpers are heuristics, not an exhaustive source of truth.
|
For exchange-library implementations, `LibraryHelpers.IsStableCoin`, `IsCommodity`, and `IsEquity` provide best-effort classification of known assets and accept exchange-specific additions. These helpers are heuristics, not an exhaustive source of truth.
|
||||||
|
|
||||||
|
## Shared Market-Data Quantities
|
||||||
|
|
||||||
|
Since CryptoExchange.Net 12.4.0, shared market-data models use `SharedOrderQuantity` so base-asset, quote-asset, and contract quantities remain explicit. Read `SharedSpotTicker.Volumes`, `SharedFuturesTicker.Volumes`, and `SharedKline.Volumes`; read `SharedTrade.Quantities`. The former scalar `Volume`, `QuoteVolume`, and `Quantity` members are obsolete.
|
||||||
|
|
||||||
|
## WebSocket Order Management
|
||||||
|
|
||||||
|
Since CryptoExchange.Net 12.5.0, exchanges can implement `ISpotOrderManagementSocketClient` and `IFuturesOrderManagementSocketClient` to place and cancel orders over WebSocket. These are command interfaces, not subscription interfaces: `Place*OrderAsync` and `Cancel*OrderAsync` return `QueryResult<SharedId>`. Check exchange support before using them.
|
||||||
|
|
||||||
## Available Shared Interfaces
|
## Available Shared Interfaces
|
||||||
|
|
||||||
**REST:**
|
**REST:**
|
||||||
@@ -98,6 +106,7 @@ For exchange-library implementations, `LibraryHelpers.IsStableCoin`, `IsCommodit
|
|||||||
- `ITickerSocketClient`, `IBookTickerSocketClient`
|
- `ITickerSocketClient`, `IBookTickerSocketClient`
|
||||||
- `IOrderBookSocketClient`, `ITradeSocketClient`, `IKlineSocketClient`
|
- `IOrderBookSocketClient`, `ITradeSocketClient`, `IKlineSocketClient`
|
||||||
- `IUserTradeSocketClient`, `ISpotOrderSocketClient`, `IFuturesOrderSocketClient`, `IPositionSocketClient`, `IBalanceSocketClient`
|
- `IUserTradeSocketClient`, `ISpotOrderSocketClient`, `IFuturesOrderSocketClient`, `IPositionSocketClient`, `IBalanceSocketClient`
|
||||||
|
- Order commands: `ISpotOrderManagementSocketClient`, `IFuturesOrderManagementSocketClient`
|
||||||
|
|
||||||
Each exchange documents which interfaces it implements (some exchanges don't support every operation).
|
Each exchange documents which interfaces it implements (some exchanges don't support every operation).
|
||||||
|
|
||||||
|
|||||||
@@ -91,28 +91,25 @@ namespace CryptoExchange.Net.UnitTests
|
|||||||
var evnt = new AsyncResetEvent(false, true);
|
var evnt = new AsyncResetEvent(false, true);
|
||||||
|
|
||||||
var waiters = new List<Task<bool>>();
|
var waiters = new List<Task<bool>>();
|
||||||
for(var i = 0; i < 10; i++)
|
for (var i = 0; i < 10; i++)
|
||||||
{
|
{
|
||||||
waiters.Add(evnt.WaitAsync());
|
waiters.Add(evnt.WaitAsync());
|
||||||
}
|
}
|
||||||
|
|
||||||
List<bool>? results = null;
|
var remaining = waiters.ToList();
|
||||||
var resultsWaiter = Task.Run(async () =>
|
|
||||||
{
|
|
||||||
await Task.WhenAll(waiters);
|
|
||||||
results = waiters.Select(w => w.Result).ToList();
|
|
||||||
});
|
|
||||||
|
|
||||||
for(var i = 1; i <= 10; i++)
|
for (var i = 0; i < 10; i++)
|
||||||
{
|
{
|
||||||
evnt.Set();
|
evnt.Set();
|
||||||
await Task.Delay(1); // Wait for the continuation.
|
|
||||||
Assert.That(10 - i == waiters.Count(w => w.Status != TaskStatus.RanToCompletion));
|
var completed = await Task.WhenAny(remaining);
|
||||||
|
Assert.That(await completed, Is.True);
|
||||||
|
|
||||||
|
remaining.Remove(completed);
|
||||||
|
Assert.That(remaining.Count(w => w.IsCompleted), Is.Zero);
|
||||||
}
|
}
|
||||||
|
|
||||||
await resultsWaiter;
|
Assert.That(remaining, Is.Empty);
|
||||||
|
|
||||||
Assert.That(10 == results?.Count(r => r));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
|||||||
@@ -0,0 +1,136 @@
|
|||||||
|
using CryptoExchange.Net.Objects;
|
||||||
|
using CryptoExchange.Net.Objects.Errors;
|
||||||
|
using CryptoExchange.Net.Objects.Sockets;
|
||||||
|
using CryptoExchange.Net.Sockets.Default;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CryptoExchange.Net.UnitTests
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class ManualUpdateSubscriptionTests
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void Constructor_Should_CreateSubscribedVirtualSubscription()
|
||||||
|
{
|
||||||
|
var controller = new ManualUpdateSubscription(socketId: 12);
|
||||||
|
|
||||||
|
Assert.That(controller.Subscription.SocketId, Is.EqualTo(12));
|
||||||
|
Assert.That(controller.Subscription.Id, Is.GreaterThan(0));
|
||||||
|
Assert.That(controller.Subscription.SocketStatus, Is.EqualTo(SocketStatus.Connected));
|
||||||
|
Assert.That(controller.Subscription.SubscriptionStatus, Is.EqualTo(SubscriptionStatus.Subscribed));
|
||||||
|
Assert.That(controller.Subscription.LastReceiveTime, Is.Null);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void StateChanges_Should_BeVisibleOnSubscription()
|
||||||
|
{
|
||||||
|
var controller = new ManualUpdateSubscription();
|
||||||
|
var timestamp = new DateTime(2026, 8, 5, 12, 0, 0, DateTimeKind.Utc);
|
||||||
|
var statuses = new List<SubscriptionStatus>();
|
||||||
|
controller.Subscription.SubscriptionStatusChanged += statuses.Add;
|
||||||
|
|
||||||
|
controller.SetLastReceiveTime(timestamp);
|
||||||
|
controller.SetSocketStatus(SocketStatus.Reconnecting);
|
||||||
|
controller.SetSubscriptionStatus(SubscriptionStatus.Subscribing);
|
||||||
|
controller.SetSubscriptionStatus(SubscriptionStatus.Subscribed);
|
||||||
|
|
||||||
|
Assert.That(controller.Subscription.LastReceiveTime, Is.EqualTo(timestamp));
|
||||||
|
Assert.That(controller.Subscription.SocketStatus, Is.EqualTo(SocketStatus.Reconnecting));
|
||||||
|
Assert.That(controller.Subscription.SubscriptionStatus, Is.EqualTo(SubscriptionStatus.Subscribed));
|
||||||
|
Assert.That(statuses, Is.EqualTo(new[]
|
||||||
|
{
|
||||||
|
SubscriptionStatus.Subscribing,
|
||||||
|
SubscriptionStatus.Subscribed
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void LifecycleMethods_Should_InvokeSubscriptionEvents()
|
||||||
|
{
|
||||||
|
var controller = new ManualUpdateSubscription();
|
||||||
|
var error = new ServerError("Test error", ErrorInfo.Unknown);
|
||||||
|
var exception = new InvalidOperationException("Test exception");
|
||||||
|
var disconnectedPeriod = TimeSpan.FromMinutes(2);
|
||||||
|
var lost = 0;
|
||||||
|
var restored = TimeSpan.Zero;
|
||||||
|
Error? resubscribeError = null;
|
||||||
|
var paused = 0;
|
||||||
|
var unpaused = 0;
|
||||||
|
Exception? receivedException = null;
|
||||||
|
|
||||||
|
controller.Subscription.ConnectionLost += () => lost++;
|
||||||
|
controller.Subscription.ConnectionRestored += x => restored = x;
|
||||||
|
controller.Subscription.ResubscribingFailed += x => resubscribeError = x;
|
||||||
|
controller.Subscription.ActivityPaused += () => paused++;
|
||||||
|
controller.Subscription.ActivityUnpaused += () => unpaused++;
|
||||||
|
controller.Subscription.Exception += x => receivedException = x;
|
||||||
|
|
||||||
|
controller.InvokeConnectionLost();
|
||||||
|
controller.InvokeConnectionRestored(disconnectedPeriod);
|
||||||
|
controller.InvokeResubscribingFailed(error);
|
||||||
|
controller.InvokeActivityPaused();
|
||||||
|
controller.InvokeActivityUnpaused();
|
||||||
|
controller.InvokeException(exception);
|
||||||
|
|
||||||
|
Assert.That(lost, Is.EqualTo(1));
|
||||||
|
Assert.That(restored, Is.EqualTo(disconnectedPeriod));
|
||||||
|
Assert.That(resubscribeError, Is.SameAs(error));
|
||||||
|
Assert.That(paused, Is.EqualTo(1));
|
||||||
|
Assert.That(unpaused, Is.EqualTo(1));
|
||||||
|
Assert.That(receivedException, Is.SameAs(exception));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void InvokeConnectionClosed_Should_CloseAndOnlyInvokeOnce()
|
||||||
|
{
|
||||||
|
var controller = new ManualUpdateSubscription();
|
||||||
|
var closed = 0;
|
||||||
|
controller.Subscription.ConnectionClosed += () => closed++;
|
||||||
|
|
||||||
|
controller.InvokeConnectionClosed();
|
||||||
|
controller.InvokeConnectionClosed();
|
||||||
|
|
||||||
|
Assert.That(closed, Is.EqualTo(1));
|
||||||
|
Assert.That(controller.Subscription.SocketStatus, Is.EqualTo(SocketStatus.Closed));
|
||||||
|
Assert.That(controller.Subscription.SubscriptionStatus, Is.EqualTo(SubscriptionStatus.Closed));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task SubscriptionOperations_Should_InvokeCallbacks()
|
||||||
|
{
|
||||||
|
var closes = 0;
|
||||||
|
var reconnects = 0;
|
||||||
|
var resubscribes = 0;
|
||||||
|
var controller = new ManualUpdateSubscription(
|
||||||
|
closeAsync: () =>
|
||||||
|
{
|
||||||
|
closes++;
|
||||||
|
return Task.CompletedTask;
|
||||||
|
},
|
||||||
|
reconnectAsync: () =>
|
||||||
|
{
|
||||||
|
reconnects++;
|
||||||
|
return Task.CompletedTask;
|
||||||
|
},
|
||||||
|
resubscribeAsync: () =>
|
||||||
|
{
|
||||||
|
resubscribes++;
|
||||||
|
return Task.FromResult(CallResult.Ok());
|
||||||
|
});
|
||||||
|
|
||||||
|
await controller.Subscription.ReconnectAsync();
|
||||||
|
var resubscribeResult = await controller.Subscription.ResubscribeAsync();
|
||||||
|
await controller.Subscription.CloseAsync();
|
||||||
|
await controller.Subscription.CloseAsync();
|
||||||
|
|
||||||
|
Assert.That(reconnects, Is.EqualTo(1));
|
||||||
|
Assert.That(resubscribes, Is.EqualTo(1));
|
||||||
|
Assert.That(resubscribeResult.Success, Is.True);
|
||||||
|
Assert.That(closes, Is.EqualTo(1));
|
||||||
|
Assert.That(controller.Subscription.SubscriptionStatus, Is.EqualTo(SubscriptionStatus.Closed));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -198,7 +198,7 @@ namespace CryptoExchange.Net.Clients
|
|||||||
string? cacheKey = null;
|
string? cacheKey = null;
|
||||||
if (ShouldCache(definition))
|
if (ShouldCache(definition))
|
||||||
{
|
{
|
||||||
cacheKey = definition.FullUrl + definition + uriParameters?.ToFormData();
|
cacheKey = GetCacheKey(definition, uriParameters);
|
||||||
_logger.CheckingCache(cacheKey);
|
_logger.CheckingCache(cacheKey);
|
||||||
var cachedValue = _cache.Get(cacheKey, ClientOptions.CachingMaxAge);
|
var cachedValue = _cache.Get(cacheKey, ClientOptions.CachingMaxAge);
|
||||||
if (cachedValue != null)
|
if (cachedValue != null)
|
||||||
@@ -800,6 +800,13 @@ namespace CryptoExchange.Net.Clients
|
|||||||
&& definition.Method == HttpMethod.Get
|
&& definition.Method == HttpMethod.Get
|
||||||
&& !definition.PreventCaching;
|
&& !definition.PreventCaching;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Produce a unique cache key for the request based on the request definition and parameters.
|
||||||
|
/// </summary>
|
||||||
|
protected virtual string GetCacheKey(RequestDefinition definition, Parameters? parameters)
|
||||||
|
{
|
||||||
|
return definition.FullUrl + definition + parameters?.ToFormData();
|
||||||
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public virtual void SetOptions(UpdateOptions options)
|
public virtual void SetOptions(UpdateOptions options)
|
||||||
@@ -889,6 +896,12 @@ namespace CryptoExchange.Net.Clients
|
|||||||
|
|
||||||
ApiCredentials = (TApiCredentials?)options.ApiCredentials?.Copy() ?? ApiCredentials;
|
ApiCredentials = (TApiCredentials?)options.ApiCredentials?.Copy() ?? ApiCredentials;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override string GetCacheKey(RequestDefinition definition, Parameters? parameters)
|
||||||
|
{
|
||||||
|
return definition.FullUrl + definition + parameters?.ToFormData() + GetAuthenticationProvider()?.Key;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|||||||
@@ -97,6 +97,11 @@ namespace CryptoExchange.Net.Clients
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
protected bool AllowTopicsOnTheSameConnection { get; set; } = true;
|
protected bool AllowTopicsOnTheSameConnection { get; set; } = true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether to allow usage of a current public WebSocket connection for an authenticated request
|
||||||
|
/// </summary>
|
||||||
|
protected bool UsePublicConnectionForAuth { get; set; } = false;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public double IncomingKbps
|
public double IncomingKbps
|
||||||
{
|
{
|
||||||
@@ -625,6 +630,21 @@ namespace CryptoExchange.Net.Clients
|
|||||||
return Task.FromResult(CallResult.Ok());
|
return Task.FromResult(CallResult.Ok());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether the connection can be used for a new subscription or query with the provided parameters
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="connection">The connection to check</param>
|
||||||
|
/// <param name="address">The address set by the request</param>
|
||||||
|
/// <param name="authenticated">Whether the request needs an authenticated connection</param>
|
||||||
|
/// <param name="topic">Topic of the request</param>
|
||||||
|
/// <returns>True if connection can be used</returns>
|
||||||
|
protected virtual bool ConnectionCanBeUsedFor(SocketConnection connection, string address, bool authenticated, string? topic = null)
|
||||||
|
{
|
||||||
|
return connection.ConnectionUriString.Equals(address.TrimEnd('/'), StringComparison.Ordinal)
|
||||||
|
&& connection.ApiClient.ClientName.Equals(ClientName, StringComparison.Ordinal)
|
||||||
|
&& (AllowTopicsOnTheSameConnection || !connection.Topics.Contains(topic));
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a connection for a new subscription or query. Can be an existing if there are open position or a new one.
|
/// Gets a connection for a new subscription or query. Can be an existing if there are open position or a new one.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -643,10 +663,7 @@ namespace CryptoExchange.Net.Clients
|
|||||||
string? topic = null,
|
string? topic = null,
|
||||||
int individualSubscriptionCount = 1)
|
int individualSubscriptionCount = 1)
|
||||||
{
|
{
|
||||||
var socketQuery = _socketConnections.Where(s => s.Value.ConnectionUriString.Equals(address.TrimEnd('/'), StringComparison.Ordinal)
|
var socketQuery = _socketConnections.Where(s => ConnectionCanBeUsedFor(s.Value, address, authenticated, topic)).Select(x => x.Value); // Don't ToList this so the query is executed again when called
|
||||||
&& s.Value.ApiClient.ClientName.Equals(ClientName, StringComparison.Ordinal)
|
|
||||||
&& (AllowTopicsOnTheSameConnection || !s.Value.Topics.Contains(topic)))
|
|
||||||
.Select(x => x.Value); // Don't ToList this so the query is executed again when called
|
|
||||||
|
|
||||||
// If all current socket connections are reconnecting or resubscribing wait for that to finish as we can probably use the existing connection
|
// If all current socket connections are reconnecting or resubscribing wait for that to finish as we can probably use the existing connection
|
||||||
var delayStart = DateTime.UtcNow;
|
var delayStart = DateTime.UtcNow;
|
||||||
@@ -676,7 +693,7 @@ namespace CryptoExchange.Net.Clients
|
|||||||
_logger.WaitedForReconnectingSocket((long)(DateTime.UtcNow - delayStart).TotalMilliseconds);
|
_logger.WaitedForReconnectingSocket((long)(DateTime.UtcNow - delayStart).TotalMilliseconds);
|
||||||
|
|
||||||
socketQuery = socketQuery.Where(s => (s.Status == SocketStatus.None || s.Status == SocketStatus.Connected)
|
socketQuery = socketQuery.Where(s => (s.Status == SocketStatus.None || s.Status == SocketStatus.Connected)
|
||||||
&& (s.Authenticated == authenticated || !authenticated)
|
&& (s.Authenticated == authenticated || !authenticated || UsePublicConnectionForAuth)
|
||||||
&& s.Connected).ToList();
|
&& s.Connected).ToList();
|
||||||
|
|
||||||
bool maxConnectionsReached = _socketConnections.Count >= (ApiOptions.MaxSocketConnections ?? ClientOptions.MaxSocketConnections);
|
bool maxConnectionsReached = _socketConnections.Count >= (ApiOptions.MaxSocketConnections ?? ClientOptions.MaxSocketConnections);
|
||||||
@@ -690,12 +707,14 @@ namespace CryptoExchange.Net.Clients
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (connection == null)
|
if (connection == null)
|
||||||
|
{
|
||||||
// Use an eligible non-dedicated connection for subscriptions, or as fallback when no dedicated request connection is available
|
// Use an eligible non-dedicated connection for subscriptions, or as fallback when no dedicated request connection is available
|
||||||
connection = socketQuery
|
connection = socketQuery
|
||||||
.Where(s => !s.DedicatedRequestConnection.IsDedicatedRequestConnection)
|
.Where(s => !s.DedicatedRequestConnection.IsDedicatedRequestConnection)
|
||||||
.Where(s => IsConnectionEligible(s, individualSubscriptionCount, maxConnectionsReached))
|
.Where(s => IsConnectionEligible(s, individualSubscriptionCount, maxConnectionsReached))
|
||||||
.OrderBy(s => s.UserSubscriptionCount)
|
.OrderBy(s => s.UserSubscriptionCount)
|
||||||
.FirstOrDefault();
|
.FirstOrDefault();
|
||||||
|
}
|
||||||
|
|
||||||
if (connection != null)
|
if (connection != null)
|
||||||
return CallResult.Ok(connection);
|
return CallResult.Ok(connection);
|
||||||
@@ -774,7 +793,9 @@ namespace CryptoExchange.Net.Clients
|
|||||||
|
|
||||||
if ((!lessThanBatchSubCombineTarget || !lessThanIndividualSubCombineTarget)
|
if ((!lessThanBatchSubCombineTarget || !lessThanIndividualSubCombineTarget)
|
||||||
&& !maxConnectionsReached)
|
&& !maxConnectionsReached)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return MaxIndividualSubscriptionsPerConnection == null
|
return MaxIndividualSubscriptionsPerConnection == null
|
||||||
|| currentIndividualSubscriptionCount + individualSubscriptionCount <= MaxIndividualSubscriptionsPerConnection;
|
|| currentIndividualSubscriptionCount + individualSubscriptionCount <= MaxIndividualSubscriptionsPerConnection;
|
||||||
|
|||||||
@@ -14,21 +14,19 @@ using System.Text;
|
|||||||
namespace CryptoExchange.Net.Clients
|
namespace CryptoExchange.Net.Clients
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public abstract class UserClientProvider<TRestClient, TSocketClient, TRestOptions, TSocketOptions, TCredentials, TEnvironment>
|
public abstract class UserClientProvider<TRestClient, TRestOptions, TCredentials, TEnvironment>
|
||||||
where TRestClient : IRestClient<TCredentials>
|
where TRestClient : IRestClient<TCredentials>
|
||||||
where TSocketClient : ISocketClient<TCredentials>
|
|
||||||
where TRestOptions : RestExchangeOptions<TEnvironment, TCredentials>, new()
|
where TRestOptions : RestExchangeOptions<TEnvironment, TCredentials>, new()
|
||||||
where TSocketOptions : SocketExchangeOptions<TEnvironment, TCredentials>, new()
|
|
||||||
where TCredentials : ApiCredentials
|
where TCredentials : ApiCredentials
|
||||||
where TEnvironment : TradeEnvironment
|
where TEnvironment : TradeEnvironment
|
||||||
{
|
{
|
||||||
private ConcurrentDictionary<string, TRestClient> _restClients = new ConcurrentDictionary<string, TRestClient>();
|
private ConcurrentDictionary<string, TRestClient> _restClients = new ConcurrentDictionary<string, TRestClient>();
|
||||||
private ConcurrentDictionary<string, TSocketClient> _socketClients = new ConcurrentDictionary<string, TSocketClient>();
|
|
||||||
|
|
||||||
private readonly IOptions<TRestOptions> _restOptions;
|
private readonly IOptions<TRestOptions> _restOptions;
|
||||||
private readonly IOptions<TSocketOptions> _socketOptions;
|
|
||||||
private readonly HttpClient _httpClient;
|
private readonly HttpClient _httpClient;
|
||||||
private readonly ILoggerFactory? _loggerFactory;
|
/// <summary>
|
||||||
|
/// Logger factory
|
||||||
|
/// </summary>
|
||||||
|
protected readonly ILoggerFactory? _loggerFactory;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public abstract string ExchangeName { get; }
|
public abstract string ExchangeName { get; }
|
||||||
@@ -39,17 +37,14 @@ namespace CryptoExchange.Net.Clients
|
|||||||
public UserClientProvider(
|
public UserClientProvider(
|
||||||
HttpClient? httpClient,
|
HttpClient? httpClient,
|
||||||
ILoggerFactory? loggerFactory,
|
ILoggerFactory? loggerFactory,
|
||||||
IOptions<TRestOptions> restOptions,
|
IOptions<TRestOptions> restOptions)
|
||||||
IOptions<TSocketOptions> socketOptions)
|
|
||||||
{
|
{
|
||||||
_httpClient = httpClient ?? new HttpClient();
|
_httpClient = httpClient ?? new HttpClient();
|
||||||
_httpClient.Timeout = restOptions.Value.RequestTimeout;
|
_httpClient.Timeout = restOptions.Value.RequestTimeout;
|
||||||
_loggerFactory = loggerFactory;
|
_loggerFactory = loggerFactory;
|
||||||
_restOptions = restOptions;
|
_restOptions = restOptions;
|
||||||
_socketOptions = socketOptions;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private IOptions<TRestOptions> SetRestEnvironment(IOptions<TRestOptions> options, TEnvironment? environment)
|
private IOptions<TRestOptions> SetRestEnvironment(IOptions<TRestOptions> options, TEnvironment? environment)
|
||||||
{
|
{
|
||||||
if (environment == null)
|
if (environment == null)
|
||||||
@@ -61,22 +56,10 @@ namespace CryptoExchange.Net.Clients
|
|||||||
return Options.Create(newRestClientOptions);
|
return Options.Create(newRestClientOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IOptions<TSocketOptions> SetSocketEnvironment(IOptions<TSocketOptions> options, TEnvironment? environment)
|
|
||||||
{
|
|
||||||
if (environment == null)
|
|
||||||
return options;
|
|
||||||
|
|
||||||
var newSocketClientOptions = new TSocketOptions();
|
|
||||||
options.Value.Set(newSocketClientOptions);
|
|
||||||
newSocketClientOptions.Environment = environment;
|
|
||||||
return Options.Create(newSocketClientOptions);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void InitializeUserClient(string userIdentifier, TCredentials credentials, TEnvironment? environment = null)
|
public virtual void InitializeUserClient(string userIdentifier, TCredentials credentials, TEnvironment? environment = null)
|
||||||
{
|
{
|
||||||
CreateRestClient(userIdentifier, credentials, environment);
|
CreateRestClient(userIdentifier, credentials, environment);
|
||||||
CreateSocketClient(userIdentifier, credentials, environment);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@@ -88,15 +71,6 @@ namespace CryptoExchange.Net.Clients
|
|||||||
return client;
|
return client;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public TSocketClient GetSocketClient(string userIdentifier, TCredentials? credentials = null, TEnvironment? environment = null)
|
|
||||||
{
|
|
||||||
if (!_socketClients.TryGetValue(userIdentifier, out var client) || client.Disposed)
|
|
||||||
client = CreateSocketClient(userIdentifier, credentials, environment);
|
|
||||||
|
|
||||||
return client;
|
|
||||||
}
|
|
||||||
|
|
||||||
private TRestClient CreateRestClient(string userIdentifier, TCredentials? credentials, TEnvironment? environment)
|
private TRestClient CreateRestClient(string userIdentifier, TCredentials? credentials, TEnvironment? environment)
|
||||||
{
|
{
|
||||||
var clientRestOptions = SetRestEnvironment(_restOptions, environment);
|
var clientRestOptions = SetRestEnvironment(_restOptions, environment);
|
||||||
@@ -109,6 +83,94 @@ namespace CryptoExchange.Net.Clients
|
|||||||
return client;
|
return client;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructs a new instance of the rest client
|
||||||
|
/// </summary>
|
||||||
|
protected abstract TRestClient ConstructRestClient(
|
||||||
|
HttpClient client,
|
||||||
|
ILoggerFactory? loggerFactory,
|
||||||
|
IOptions<TRestOptions> options);
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public virtual void ClearUserClients(string userIdentifier)
|
||||||
|
{
|
||||||
|
_restClients.TryRemove(userIdentifier, out var restClient);
|
||||||
|
restClient?.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public virtual void Clear()
|
||||||
|
{
|
||||||
|
foreach (var client in _restClients.Values)
|
||||||
|
client.Dispose();
|
||||||
|
_restClients.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Applies the provided options delegate to a new instance of the specified type.
|
||||||
|
/// </summary>
|
||||||
|
protected static T ApplyOptionsDelegate<T>(Action<T>? del) where T : new()
|
||||||
|
{
|
||||||
|
var opts = new T();
|
||||||
|
del?.Invoke(opts);
|
||||||
|
return opts;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public abstract class UserClientProvider<TRestClient, TSocketClient, TRestOptions, TSocketOptions, TCredentials, TEnvironment>
|
||||||
|
: UserClientProvider<TRestClient, TRestOptions, TCredentials, TEnvironment>
|
||||||
|
where TRestClient : IRestClient<TCredentials>
|
||||||
|
where TSocketClient : ISocketClient<TCredentials>
|
||||||
|
where TRestOptions : RestExchangeOptions<TEnvironment, TCredentials>, new()
|
||||||
|
where TSocketOptions : SocketExchangeOptions<TEnvironment, TCredentials>, new()
|
||||||
|
where TCredentials : ApiCredentials
|
||||||
|
where TEnvironment : TradeEnvironment
|
||||||
|
{
|
||||||
|
private ConcurrentDictionary<string, TSocketClient> _socketClients = new ConcurrentDictionary<string, TSocketClient>();
|
||||||
|
private readonly IOptions<TSocketOptions> _socketOptions;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ctor
|
||||||
|
/// </summary>
|
||||||
|
public UserClientProvider(
|
||||||
|
HttpClient? httpClient,
|
||||||
|
ILoggerFactory? loggerFactory,
|
||||||
|
IOptions<TRestOptions> restOptions,
|
||||||
|
IOptions<TSocketOptions> socketOptions)
|
||||||
|
: base(httpClient, loggerFactory, restOptions)
|
||||||
|
{
|
||||||
|
_socketOptions = socketOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
private IOptions<TSocketOptions> SetSocketEnvironment(IOptions<TSocketOptions> options, TEnvironment? environment)
|
||||||
|
{
|
||||||
|
if (environment == null)
|
||||||
|
return options;
|
||||||
|
|
||||||
|
var newSocketClientOptions = new TSocketOptions();
|
||||||
|
options.Value.Set(newSocketClientOptions);
|
||||||
|
newSocketClientOptions.Environment = environment;
|
||||||
|
return Options.Create(newSocketClientOptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override void InitializeUserClient(string userIdentifier, TCredentials credentials, TEnvironment? environment = null)
|
||||||
|
{
|
||||||
|
base.InitializeUserClient(userIdentifier, credentials, environment);
|
||||||
|
CreateSocketClient(userIdentifier, credentials, environment);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public TSocketClient GetSocketClient(string userIdentifier, TCredentials? credentials = null, TEnvironment? environment = null)
|
||||||
|
{
|
||||||
|
if (!_socketClients.TryGetValue(userIdentifier, out var client) || client.Disposed)
|
||||||
|
client = CreateSocketClient(userIdentifier, credentials, environment);
|
||||||
|
|
||||||
|
return client;
|
||||||
|
}
|
||||||
|
|
||||||
private TSocketClient CreateSocketClient(string userIdentifier, TCredentials? credentials, TEnvironment? environment)
|
private TSocketClient CreateSocketClient(string userIdentifier, TCredentials? credentials, TEnvironment? environment)
|
||||||
{
|
{
|
||||||
var clientSocketOptions = SetSocketEnvironment(_socketOptions, environment);
|
var clientSocketOptions = SetSocketEnvironment(_socketOptions, environment);
|
||||||
@@ -121,15 +183,6 @@ namespace CryptoExchange.Net.Clients
|
|||||||
return client;
|
return client;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Constructs a new instance of the rest client
|
|
||||||
/// </summary>
|
|
||||||
protected abstract TRestClient ConstructRestClient(
|
|
||||||
HttpClient client,
|
|
||||||
ILoggerFactory? loggerFactory,
|
|
||||||
IOptions<TRestOptions> options);
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructs a new instance of the socket client
|
/// Constructs a new instance of the socket client
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -137,36 +190,23 @@ namespace CryptoExchange.Net.Clients
|
|||||||
ILoggerFactory? loggerFactory,
|
ILoggerFactory? loggerFactory,
|
||||||
IOptions<TSocketOptions> options);
|
IOptions<TSocketOptions> options);
|
||||||
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void ClearUserClients(string userIdentifier)
|
public override void ClearUserClients(string userIdentifier)
|
||||||
{
|
{
|
||||||
_restClients.TryRemove(userIdentifier, out var restClient);
|
base.ClearUserClients(userIdentifier);
|
||||||
|
|
||||||
_socketClients.TryRemove(userIdentifier, out var socketClient);
|
_socketClients.TryRemove(userIdentifier, out var socketClient);
|
||||||
restClient?.Dispose();
|
|
||||||
socketClient?.Dispose();
|
socketClient?.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void Clear()
|
public override void Clear()
|
||||||
{
|
{
|
||||||
foreach (var client in _restClients.Values)
|
base.Clear();
|
||||||
client.Dispose();
|
|
||||||
_restClients.Clear();
|
|
||||||
|
|
||||||
foreach (var client in _socketClients.Values)
|
foreach (var client in _socketClients.Values)
|
||||||
client.Dispose();
|
client.Dispose();
|
||||||
_socketClients.Clear();
|
_socketClients.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Applies the provided options delegate to a new instance of the specified type.
|
|
||||||
/// </summary>
|
|
||||||
protected static T ApplyOptionsDelegate<T>(Action<T>? del) where T : new()
|
|
||||||
{
|
|
||||||
var opts = new T();
|
|
||||||
del?.Invoke(opts);
|
|
||||||
return opts;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -88,7 +88,7 @@ namespace CryptoExchange.Net.Converters.SystemTextJson.MessageHandlers
|
|||||||
stream.Seek(0, SeekOrigin.Begin);
|
stream.Seek(0, SeekOrigin.Begin);
|
||||||
var written = new StreamReader(stream).ReadBlock(dataSnippet, 0, _errorResponseSnippetLimit);
|
var written = new StreamReader(stream).ReadBlock(dataSnippet, 0, _errorResponseSnippetLimit);
|
||||||
var data = new string(dataSnippet, 0, written);
|
var data = new string(dataSnippet, 0, written);
|
||||||
errorMsg += $": {data}";
|
errorMsg += $": {(string.IsNullOrEmpty(data) ? "(empty)" : data)}";
|
||||||
if (data.Length == _errorResponseSnippetLimit)
|
if (data.Length == _errorResponseSnippetLimit)
|
||||||
errorMsg += " (truncated)";
|
errorMsg += " (truncated)";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,9 +6,9 @@
|
|||||||
<PackageId>CryptoExchange.Net</PackageId>
|
<PackageId>CryptoExchange.Net</PackageId>
|
||||||
<Authors>JKorf</Authors>
|
<Authors>JKorf</Authors>
|
||||||
<Description>CryptoExchange.Net is a base library which is used to implement different cryptocurrency (exchange) API's. It provides a standardized way of implementing different API's, which results in a very similar experience for users of the API implementations.</Description>
|
<Description>CryptoExchange.Net is a base library which is used to implement different cryptocurrency (exchange) API's. It provides a standardized way of implementing different API's, which results in a very similar experience for users of the API implementations.</Description>
|
||||||
<PackageVersion>12.2.0</PackageVersion>
|
<PackageVersion>12.5.0</PackageVersion>
|
||||||
<AssemblyVersion>12.2.0</AssemblyVersion>
|
<AssemblyVersion>12.5.0</AssemblyVersion>
|
||||||
<FileVersion>12.2.0</FileVersion>
|
<FileVersion>12.5.0</FileVersion>
|
||||||
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
|
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
|
||||||
<PackageTags>OKX;OKX.Net;Mexc;Mexc.Net;Kucoin;Kucoin.Net;Kraken;Kraken.Net;Huobi;Huobi.Net;CoinEx;CoinEx.Net;Bybit;Bybit.Net;Bitget;Bitget.Net;Bitfinex;Bitfinex.Net;Binance;Binance.Net;CryptoCurrency;CryptoCurrency Exchange;CryptoExchange.Net</PackageTags>
|
<PackageTags>OKX;OKX.Net;Mexc;Mexc.Net;Kucoin;Kucoin.Net;Kraken;Kraken.Net;Huobi;Huobi.Net;CoinEx;CoinEx.Net;Bybit;Bybit.Net;Bitget;Bitget.Net;Bitfinex;Bitfinex.Net;Binance;Binance.Net;CryptoCurrency;CryptoCurrency Exchange;CryptoExchange.Net</PackageTags>
|
||||||
<RepositoryType>git</RepositoryType>
|
<RepositoryType>git</RepositoryType>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using CryptoExchange.Net.SharedApis;
|
|||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.IO.Compression;
|
using System.IO.Compression;
|
||||||
@@ -387,14 +388,14 @@ namespace CryptoExchange.Net
|
|||||||
services.AddTransient(x => (ITradeHistoryRestClient)client(x)!);
|
services.AddTransient(x => (ITradeHistoryRestClient)client(x)!);
|
||||||
if (typeof(IWithdrawalRestClient).IsAssignableFrom(typeof(T)))
|
if (typeof(IWithdrawalRestClient).IsAssignableFrom(typeof(T)))
|
||||||
services.AddTransient(x => (IWithdrawalRestClient)client(x)!);
|
services.AddTransient(x => (IWithdrawalRestClient)client(x)!);
|
||||||
if (typeof(IWithdrawRestClient).IsAssignableFrom(typeof(T)))
|
if (typeof(IWithdrawEndpoint).IsAssignableFrom(typeof(T)))
|
||||||
services.AddTransient(x => (IWithdrawRestClient)client(x)!);
|
services.AddTransient(x => (IWithdrawEndpoint)client(x)!);
|
||||||
if (typeof(IFeeRestClient).IsAssignableFrom(typeof(T)))
|
if (typeof(IFeeRestClient).IsAssignableFrom(typeof(T)))
|
||||||
services.AddTransient(x => (IFeeRestClient)client(x)!);
|
services.AddTransient(x => (IFeeRestClient)client(x)!);
|
||||||
if (typeof(IBookTickerRestClient).IsAssignableFrom(typeof(T)))
|
if (typeof(IBookTickerRestClient).IsAssignableFrom(typeof(T)))
|
||||||
services.AddTransient(x => (IBookTickerRestClient)client(x)!);
|
services.AddTransient(x => (IBookTickerRestClient)client(x)!);
|
||||||
if (typeof(ITransferRestClient).IsAssignableFrom(typeof(T)))
|
if (typeof(ITransferEndpoint).IsAssignableFrom(typeof(T)))
|
||||||
services.AddTransient(x => (ITransferRestClient)client(x)!);
|
services.AddTransient(x => (ITransferEndpoint)client(x)!);
|
||||||
|
|
||||||
if (typeof(ISpotOrderRestClient).IsAssignableFrom(typeof(T)))
|
if (typeof(ISpotOrderRestClient).IsAssignableFrom(typeof(T)))
|
||||||
services.AddTransient(x => (ISpotOrderRestClient)client(x)!);
|
services.AddTransient(x => (ISpotOrderRestClient)client(x)!);
|
||||||
@@ -461,11 +462,52 @@ namespace CryptoExchange.Net
|
|||||||
|
|
||||||
if (typeof(ISpotOrderSocketClient).IsAssignableFrom(typeof(T)))
|
if (typeof(ISpotOrderSocketClient).IsAssignableFrom(typeof(T)))
|
||||||
services.AddTransient(x => (ISpotOrderSocketClient)client(x)!);
|
services.AddTransient(x => (ISpotOrderSocketClient)client(x)!);
|
||||||
|
if (typeof(ISpotOrderManagementSocketClient).IsAssignableFrom(typeof(T)))
|
||||||
|
services.AddTransient(x => (ISpotOrderManagementSocketClient)client(x)!);
|
||||||
|
|
||||||
if (typeof(IFuturesOrderSocketClient).IsAssignableFrom(typeof(T)))
|
if (typeof(IFuturesOrderSocketClient).IsAssignableFrom(typeof(T)))
|
||||||
services.AddTransient(x => (IFuturesOrderSocketClient)client(x)!);
|
services.AddTransient(x => (IFuturesOrderSocketClient)client(x)!);
|
||||||
if (typeof(IPositionSocketClient).IsAssignableFrom(typeof(T)))
|
if (typeof(IPositionSocketClient).IsAssignableFrom(typeof(T)))
|
||||||
services.AddTransient(x => (IPositionSocketClient)client(x)!);
|
services.AddTransient(x => (IPositionSocketClient)client(x)!);
|
||||||
|
if (typeof(IFuturesOrderManagementSocketClient).IsAssignableFrom(typeof(T)))
|
||||||
|
services.AddTransient(x => (IFuturesOrderManagementSocketClient)client(x)!);
|
||||||
|
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Register a strict Shared API aggregate and all endpoint capabilities
|
||||||
|
/// inherited by that aggregate.
|
||||||
|
/// </summary>
|
||||||
|
public static IServiceCollection RegisterSharedApi<
|
||||||
|
#if NET5_0_OR_GREATER
|
||||||
|
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.Interfaces)]
|
||||||
|
#endif
|
||||||
|
TSharedApi
|
||||||
|
>(
|
||||||
|
this IServiceCollection services,
|
||||||
|
Func<IServiceProvider, TSharedApi> factory)
|
||||||
|
where TSharedApi : class, ISharedClient
|
||||||
|
{
|
||||||
|
// Register the exchange-specific aggregate itself.
|
||||||
|
services.AddTransient(
|
||||||
|
typeof(TSharedApi),
|
||||||
|
serviceProvider => factory(serviceProvider));
|
||||||
|
|
||||||
|
var endpointInterfaces = typeof(TSharedApi)
|
||||||
|
.GetInterfaces()
|
||||||
|
.Where(x =>
|
||||||
|
x != typeof(ISharedApiEndpoint)
|
||||||
|
&& typeof(ISharedApiEndpoint).IsAssignableFrom(x))
|
||||||
|
.Distinct()
|
||||||
|
.ToArray();
|
||||||
|
|
||||||
|
foreach (var endpointInterface in endpointInterfaces)
|
||||||
|
{
|
||||||
|
services.AddTransient(
|
||||||
|
endpointInterface,
|
||||||
|
serviceProvider => factory(serviceProvider));
|
||||||
|
}
|
||||||
|
|
||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ namespace CryptoExchange.Net.Logging.Extensions
|
|||||||
_receivedMessageNotMatchedToAnyListener = LoggerMessage.Define<int, string, string, string>(
|
_receivedMessageNotMatchedToAnyListener = LoggerMessage.Define<int, string, string, string>(
|
||||||
LogLevel.Warning,
|
LogLevel.Warning,
|
||||||
new EventId(2029, "ReceivedMessageNotMatchedToAnyListener"),
|
new EventId(2029, "ReceivedMessageNotMatchedToAnyListener"),
|
||||||
"[Sckt {SocketId}] received message not matched to any listener. TypeIdentifier: {TypeIdentifier}, ListenId: {ListenId}, current listeners: [{ListenIds}]");
|
"[Sckt {SocketId}] received message not matched to any listener. TypeIdentifier: {TypeIdentifier}, TopicFilter: {ListenId}, registered TopicFilters for type: [{TopicFilters}]");
|
||||||
|
|
||||||
_failedToParse = LoggerMessage.Define<int, string>(
|
_failedToParse = LoggerMessage.Define<int, string>(
|
||||||
LogLevel.Warning,
|
LogLevel.Warning,
|
||||||
@@ -326,9 +326,9 @@ namespace CryptoExchange.Net.Logging.Extensions
|
|||||||
_sendingData(logger, socketId, requestId, data, null);
|
_sendingData(logger, socketId, requestId, data, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ReceivedMessageNotMatchedToAnyListener(this ILogger logger, int socketId, string typeIdentifier, string listenId, string listenIds)
|
public static void ReceivedMessageNotMatchedToAnyListener(this ILogger logger, int socketId, string typeIdentifier, string topicFilter, string topicFilters)
|
||||||
{
|
{
|
||||||
_receivedMessageNotMatchedToAnyListener(logger, socketId, typeIdentifier, listenId, listenIds, null);
|
_receivedMessageNotMatchedToAnyListener(logger, socketId, typeIdentifier, topicFilter, topicFilters, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SendingByteData(this ILogger logger, int socketId, int requestId, int length)
|
public static void SendingByteData(this ILogger logger, int socketId, int requestId, int length)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
@@ -8,8 +9,11 @@ namespace CryptoExchange.Net.Objects;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Call result
|
/// Call result
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[DebuggerDisplay("{DebugView,nq}")]
|
||||||
public record CallResult : ICallResult
|
public record CallResult : ICallResult
|
||||||
{
|
{
|
||||||
|
private string DebugView => Success ? "Success" : $"Error: {Error}";
|
||||||
|
|
||||||
private static CallResult _successResult = new CallResult();
|
private static CallResult _successResult = new CallResult();
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using CryptoExchange.Net.SharedApis;
|
using CryptoExchange.Net.SharedApis;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
@@ -12,8 +13,11 @@ namespace CryptoExchange.Net.Objects;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// HTTP call result
|
/// HTTP call result
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[DebuggerDisplay("{DebugView,nq}")]
|
||||||
public record HttpResult : IHttpResult
|
public record HttpResult : IHttpResult
|
||||||
{
|
{
|
||||||
|
private string DebugView => $"[Req {RequestId}] " + (Success ? "Success" : $"Error: {Error}");
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a new success HTTP result
|
/// Create a new success HTTP result
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -251,8 +255,32 @@ public record HttpResult : IHttpResult
|
|||||||
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
[DebuggerDisplay("{DebugView,nq}")]
|
||||||
public record HttpResult<T> : HttpResult, IHttpResult<T>
|
public record HttpResult<T> : HttpResult, IHttpResult<T>
|
||||||
{
|
{
|
||||||
|
private string DebugView
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var result = new StringBuilder($"[Req {RequestId}] " + (Success ? "Success" : $"Error: {Error}"));
|
||||||
|
if (Data != null)
|
||||||
|
{
|
||||||
|
result.Append(", ");
|
||||||
|
var typeName = typeof(T).Name;
|
||||||
|
if (Data is Array ar)
|
||||||
|
{
|
||||||
|
result.Append($"{ar.Length} {typeName.Substring(0, typeName.Length - 2)}");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result.Append(typeName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ctor
|
/// ctor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
@@ -8,8 +9,11 @@ namespace CryptoExchange.Net.Objects;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// WebSocket call result
|
/// WebSocket call result
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[DebuggerDisplay("{DebugView,nq}")]
|
||||||
public record WebSocketResult : IWebSocketResult
|
public record WebSocketResult : IWebSocketResult
|
||||||
{
|
{
|
||||||
|
private string DebugView => $"[Sckt {ConnectionId}] " + (RequestId == null ? "" : $"[Req {RequestId}] ") + (Success ? "Success" : $"Error: {Error}");
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ctor
|
/// ctor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -183,7 +187,7 @@ public record WebSocketResult<T> : WebSocketResult, IWebSocketResult<T>
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public record QueryResult : WebSocketResult
|
public record QueryResult : WebSocketResult, IQueryResult
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ctor
|
/// ctor
|
||||||
@@ -208,6 +212,8 @@ public record QueryResult : WebSocketResult
|
|||||||
Url = result.Url,
|
Url = result.Url,
|
||||||
RequestId = result.RequestId,
|
RequestId = result.RequestId,
|
||||||
ResponseTime = result.ResponseTime,
|
ResponseTime = result.ResponseTime,
|
||||||
|
OriginalData = result.OriginalData,
|
||||||
|
RequestBody = result.RequestBody
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -288,6 +294,9 @@ public record QueryResult : WebSocketResult
|
|||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public string? RequestBody { get; init; }
|
public string? RequestBody { get; init; }
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public string? OriginalData { get; init; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@@ -314,7 +323,4 @@ public record QueryResult<T> : QueryResult, IQueryResult<T>
|
|||||||
public new bool Success => Error == null;
|
public new bool Success => Error == null;
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public T? Data { get; set; }
|
public T? Data { get; set; }
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public string? OriginalData { get; init; }
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,209 @@
|
|||||||
|
using CryptoExchange.Net.Sockets;
|
||||||
|
using CryptoExchange.Net.Sockets.Default;
|
||||||
|
using CryptoExchange.Net.Sockets.Default.Routing;
|
||||||
|
using Microsoft.Extensions.Logging.Abstractions;
|
||||||
|
using System;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CryptoExchange.Net.Objects.Sockets
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Controller for an update subscription which isn't backed by a websocket connection. Can be used for testing.
|
||||||
|
/// </summary>
|
||||||
|
public class ManualUpdateSubscription
|
||||||
|
{
|
||||||
|
private readonly Func<Task> _closeAsync;
|
||||||
|
private readonly Func<Task> _reconnectAsync;
|
||||||
|
private readonly Func<Task<CallResult>> _resubscribeAsync;
|
||||||
|
private readonly ManualSubscription _manualSubscription;
|
||||||
|
private int _closedEventInvoked;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The update subscription
|
||||||
|
/// </summary>
|
||||||
|
public UpdateSubscription Subscription { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The virtual socket id
|
||||||
|
/// </summary>
|
||||||
|
public int SocketId { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The last timestamp anything was received by the subscription
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? LastReceiveTime { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The current virtual websocket status
|
||||||
|
/// </summary>
|
||||||
|
public SocketStatus SocketStatus { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create a manually controlled update subscription
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="socketId">The virtual socket id</param>
|
||||||
|
/// <param name="closeAsync">Callback when the subscription is closed</param>
|
||||||
|
/// <param name="reconnectAsync">Callback when a reconnect is requested</param>
|
||||||
|
/// <param name="resubscribeAsync">Callback when a resubscribe is requested</param>
|
||||||
|
public ManualUpdateSubscription(
|
||||||
|
int socketId = 0,
|
||||||
|
Func<Task>? closeAsync = null,
|
||||||
|
Func<Task>? reconnectAsync = null,
|
||||||
|
Func<Task<CallResult>>? resubscribeAsync = null)
|
||||||
|
{
|
||||||
|
SocketId = socketId;
|
||||||
|
SocketStatus = SocketStatus.Connected;
|
||||||
|
_closeAsync = closeAsync ?? (() => Task.CompletedTask);
|
||||||
|
_reconnectAsync = reconnectAsync ?? (() => Task.CompletedTask);
|
||||||
|
_resubscribeAsync = resubscribeAsync ?? (() => Task.FromResult(CallResult.Ok()));
|
||||||
|
|
||||||
|
_manualSubscription = new ManualSubscription();
|
||||||
|
_manualSubscription.Status = SubscriptionStatus.Subscribed;
|
||||||
|
Subscription = new UpdateSubscription(this, _manualSubscription);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Set the last timestamp anything was received by the subscription
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="timestamp">The receive timestamp</param>
|
||||||
|
public void SetLastReceiveTime(DateTime? timestamp)
|
||||||
|
{
|
||||||
|
LastReceiveTime = timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Set the virtual websocket status
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="status">The status</param>
|
||||||
|
public void SetSocketStatus(SocketStatus status)
|
||||||
|
{
|
||||||
|
SocketStatus = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Set the subscription status
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="status">The status</param>
|
||||||
|
public void SetSubscriptionStatus(SubscriptionStatus status)
|
||||||
|
{
|
||||||
|
_manualSubscription.Status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Invoke the connection lost event
|
||||||
|
/// </summary>
|
||||||
|
public void InvokeConnectionLost()
|
||||||
|
{
|
||||||
|
Subscription.HandleConnectionLostEvent();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Invoke the connection restored event
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disconnectedPeriod">The period the connection was disconnected</param>
|
||||||
|
public void InvokeConnectionRestored(TimeSpan disconnectedPeriod)
|
||||||
|
{
|
||||||
|
Subscription.HandleConnectionRestoredEvent(disconnectedPeriod);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Invoke the connection closed event
|
||||||
|
/// </summary>
|
||||||
|
public void InvokeConnectionClosed()
|
||||||
|
{
|
||||||
|
if (Interlocked.Exchange(ref _closedEventInvoked, 1) != 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
SocketStatus = SocketStatus.Closed;
|
||||||
|
_manualSubscription.Status = SubscriptionStatus.Closed;
|
||||||
|
Subscription.HandleConnectionClosedEvent();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Invoke the resubscribing failed event
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="error">The resubscribe error</param>
|
||||||
|
public void InvokeResubscribingFailed(Error error)
|
||||||
|
{
|
||||||
|
if (error == null)
|
||||||
|
throw new ArgumentNullException(nameof(error));
|
||||||
|
|
||||||
|
Subscription.HandleResubscribeFailedEvent(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Invoke the activity paused event
|
||||||
|
/// </summary>
|
||||||
|
public void InvokeActivityPaused()
|
||||||
|
{
|
||||||
|
Subscription.HandlePausedEvent();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Invoke the activity unpaused event
|
||||||
|
/// </summary>
|
||||||
|
public void InvokeActivityUnpaused()
|
||||||
|
{
|
||||||
|
Subscription.HandleUnpausedEvent();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Invoke the exception event
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="exception">The exception</param>
|
||||||
|
public void InvokeException(Exception exception)
|
||||||
|
{
|
||||||
|
if (exception == null)
|
||||||
|
throw new ArgumentNullException(nameof(exception));
|
||||||
|
|
||||||
|
_manualSubscription.InvokeExceptionHandler(exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal async Task CloseAsync()
|
||||||
|
{
|
||||||
|
if (_manualSubscription.Status == SubscriptionStatus.Closed
|
||||||
|
|| _manualSubscription.Status == SubscriptionStatus.Closing)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_manualSubscription.Status = SubscriptionStatus.Closing;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await _closeAsync().ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_manualSubscription.Status = SubscriptionStatus.Closed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal Task ReconnectAsync()
|
||||||
|
{
|
||||||
|
return _reconnectAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
internal Task<CallResult> ResubscribeAsync()
|
||||||
|
{
|
||||||
|
return _resubscribeAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ManualSubscription : Subscription
|
||||||
|
{
|
||||||
|
public ManualSubscription()
|
||||||
|
: base(NullLogger.Instance, false)
|
||||||
|
{
|
||||||
|
MessageRouter = MessageRouter.Create();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override Query? GetSubQuery(SocketConnection connection)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override Query? GetUnsubQuery(SocketConnection connection)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,7 +12,8 @@ namespace CryptoExchange.Net.Objects.Sockets
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class UpdateSubscription
|
public class UpdateSubscription
|
||||||
{
|
{
|
||||||
private readonly SocketConnection _connection;
|
private readonly SocketConnection? _connection;
|
||||||
|
private readonly ManualUpdateSubscription? _manualSubscription;
|
||||||
internal readonly Subscription _subscription;
|
internal readonly Subscription _subscription;
|
||||||
|
|
||||||
#if NET9_0_OR_GREATER
|
#if NET9_0_OR_GREATER
|
||||||
@@ -102,7 +103,7 @@ namespace CryptoExchange.Net.Objects.Sockets
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The id of the socket
|
/// The id of the socket
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int SocketId => _connection.SocketId;
|
public int SocketId => _connection?.SocketId ?? _manualSubscription!.SocketId;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The id of the subscription
|
/// The id of the subscription
|
||||||
@@ -112,12 +113,12 @@ namespace CryptoExchange.Net.Objects.Sockets
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The last timestamp anything was received from the server
|
/// The last timestamp anything was received from the server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime? LastReceiveTime => _connection.LastReceiveTime;
|
public DateTime? LastReceiveTime => _connection?.LastReceiveTime ?? _manualSubscription!.LastReceiveTime;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The current websocket status
|
/// The current websocket status
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public SocketStatus SocketStatus => _connection.Status;
|
public SocketStatus SocketStatus => _connection?.Status ?? _manualSubscription!.SocketStatus;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The current subscription status
|
/// The current subscription status
|
||||||
@@ -143,6 +144,18 @@ namespace CryptoExchange.Net.Objects.Sockets
|
|||||||
_subscription.StatusChanged += (x) => SubscriptionStatusChanged?.Invoke(x);
|
_subscription.StatusChanged += (x) => SubscriptionStatusChanged?.Invoke(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ctor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="manualSubscription">The manual subscription for controlling events and data</param>
|
||||||
|
/// <param name="subscription">The subscription</param>
|
||||||
|
internal UpdateSubscription(ManualUpdateSubscription manualSubscription, Subscription subscription)
|
||||||
|
{
|
||||||
|
_manualSubscription = manualSubscription;
|
||||||
|
_subscription = subscription;
|
||||||
|
_subscription.StatusChanged += (x) => SubscriptionStatusChanged?.Invoke(x);
|
||||||
|
}
|
||||||
|
|
||||||
private void UnsubscribeConnectionEvents()
|
private void UnsubscribeConnectionEvents()
|
||||||
{
|
{
|
||||||
lock (_eventLock)
|
lock (_eventLock)
|
||||||
@@ -150,22 +163,26 @@ namespace CryptoExchange.Net.Objects.Sockets
|
|||||||
if (!_connectionEventsSubscribed)
|
if (!_connectionEventsSubscribed)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_connection.ConnectionClosed -= HandleConnectionClosedEvent;
|
if (_connection != null)
|
||||||
_connection.ConnectionLost -= HandleConnectionLostEvent;
|
{
|
||||||
_connection.ConnectionRestored -= HandleConnectionRestoredEvent;
|
_connection.ConnectionClosed -= HandleConnectionClosedEvent;
|
||||||
_connection.ResubscribingFailed -= HandleResubscribeFailedEvent;
|
_connection.ConnectionLost -= HandleConnectionLostEvent;
|
||||||
_connection.ActivityPaused -= HandlePausedEvent;
|
_connection.ConnectionRestored -= HandleConnectionRestoredEvent;
|
||||||
_connection.ActivityUnpaused -= HandleUnpausedEvent;
|
_connection.ResubscribingFailed -= HandleResubscribeFailedEvent;
|
||||||
|
_connection.ActivityPaused -= HandlePausedEvent;
|
||||||
|
_connection.ActivityUnpaused -= HandleUnpausedEvent;
|
||||||
|
}
|
||||||
|
|
||||||
_connectionEventsSubscribed = false;
|
_connectionEventsSubscribed = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleConnectionClosedEvent()
|
internal void HandleConnectionClosedEvent()
|
||||||
{
|
{
|
||||||
UnsubscribeConnectionEvents();
|
UnsubscribeConnectionEvents();
|
||||||
|
|
||||||
// If we're not the subscription closing this connection don't bother emitting
|
// If we're not the subscription closing this connection don't bother emitting
|
||||||
if (!_subscription.IsClosingConnection)
|
if (_connection != null && !_subscription.IsClosingConnection)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
List<Action> handlers;
|
List<Action> handlers;
|
||||||
@@ -176,7 +193,7 @@ namespace CryptoExchange.Net.Objects.Sockets
|
|||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleConnectionLostEvent()
|
internal void HandleConnectionLostEvent()
|
||||||
{
|
{
|
||||||
if (!_subscription.Active)
|
if (!_subscription.Active)
|
||||||
{
|
{
|
||||||
@@ -192,7 +209,7 @@ namespace CryptoExchange.Net.Objects.Sockets
|
|||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleConnectionRestoredEvent(TimeSpan period)
|
internal void HandleConnectionRestoredEvent(TimeSpan period)
|
||||||
{
|
{
|
||||||
if (!_subscription.Active)
|
if (!_subscription.Active)
|
||||||
{
|
{
|
||||||
@@ -208,7 +225,7 @@ namespace CryptoExchange.Net.Objects.Sockets
|
|||||||
callback(period);
|
callback(period);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleResubscribeFailedEvent(Error error)
|
internal void HandleResubscribeFailedEvent(Error error)
|
||||||
{
|
{
|
||||||
if (!_subscription.Active)
|
if (!_subscription.Active)
|
||||||
{
|
{
|
||||||
@@ -224,7 +241,7 @@ namespace CryptoExchange.Net.Objects.Sockets
|
|||||||
callback(error);
|
callback(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandlePausedEvent()
|
internal void HandlePausedEvent()
|
||||||
{
|
{
|
||||||
if (!_subscription.Active)
|
if (!_subscription.Active)
|
||||||
{
|
{
|
||||||
@@ -240,7 +257,7 @@ namespace CryptoExchange.Net.Objects.Sockets
|
|||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleUnpausedEvent()
|
internal void HandleUnpausedEvent()
|
||||||
{
|
{
|
||||||
if (!_subscription.Active)
|
if (!_subscription.Active)
|
||||||
{
|
{
|
||||||
@@ -262,7 +279,10 @@ namespace CryptoExchange.Net.Objects.Sockets
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task CloseAsync()
|
public Task CloseAsync()
|
||||||
{
|
{
|
||||||
return _connection.CloseAsync(_subscription);
|
if (_connection != null)
|
||||||
|
return _connection.CloseAsync(_subscription);
|
||||||
|
|
||||||
|
return _manualSubscription!.CloseAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -271,7 +291,10 @@ namespace CryptoExchange.Net.Objects.Sockets
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task ReconnectAsync()
|
public Task ReconnectAsync()
|
||||||
{
|
{
|
||||||
return _connection.TriggerReconnectAsync();
|
if (_connection != null)
|
||||||
|
return _connection.TriggerReconnectAsync();
|
||||||
|
|
||||||
|
return _manualSubscription!.ReconnectAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -280,7 +303,13 @@ namespace CryptoExchange.Net.Objects.Sockets
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
internal async Task UnsubscribeAsync()
|
internal async Task UnsubscribeAsync()
|
||||||
{
|
{
|
||||||
await _connection.UnsubscribeAsync(_subscription).ConfigureAwait(false);
|
if (_connection != null)
|
||||||
|
{
|
||||||
|
await _connection.UnsubscribeAsync(_subscription).ConfigureAwait(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await _manualSubscription!.CloseAsync().ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -289,7 +318,10 @@ namespace CryptoExchange.Net.Objects.Sockets
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
internal async Task<CallResult> ResubscribeAsync()
|
internal async Task<CallResult> ResubscribeAsync()
|
||||||
{
|
{
|
||||||
return await _connection.ResubscribeAsync(_subscription).ConfigureAwait(false);
|
if (_connection != null)
|
||||||
|
return await _connection.ResubscribeAsync(_subscription).ConfigureAwait(false);
|
||||||
|
|
||||||
|
return await _manualSubscription!.ResubscribeAsync().ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -289,6 +289,7 @@ namespace CryptoExchange.Net.OrderBook
|
|||||||
if (!startResult.Success)
|
if (!startResult.Success)
|
||||||
{
|
{
|
||||||
Status = OrderBookStatus.Disconnected;
|
Status = OrderBookStatus.Disconnected;
|
||||||
|
_queueEvent.Set();
|
||||||
return CallResult.Fail(startResult.Error!);
|
return CallResult.Fail(startResult.Error!);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace CryptoExchange.Net.SharedApis
|
namespace CryptoExchange.Net.SharedApis
|
||||||
{
|
{
|
||||||
@@ -22,6 +23,11 @@ namespace CryptoExchange.Net.SharedApis
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
bool Authenticated { get; }
|
bool Authenticated { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Options for the endpoints exposed by this shared API.
|
||||||
|
/// </summary>
|
||||||
|
IReadOnlyCollection<EndpointOptions> EndpointOptions { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get info on the client and supported features
|
/// Get info on the client and supported features
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
+1
-1
@@ -109,7 +109,7 @@ namespace CryptoExchange.Net.SharedApis
|
|||||||
/// Use <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> to check for required and optional parameters for the request. <br />
|
/// Use <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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.
|
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
GetFuturesUserTradesOptions GetFuturesUserTradesOptions { get; }
|
GetFuturesUserTradeHistoryOptions GetFuturesUserTradesOptions { get; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get futures user trade records, see <see cref="GetFuturesUserTradesOptions"/> for request options and exchange specific required/optional parameters. <br />
|
/// Get futures user trade records, see <see cref="GetFuturesUserTradesOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
/// The result is paginated, if there are more results to be retrieved, the `NextPageRequest` property of the result will contain the pagination request to be used for the next request to continue pagination.
|
/// The result is paginated, if there are more results to be retrieved, the `NextPageRequest` property of the result will contain the pagination request to be used for the next request to continue pagination.
|
||||||
+1
-1
@@ -27,7 +27,7 @@ namespace CryptoExchange.Net.SharedApis
|
|||||||
/// Use <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> to check for required and optional parameters for the request. <br />
|
/// Use <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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.
|
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
GetFuturesTickersOptions GetFuturesTickersOptions { get; }
|
GetAllFuturesTickersOptions GetFuturesTickersOptions { get; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get ticker info for all futures symbols, see <see cref="GetFuturesTickersOptions"/> for request options and exchange specific required/optional parameters. <br />
|
/// Get ticker info for all futures symbols, see <see cref="GetFuturesTickersOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
/// </summary>
|
/// </summary>
|
||||||
+1
-1
@@ -29,7 +29,7 @@ namespace CryptoExchange.Net.SharedApis
|
|||||||
/// Use <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> to check for required and optional parameters for the request. <br />
|
/// Use <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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.
|
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
GetDepositsOptions GetDepositsOptions { get; }
|
GetDepositHistoryOptions GetDepositsOptions { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get deposit records, see <see cref="GetDepositsOptions"/> for request options and exchange specific required/optional parameters. <br />
|
/// Get deposit records, see <see cref="GetDepositsOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
+5
-2
@@ -1,11 +1,14 @@
|
|||||||
using CryptoExchange.Net.Objects;
|
using CryptoExchange.Net.Objects;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace CryptoExchange.Net.SharedApis
|
namespace CryptoExchange.Net.SharedApis
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Client for requesting to withdraw funds from the exchange
|
/// Client for withdrawing funds
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IWithdrawRestClient : ISharedClient
|
public interface IWithdrawRestClient : ISharedClient
|
||||||
{
|
{
|
||||||
@@ -24,4 +27,4 @@ namespace CryptoExchange.Net.SharedApis
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<HttpResult<SharedId>> WithdrawAsync(WithdrawRequest request, CancellationToken ct = default);
|
Task<HttpResult<SharedId>> WithdrawAsync(WithdrawRequest request, CancellationToken ct = default);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
|
|||||||
/// Use <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> to check for required and optional parameters for the request. <br />
|
/// Use <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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.
|
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
GetWithdrawalsOptions GetWithdrawalsOptions { get; }
|
GetWithdrawalHistoryOptions GetWithdrawalsOptions { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get withdrawal records, see <see cref="GetWithdrawalsOptions"/> for request options and exchange specific required/optional parameters. <br />
|
/// Get withdrawal records, see <see cref="GetWithdrawalsOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
+1
-2
@@ -44,7 +44,6 @@ namespace CryptoExchange.Net.SharedApis
|
|||||||
PlaceSpotOrderOptions PlaceSpotOrderOptions { get; }
|
PlaceSpotOrderOptions PlaceSpotOrderOptions { get; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Place a new spot order, see <see cref="PlaceSpotOrderOptions"/> for request options and exchange specific required/optional parameters. <br />
|
/// Place a new spot order, see <see cref="PlaceSpotOrderOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
/// The result is paginated, if there are more results to be retrieved, the `NextPageRequest` property of the result will contain the pagination request to be used for the next request to continue pagination.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="request">Request info</param>
|
/// <param name="request">Request info</param>
|
||||||
/// <param name="ct">Cancellation token</param>
|
/// <param name="ct">Cancellation token</param>
|
||||||
@@ -110,7 +109,7 @@ namespace CryptoExchange.Net.SharedApis
|
|||||||
/// Use <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> to check for required and optional parameters for the request. <br />
|
/// Use <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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.
|
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
GetSpotUserTradesOptions GetSpotUserTradesOptions { get; }
|
GetSpotUserTradeHistoryOptions GetSpotUserTradesOptions { get; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get spot user trade records, see <see cref="GetSpotUserTradesOptions"/> for request options and exchange specific required/optional parameters. <br />
|
/// Get spot user trade records, see <see cref="GetSpotUserTradesOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
/// The result is paginated, if there are more results to be retrieved, the `NextPageRequest` property of the result will contain the pagination request to be used for the next request to continue pagination.
|
/// The result is paginated, if there are more results to be retrieved, the `NextPageRequest` property of the result will contain the pagination request to be used for the next request to continue pagination.
|
||||||
+1
-1
@@ -26,7 +26,7 @@ namespace CryptoExchange.Net.SharedApis
|
|||||||
/// Use <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> to check for required and optional parameters for the request. <br />
|
/// Use <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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.
|
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
GetSpotTickersOptions GetSpotTickersOptions { get; }
|
GetAllSpotTickersOptions GetSpotTickersOptions { get; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get tickers for all spot symbols, see <see cref="GetSpotTickersOptions"/> for request options and exchange specific required/optional parameters. <br />
|
/// Get tickers for all spot symbols, see <see cref="GetSpotTickersOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
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>
|
||||||
|
/// Endpoint definition for retrieving all assets supported on an exchange.
|
||||||
|
/// </summary>
|
||||||
|
public interface IGetAllAssetsEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Assets request options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
GetAssetsOptions GetAssetsOptions { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get info on all assets the exchange supports, see <see cref="GetAssetsOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
Task<HttpResult<SharedAsset[]>> GetAssetsAsync(GetAssetsRequest request, CancellationToken ct = default);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
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>
|
||||||
|
/// Endpoint definition for retrieving an asset on an exchange.
|
||||||
|
/// </summary>
|
||||||
|
public interface IGetAssetEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Asset request options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
GetAssetOptions GetAssetOptions { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get info on a specific asset, see <see cref="GetAssetOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
Task<HttpResult<SharedAsset>> GetAssetAsync(GetAssetRequest request, CancellationToken ct = default);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
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>
|
||||||
|
/// Endpoint definition for retrieving user asset balances on an exchange.
|
||||||
|
/// </summary>
|
||||||
|
public interface IGetBalancesEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Balances request options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
GetBalancesOptions GetBalancesOptions { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get balances for the user, see <see cref="GetBalancesOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<HttpResult<SharedBalance[]>> GetBalancesAsync(GetBalancesRequest request, CancellationToken ct = default);
|
||||||
|
}
|
||||||
|
}
|
||||||
+30
@@ -0,0 +1,30 @@
|
|||||||
|
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>
|
||||||
|
/// Endpoint definition for retrieving user deposit addresses on an exchange.
|
||||||
|
/// </summary>
|
||||||
|
public interface IGetDepositAddressesEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Deposit addresses request options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
GetDepositAddressesOptions GetDepositAddressesOptions { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get deposit addresses for an asset, see <see cref="GetDepositAddressesOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<HttpResult<SharedDepositAddress[]>> GetDepositAddressesAsync(GetDepositAddressesRequest request, CancellationToken ct = default);
|
||||||
|
}
|
||||||
|
}
|
||||||
+32
@@ -0,0 +1,32 @@
|
|||||||
|
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>
|
||||||
|
/// Endpoint definition for retrieving user deposit history on an exchange.
|
||||||
|
/// </summary>
|
||||||
|
public interface IGetDepositHistoryEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Deposits request options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
GetDepositHistoryOptions GetDepositHistoryOptions { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get deposit records, see <see cref="GetDepositHistoryOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// The result is paginated, if there are more results to be retrieved, the <see cref="HttpResult{T}.NextPageRequest"/> property of the result will contain the pagination request to be used for the next request to continue pagination.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="nextPageToken">The pagination request from the previous request result <see cref="HttpResult{T}.NextPageRequest"/> property to continue pagination</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<HttpResult<SharedDeposit[]>> GetDepositHistoryAsync(GetDepositsRequest request, PageRequest? nextPageToken = null, CancellationToken ct = default);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
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>
|
||||||
|
/// Endpoint definition for retrieving user trading fees on an exchange.
|
||||||
|
/// </summary>
|
||||||
|
public interface IGetFeesEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Fee request options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
GetFeeOptions GetFeeOptions { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get trading fees for a symbol, see <see cref="GetFeeOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
Task<HttpResult<SharedFee>> GetFeesAsync(GetFeeRequest request, CancellationToken ct = default);
|
||||||
|
}
|
||||||
|
}
|
||||||
+30
@@ -0,0 +1,30 @@
|
|||||||
|
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>
|
||||||
|
/// Endpoint definition for retrieving funding rate history for a symbol on an exchange.
|
||||||
|
/// </summary>
|
||||||
|
public interface IGetFundingRateHistoryEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Funding rate request options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
GetFundingRateHistoryOptions GetFundingRateHistoryOptions { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Get funding rate records, see <see cref="GetFundingRateHistoryOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// The result is paginated, if there are more results to be retrieved, the <see cref="HttpResult{T}.NextPageRequest"/> property of the result will contain the pagination request to be used for the next request to continue pagination.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="nextPageToken">The pagination request from the previous request result <see cref="HttpResult{T}.NextPageRequest"/> property to continue pagination</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
Task<HttpResult<SharedFundingRate[]>> GetFundingRateHistoryAsync(GetFundingRateHistoryRequest request, PageRequest? nextPageToken = null, CancellationToken ct = default);
|
||||||
|
}
|
||||||
|
}
|
||||||
+30
@@ -0,0 +1,30 @@
|
|||||||
|
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>
|
||||||
|
/// Endpoint definition for retrieving index price kline/candlestick data from an exchange
|
||||||
|
/// </summary>
|
||||||
|
public interface IGetIndexPriceKlinesEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Index price klines request options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
GetIndexPriceKlinesOptions GetIndexPriceKlinesOptions { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Get index price kline/candlestick data, see <see cref="GetIndexPriceKlinesOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// The result is paginated, if there are more results to be retrieved, the <see cref="HttpResult{T}.NextPageRequest"/> property of the result will contain the pagination request to be used for the next request to continue pagination.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="nextPageToken">The pagination request from the previous request result <see cref="HttpResult{T}.NextPageRequest"/> property to continue pagination</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
Task<HttpResult<SharedFuturesKline[]>> GetIndexPriceKlinesAsync(GetKlinesRequest request, PageRequest? nextPageToken = null, CancellationToken ct = default);
|
||||||
|
}
|
||||||
|
}
|
||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
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>
|
||||||
|
/// Endpoint definition for retrieving leverage information for a symbol on an exchange.
|
||||||
|
/// </summary>
|
||||||
|
public interface IGetLeverageEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Leverage request options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
GetLeverageOptions GetLeverageOptions { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Get the current leverage setting for a symbol, see <see cref="GetLeverageOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
Task<HttpResult<SharedLeverage>> GetLeverageAsync(GetLeverageRequest request, CancellationToken ct = default);
|
||||||
|
}
|
||||||
|
}
|
||||||
+33
@@ -0,0 +1,33 @@
|
|||||||
|
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>
|
||||||
|
/// Endpoint definition for setting leverage on an exchange.
|
||||||
|
/// </summary>
|
||||||
|
public interface ISetLeverageEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// How the leverage setting is configured on the exchange
|
||||||
|
/// </summary>
|
||||||
|
SharedLeverageSettingMode LeverageSettingType { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Leverage set request options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
SetLeverageOptions SetLeverageOptions { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Set the leverage for a symbol, see <see cref="SetLeverageOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
Task<HttpResult<SharedLeverage>> SetLeverageAsync(SetLeverageRequest request, CancellationToken ct = default);
|
||||||
|
}
|
||||||
|
}
|
||||||
+30
@@ -0,0 +1,30 @@
|
|||||||
|
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>
|
||||||
|
/// Endpoint definition for retrieving mark price kline/candlestick data from an exchange.
|
||||||
|
/// </summary>
|
||||||
|
public interface IGetMarkPriceKlinesEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Mark price klines request options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
GetMarkPriceKlinesOptions GetMarkPriceKlinesOptions { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Get mark price kline/candlestick data, see <see cref="GetMarkPriceKlinesOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// The result is paginated, if there are more results to be retrieved, the <see cref="HttpResult{T}.NextPageRequest"/> property of the result will contain the pagination request to be used for the next request to continue pagination.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="nextPageToken">The pagination request from the previous request result <see cref="HttpResult{T}.NextPageRequest"/> property to continue pagination</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
Task<HttpResult<SharedFuturesKline[]>> GetMarkPriceKlinesAsync(GetKlinesRequest request, PageRequest? nextPageToken = null, CancellationToken ct = default);
|
||||||
|
}
|
||||||
|
}
|
||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
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>
|
||||||
|
/// Endpoint definition for retrieving open interest data from an exchange
|
||||||
|
/// </summary>
|
||||||
|
public interface IGetOpenInterestEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Open interest request options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
GetOpenInterestOptions GetOpenInterestOptions { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Get the open interest for a symbol, see <see cref="GetOpenInterestOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
Task<HttpResult<SharedOpenInterest>> GetOpenInterestAsync(GetOpenInterestRequest request, CancellationToken ct = default);
|
||||||
|
}
|
||||||
|
}
|
||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
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>
|
||||||
|
/// Endpoint definition for canceling a futures order by client order id on an exchange.
|
||||||
|
/// </summary>
|
||||||
|
public interface ICancelFuturesOrderByClientOrderIdEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Futures cancel order by client order id request options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
CancelFuturesOrderByClientOrderIdOptions CancelFuturesOrderByClientOrderIdOptions { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Cancel a futures order using client order id, see <see cref="CancelFuturesOrderByClientOrderIdOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
Task<HttpResult<SharedId>> CancelFuturesOrderByClientOrderIdAsync(CancelOrderRequest request, CancellationToken ct = default);
|
||||||
|
}
|
||||||
|
}
|
||||||
+29
@@ -0,0 +1,29 @@
|
|||||||
|
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>
|
||||||
|
/// Endpoint definition for canceling a futures order on an exchange.
|
||||||
|
/// </summary>
|
||||||
|
public interface ICancelFuturesOrderEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Futures cancel order request options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
CancelFuturesOrderOptions CancelFuturesOrderOptions { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Cancel a futures order, see <see cref="CancelFuturesOrderOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
Task<HttpResult<SharedId>> CancelFuturesOrderAsync(CancelOrderRequest request, CancellationToken ct = default);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
+56
@@ -0,0 +1,56 @@
|
|||||||
|
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>
|
||||||
|
/// Endpoint definition for placing a futures order on an exchange.
|
||||||
|
/// </summary>
|
||||||
|
public interface IPlaceFuturesOrderEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// How the trading fee is deducted
|
||||||
|
/// </summary>
|
||||||
|
SharedFeeDeductionType FuturesFeeDeductionType { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// How the asset is determined in which the trading fee is paid
|
||||||
|
/// </summary>
|
||||||
|
SharedFeeAssetType FuturesFeeAssetType { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Supported order types for futures orders
|
||||||
|
/// </summary>
|
||||||
|
SharedOrderType[] FuturesSupportedOrderTypes { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Supported time in force types for futures orders
|
||||||
|
/// </summary>
|
||||||
|
SharedTimeInForce[] FuturesSupportedTimeInForce { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Supported quantity types for futures orders
|
||||||
|
/// </summary>
|
||||||
|
SharedQuantitySupport FuturesSupportedOrderQuantity { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Generate a new random client order id
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
string GenerateClientOrderId();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Futures place order request options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
PlaceFuturesOrderOptions PlaceFuturesOrderOptions { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Place a new futures order, see <see cref="PlaceFuturesOrderOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
Task<HttpResult<SharedId>> PlaceFuturesOrderAsync(PlaceFuturesOrderRequest request, CancellationToken ct = default);
|
||||||
|
}
|
||||||
|
}
|
||||||
+30
@@ -0,0 +1,30 @@
|
|||||||
|
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>
|
||||||
|
/// Endpoint definition for retrieving closed futures orders on an exchange.
|
||||||
|
/// </summary>
|
||||||
|
public interface IGetClosedFuturesOrdersEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Spot get closed orders request options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
GetFuturesClosedOrdersOptions GetClosedFuturesOrdersOptions { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Get info on closed futures orders, see <see cref="GetClosedFuturesOrdersOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// The result is paginated, if there are more results to be retrieved, the <see cref="HttpResult{T}.NextPageRequest"/> property of the result will contain the pagination request to be used for the next request to continue pagination.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="nextPageToken">The pagination request from the previous request result <see cref="HttpResult{T}.NextPageRequest"/> property to continue pagination</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
Task<HttpResult<SharedFuturesOrder[]>> GetClosedFuturesOrdersAsync(GetClosedOrdersRequest request, PageRequest? nextPageToken = null, CancellationToken ct = default);
|
||||||
|
}
|
||||||
|
}
|
||||||
+29
@@ -0,0 +1,29 @@
|
|||||||
|
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>
|
||||||
|
/// Endpoint definition for retrieving a futures order by client order id on an exchange.
|
||||||
|
/// </summary>
|
||||||
|
public interface IGetFuturesOrderByClientOrderIdEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Futures get order by client order id request options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
GetFuturesOrderByClientOrderIdOptions GetFuturesOrderByClientOrderIdOptions { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get info on a specific futures order using a client order id, see <see cref="GetFuturesOrderByClientOrderIdOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
Task<HttpResult<SharedFuturesOrder>> GetFuturesOrderByClientOrderIdAsync(GetOrderRequest request, CancellationToken ct = default);
|
||||||
|
}
|
||||||
|
}
|
||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
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>
|
||||||
|
/// Endpoint definition for retrieving a futures order on an exchange.
|
||||||
|
/// </summary>
|
||||||
|
public interface IGetFuturesOrderEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Futures get order request options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
GetFuturesOrderOptions GetFuturesOrderOptions { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Get info on a specific futures order, see <see cref="GetFuturesOrderOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
Task<HttpResult<SharedFuturesOrder>> GetFuturesOrderAsync(GetOrderRequest request, CancellationToken ct = default);
|
||||||
|
}
|
||||||
|
}
|
||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
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>
|
||||||
|
/// Endpoint definition for retrieving open futures orders on an exchange.
|
||||||
|
/// </summary>
|
||||||
|
public interface IGetOpenFuturesOrdersEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Futures get open orders request options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
GetOpenFuturesOrdersOptions GetOpenFuturesOrdersOptions { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Get info on a open futures orders, see <see cref="GetOpenFuturesOrdersOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
Task<HttpResult<SharedFuturesOrder[]>> GetOpenFuturesOrdersAsync(GetOpenOrdersRequest request, CancellationToken ct = default);
|
||||||
|
}
|
||||||
|
}
|
||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
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>
|
||||||
|
/// Request defintion for getting the current user position mode setting on an exchange.
|
||||||
|
/// </summary>
|
||||||
|
public interface IGetPositionModeEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Position mode request options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
GetPositionModeOptions GetPositionModeOptions { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Get the current position mode setting, see <see cref="GetPositionModeOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
Task<HttpResult<SharedPositionModeResult>> GetPositionModeAsync(GetPositionModeRequest request, CancellationToken ct = default);
|
||||||
|
}
|
||||||
|
}
|
||||||
+33
@@ -0,0 +1,33 @@
|
|||||||
|
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>
|
||||||
|
/// Endpoint definition for setting the user position mode on an exchange.
|
||||||
|
/// </summary>
|
||||||
|
public interface ISetPositionModeEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// How the exchange handles setting the position mode
|
||||||
|
/// </summary>
|
||||||
|
SharedPositionModeSelection PositionModeSettingType { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Position mode set request options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
SetPositionModeOptions SetPositionModeOptions { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Set the position mode to a new value, see <see cref="SetPositionModeOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
Task<HttpResult<SharedPositionModeResult>> SetPositionModeAsync(SetPositionModeRequest request, CancellationToken ct = default);
|
||||||
|
}
|
||||||
|
}
|
||||||
+29
@@ -0,0 +1,29 @@
|
|||||||
|
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>
|
||||||
|
/// Request definition for closing a position on an exchange.
|
||||||
|
/// </summary>
|
||||||
|
public interface IClosePositionEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Close position order request options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
ClosePositionOptions ClosePositionOptions { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Close a currently open position, see <see cref="ClosePositionOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<HttpResult<SharedId>> ClosePositionAsync(ClosePositionRequest request, CancellationToken ct = default);
|
||||||
|
}
|
||||||
|
}
|
||||||
+30
@@ -0,0 +1,30 @@
|
|||||||
|
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>
|
||||||
|
/// Request definition for retrieving position history from an exchange.
|
||||||
|
/// </summary>
|
||||||
|
public interface IGetPositionHistoryEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Position history request options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
GetPositionHistoryOptions GetPositionHistoryOptions { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Get position history, see <see cref="GetPositionHistoryOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// The result is paginated, if there are more results to be retrieved, the <see cref="HttpResult{T}.NextPageRequest"/> property of the result will contain the pagination request to be used for the next request to continue pagination.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="nextPageToken">The pagination request from the previous request result <see cref="HttpResult{T}.NextPageRequest"/> property to continue pagination</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
Task<HttpResult<SharedPositionHistory[]>> GetPositionHistoryAsync(GetPositionHistoryRequest request, PageRequest? nextPageToken = null, CancellationToken ct = default);
|
||||||
|
}
|
||||||
|
}
|
||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
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>
|
||||||
|
/// Request definition for retrieving open positions from an exchange.
|
||||||
|
/// </summary>
|
||||||
|
public interface IGetPositionsEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Positions request options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
GetPositionsOptions GetPositionsOptions { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Get open position info, see <see cref="GetPositionsOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
Task<HttpResult<SharedPosition[]>> GetPositionsAsync(GetPositionsRequest request, CancellationToken ct = default);
|
||||||
|
}
|
||||||
|
}
|
||||||
+52
@@ -0,0 +1,52 @@
|
|||||||
|
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>
|
||||||
|
/// Request definition for getting futures symbols from an exchange
|
||||||
|
/// </summary>
|
||||||
|
public interface IGetFuturesSymbolsEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Get the futures symbol catalog. Only available if <see cref="GetFuturesSymbolsAsync(GetSymbolsRequest, CancellationToken)"/> has been called previously.
|
||||||
|
/// </summary>
|
||||||
|
SharedSymbolCatalog? FuturesSymbolCatalog { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Futures symbol request options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
GetFuturesSymbolsOptions GetFuturesSymbolsOptions { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get all futures symbols for a specific base asset
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="baseAsset">Asset, for example `ETH`</param>
|
||||||
|
Task<ExchangeCallResult<SharedSymbol[]>> GetFuturesSymbolsForBaseAssetAsync(string baseAsset);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets whether the client supports a futures symbol
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="symbol">The symbol</param>
|
||||||
|
Task<ExchangeCallResult<bool>> SupportsFuturesSymbolAsync(SharedSymbol symbol);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets whether the client supports a futures symbol
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="symbolName">The symbol name</param>
|
||||||
|
Task<ExchangeCallResult<bool>> SupportsFuturesSymbolAsync(string symbolName);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get info on all futures symbols supported on the exchange, see <see cref="GetFuturesSymbolsOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
Task<HttpResult<SharedFuturesSymbol[]>> GetFuturesSymbolsAsync(GetSymbolsRequest request, CancellationToken ct = default);
|
||||||
|
}
|
||||||
|
}
|
||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
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>
|
||||||
|
/// Request definition for retrieving all futures tickers from an exchange.
|
||||||
|
/// </summary>
|
||||||
|
public interface IGetAllFuturesTickersEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Futures get tickers request options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
GetAllFuturesTickersOptions GetAllFuturesTickersOptions { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Get ticker info for all futures symbols, see <see cref="GetAllFuturesTickersOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
Task<HttpResult<SharedFuturesTicker[]>> GetAllFuturesTickersAsync(GetTickersRequest request, CancellationToken ct = default);
|
||||||
|
}
|
||||||
|
}
|
||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
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>
|
||||||
|
/// Request definition for retrieving a futures ticker from an exchange.
|
||||||
|
/// </summary>
|
||||||
|
public interface IGetFuturesTickerEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Futures get ticker request options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
GetFuturesTickerOptions GetFuturesTickerOptions { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Get ticker info for a specific futures symbol, see <see cref="GetFuturesTickerOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
Task<HttpResult<SharedFuturesTicker>> GetFuturesTickerAsync(GetTickerRequest request, CancellationToken ct = default);
|
||||||
|
}
|
||||||
|
}
|
||||||
+29
@@ -0,0 +1,29 @@
|
|||||||
|
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>
|
||||||
|
/// Request definition for canceling a take profit and/or stop loss for an open position on an exchange.
|
||||||
|
/// </summary>
|
||||||
|
public interface ICancelFuturesTpSlEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Cancel a take profit and/or stop loss options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
CancelFuturesTpSlOptions CancelFuturesTpSlOptions { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Cancel an active take profit and/or stop loss for an open position, see <see cref="CancelFuturesTpSlOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<HttpResult<bool>> CancelFuturesTpSlAsync(CancelTpSlRequest request, CancellationToken ct = default);
|
||||||
|
}
|
||||||
|
}
|
||||||
+29
@@ -0,0 +1,29 @@
|
|||||||
|
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>
|
||||||
|
/// Request definition for setting take profit and/or stop loss for an open position on an exchange.
|
||||||
|
/// </summary>
|
||||||
|
public interface ISetFuturesTpSlEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Set take profit and/or stop loss options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
SetFuturesTpSlOptions SetFuturesTpSlOptions { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Set a take profit and/or stop loss for an open position, see <see cref="SetFuturesTpSlOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<HttpResult<SharedId>> SetFuturesTpSlAsync(SetTpSlRequest request, CancellationToken ct = default);
|
||||||
|
}
|
||||||
|
}
|
||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
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>
|
||||||
|
/// Request definition for canceling a futures trigger order on an exchange.
|
||||||
|
/// </summary>
|
||||||
|
public interface ICancelFuturesTriggerOrderEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Cancel trigger order request options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
CancelFuturesTriggerOrderOptions CancelFuturesTriggerOrderOptions { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Cancel a trigger order, see <see cref="CancelFuturesTriggerOrderOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
Task<HttpResult<SharedId>> CancelFuturesTriggerOrderAsync(CancelOrderRequest request, CancellationToken ct = default);
|
||||||
|
}
|
||||||
|
}
|
||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
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>
|
||||||
|
/// Request definition for getting a specific futures trigger order from the exchange.
|
||||||
|
/// </summary>
|
||||||
|
public interface IGetFuturesTriggerOrderEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Get trigger order request options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
GetFuturesTriggerOrderOptions GetFuturesTriggerOrderOptions { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Get info on a specific trigger order, see <see cref="GetFuturesTriggerOrderOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
Task<HttpResult<SharedFuturesTriggerOrder>> GetFuturesTriggerOrderAsync(GetOrderRequest request, CancellationToken ct = default);
|
||||||
|
}
|
||||||
|
}
|
||||||
+30
@@ -0,0 +1,30 @@
|
|||||||
|
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>
|
||||||
|
/// Request definition for placing a futures trigger order on an exchange.
|
||||||
|
/// </summary>
|
||||||
|
public interface IPlaceFuturesTriggerOrderEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Place futures trigger order options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
PlaceFuturesTriggerOrderOptions PlaceFuturesTriggerOrderOptions { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Place a new trigger order, see <see cref="PlaceFuturesTriggerOrderOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<HttpResult<SharedId>> PlaceFuturesTriggerOrderAsync(PlaceFuturesTriggerOrderRequest request, CancellationToken ct = default);
|
||||||
|
}
|
||||||
|
}
|
||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
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>
|
||||||
|
/// Request definition for getting trades for a specific futures order on an exchange.
|
||||||
|
/// </summary>
|
||||||
|
public interface IGetFuturesOrderTradesEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Futures get order trades request options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
GetFuturesOrderTradesOptions GetFuturesOrderTradesOptions { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Get trades for a specific futures order, see <see cref="GetFuturesOrderTradesOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
Task<HttpResult<SharedUserTrade[]>> GetFuturesOrderTradesAsync(GetOrderTradesRequest request, CancellationToken ct = default);
|
||||||
|
}
|
||||||
|
}
|
||||||
+30
@@ -0,0 +1,30 @@
|
|||||||
|
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>
|
||||||
|
/// Request definition for retrieving futures user trade history from an exchange.
|
||||||
|
/// </summary>
|
||||||
|
public interface IGetFuturesUserTradeHistoryEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Futures user trades request options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
GetFuturesUserTradeHistoryOptions GetFuturesUserTradeHistoryOptions { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Get futures user trade records, see <see cref="GetFuturesUserTradeHistoryOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// The result is paginated, if there are more results to be retrieved, the <see cref="HttpResult{T}.NextPageRequest"/> property of the result will contain the pagination request to be used for the next request to continue pagination.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="nextPageToken">The pagination request from the previous request result <see cref="HttpResult{T}.NextPageRequest"/> property to continue pagination</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
Task<HttpResult<SharedUserTrade[]>> GetFuturesUserTradesAsync(GetUserTradesRequest request, PageRequest? nextPageToken = null, CancellationToken ct = default);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace CryptoExchange.Net.SharedApis
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Identifies a fine-grained Shared API endpoint capability.
|
||||||
|
/// </summary>
|
||||||
|
public interface ISharedApiEndpoint : ISharedClient
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
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>
|
||||||
|
/// Request definition for getting kline/candlestick data from an exchange.
|
||||||
|
/// </summary>
|
||||||
|
public interface IGetKlinesEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Kline request options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
GetKlinesOptions GetKlinesOptions { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get kline/candlestick data, see <see cref="GetKlinesOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// The result is paginated, if there are more results to be retrieved, the <see cref="HttpResult{T}.NextPageRequest"/> property of the result will contain the pagination request to be used for the next request to continue pagination.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="nextPageToken">The pagination request from the previous request result <see cref="HttpResult{T}.NextPageRequest"/> property to continue pagination</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<HttpResult<SharedKline[]>> GetKlinesAsync(GetKlinesRequest request, PageRequest? nextPageToken = null, CancellationToken ct = default);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
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>
|
||||||
|
/// Request definition for retrieving the best bid/ask prices for a symbol on an exchange.
|
||||||
|
/// </summary>
|
||||||
|
public interface IGetBookTickerEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Book ticker request options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
GetBookTickerOptions GetBookTickerOptions { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the best ask/bid info for a symbol, see <see cref="GetBookTickerOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<HttpResult<SharedBookTicker>> GetBookTickerAsync(GetBookTickerRequest request, CancellationToken ct = default);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
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>
|
||||||
|
/// Request definition for retrieving an order book snapshot for a symbol on an exchange.
|
||||||
|
/// </summary>
|
||||||
|
public interface IGetOrderBookEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Order book request options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
GetOrderBookOptions GetOrderBookOptions { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the order book for a symbol, see <see cref="GetOrderBookOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<HttpResult<SharedOrderBook>> GetOrderBookAsync(GetOrderBookRequest request, CancellationToken ct = default);
|
||||||
|
}
|
||||||
|
}
|
||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
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>
|
||||||
|
/// Request definition for canceling a spot order by client order id on an exchange.
|
||||||
|
/// </summary>
|
||||||
|
public interface ICancelSpotOrderByClientOrderIdEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Spot cancel order by client order id request options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
CancelSpotOrderByClientOrderIdOptions CancelSpotOrderByClientOrderIdOptions { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Cancel a spot order using client order id, see <see cref="CancelSpotOrderByClientOrderIdOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
Task<HttpResult<SharedId>> CancelSpotOrderByClientOrderIdAsync(CancelOrderRequest request, CancellationToken ct = default);
|
||||||
|
}
|
||||||
|
}
|
||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
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>
|
||||||
|
/// Request definition for canceling a spot order on an exchange.
|
||||||
|
/// </summary>
|
||||||
|
public interface ICancelSpotOrderEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Spot cancel order request options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
CancelSpotOrderOptions CancelSpotOrderOptions { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Cancel a spot order, see <see cref="CancelSpotOrderOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
Task<HttpResult<SharedId>> CancelSpotOrderAsync(CancelOrderRequest request, CancellationToken ct = default);
|
||||||
|
}
|
||||||
|
}
|
||||||
+55
@@ -0,0 +1,55 @@
|
|||||||
|
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>
|
||||||
|
/// Request definition for placing a spot order on an exchange.
|
||||||
|
/// </summary>
|
||||||
|
public interface IPlaceSpotOrderEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// How the trading fee is deducted
|
||||||
|
/// </summary>
|
||||||
|
SharedFeeDeductionType SpotFeeDeductionType { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// How the asset is determined in which the trading fee is paid
|
||||||
|
/// </summary>
|
||||||
|
SharedFeeAssetType SpotFeeAssetType { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Supported order types for spot orders
|
||||||
|
/// </summary>
|
||||||
|
SharedOrderType[] SpotSupportedOrderTypes { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Supported time in force types for placing spot orders
|
||||||
|
/// </summary>
|
||||||
|
SharedTimeInForce[] SpotSupportedTimeInForce { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Supported quantity types for placing spot orders
|
||||||
|
/// </summary>
|
||||||
|
SharedQuantitySupport SpotSupportedOrderQuantity { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Generate a new random client order id in a format that is accepted by the exchange.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
string GenerateClientOrderId();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Spot place order request options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
PlaceSpotOrderOptions PlaceSpotOrderOptions { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Place a new spot order, see <see cref="PlaceSpotOrderOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
Task<HttpResult<SharedId>> PlaceSpotOrderAsync(PlaceSpotOrderRequest request, CancellationToken ct = default);
|
||||||
|
}
|
||||||
|
}
|
||||||
+30
@@ -0,0 +1,30 @@
|
|||||||
|
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>
|
||||||
|
/// Request definition for retrieving closed spot orders from an exchange.
|
||||||
|
/// </summary>
|
||||||
|
public interface IGetClosedSpotOrdersEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Spot get closed orders request options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
GetSpotClosedOrdersOptions GetClosedSpotOrdersOptions { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Get info on closed spot orders, see <see cref="GetClosedSpotOrdersOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// The result is paginated, if there are more results to be retrieved, the <see cref="HttpResult{T}.NextPageRequest"/> property of the result will contain the pagination request to be used for the next request to continue pagination.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="nextPageToken">The pagination request from the previous request result <see cref="HttpResult{T}.NextPageRequest"/> property to continue pagination</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
Task<HttpResult<SharedSpotOrder[]>> GetClosedSpotOrdersAsync(GetClosedOrdersRequest request, PageRequest? nextPageToken = null, CancellationToken ct = default);
|
||||||
|
}
|
||||||
|
}
|
||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
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>
|
||||||
|
/// Request definition for retrieving open spot order from an exchange.
|
||||||
|
/// </summary>
|
||||||
|
public interface IGetOpenSpotOrdersEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Spot get open orders request options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
GetOpenSpotOrdersOptions GetOpenSpotOrdersOptions { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Get info on a open spot orders, see <see cref="GetOpenSpotOrdersOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
Task<HttpResult<SharedSpotOrder[]>> GetOpenSpotOrdersAsync(GetOpenOrdersRequest request, CancellationToken ct = default);
|
||||||
|
}
|
||||||
|
}
|
||||||
+30
@@ -0,0 +1,30 @@
|
|||||||
|
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>
|
||||||
|
/// Request definition for retrieving a spot order by client order id from an exchange.
|
||||||
|
/// </summary>
|
||||||
|
public interface IGetSpotOrderByClientOrderIdEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Spot get order by client order id request options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
GetSpotOrderByClientOrderIdOptions GetSpotOrderByClientOrderIdOptions { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get info on a specific spot order using a client order id, see <see cref="GetSpotOrderByClientOrderIdOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
Task<HttpResult<SharedSpotOrder>> GetSpotOrderByClientOrderIdAsync(GetOrderRequest request, CancellationToken ct = default);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
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>
|
||||||
|
/// Request definition for retrieving a spot order from an exchange.
|
||||||
|
/// </summary>
|
||||||
|
public interface IGetSpotOrderEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Spot get order request options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
GetSpotOrderOptions GetSpotOrderOptions { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Get info on a specific spot order, see <see cref="GetSpotOrderOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
Task<HttpResult<SharedSpotOrder>> GetSpotOrderAsync(GetOrderRequest request, CancellationToken ct = default);
|
||||||
|
}
|
||||||
|
}
|
||||||
+52
@@ -0,0 +1,52 @@
|
|||||||
|
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>
|
||||||
|
/// Request definition for retrieving spot symbols from an exchange.
|
||||||
|
/// </summary>
|
||||||
|
public interface IGetSpotSymbolsEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Get the spot symbol catalog. Only available if <see cref="GetSpotSymbolsAsync(GetSymbolsRequest, CancellationToken)"/> has been called previously.
|
||||||
|
/// </summary>
|
||||||
|
SharedSymbolCatalog? SpotSymbolCatalog { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get all spot symbols for a specific base asset
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="baseAsset">Asset, for example `ETH`</param>
|
||||||
|
Task<ExchangeCallResult<SharedSymbol[]>> GetSpotSymbolsForBaseAssetAsync(string baseAsset);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets whether the client supports a spot symbol
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="symbol">The symbol</param>
|
||||||
|
Task<ExchangeCallResult<bool>> SupportsSpotSymbolAsync(SharedSymbol symbol);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets whether the client supports a spot symbol
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="symbolName">The symbol name</param>
|
||||||
|
Task<ExchangeCallResult<bool>> SupportsSpotSymbolAsync(string symbolName);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Spot symbols request options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
GetSpotSymbolsOptions GetSpotSymbolsOptions { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get info on all available spot symbols on the exchange, see <see cref="GetSpotSymbolsOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
Task<HttpResult<SharedSpotSymbol[]>> GetSpotSymbolsAsync(GetSymbolsRequest request, CancellationToken ct = default);
|
||||||
|
}
|
||||||
|
}
|
||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
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>
|
||||||
|
/// Request definition for retrieving all spot tickers from an exchange.
|
||||||
|
/// </summary>
|
||||||
|
public interface IGetAllSpotTickersEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Spot tickers request options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
GetAllSpotTickersOptions GetAllSpotTickersOptions { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Get tickers for all spot symbols, see <see cref="GetAllSpotTickersOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
Task<HttpResult<SharedSpotTicker[]>> GetAllSpotTickersAsync(GetTickersRequest request, CancellationToken ct = default);
|
||||||
|
}
|
||||||
|
}
|
||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
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>
|
||||||
|
/// Request definition for getting spot ticker info from an exchange.
|
||||||
|
/// </summary>
|
||||||
|
public interface IGetSpotTickerEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Spot ticker request options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
GetSpotTickerOptions GetSpotTickerOptions { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Get ticker for a specific spot symbol, see <see cref="GetSpotTickerOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
Task<HttpResult<SharedSpotTicker>> GetSpotTickerAsync(GetTickerRequest request, CancellationToken ct = default);
|
||||||
|
}
|
||||||
|
}
|
||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
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>
|
||||||
|
/// Request definition for canceling a spot trigger order on an exchange
|
||||||
|
/// </summary>
|
||||||
|
public interface ICancelSpotTriggerOrderEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Cancel trigger order request options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
CancelSpotTriggerOrderOptions CancelSpotTriggerOrderOptions { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Cancel a trigger order, see <see cref="CancelSpotTriggerOrderOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
Task<HttpResult<SharedId>> CancelSpotTriggerOrderAsync(CancelOrderRequest request, CancellationToken ct = default);
|
||||||
|
}
|
||||||
|
}
|
||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
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>
|
||||||
|
/// Request definition for getting a specific spot trigger order on an exchange
|
||||||
|
/// </summary>
|
||||||
|
public interface IGetSpotTriggerOrderEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Get trigger order request options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
GetSpotTriggerOrderOptions GetSpotTriggerOrderOptions { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Get info on a specific trigger order, see <see cref="GetSpotTriggerOrderOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
Task<HttpResult<SharedSpotTriggerOrder>> GetSpotTriggerOrderAsync(GetOrderRequest request, CancellationToken ct = default);
|
||||||
|
}
|
||||||
|
}
|
||||||
+31
@@ -0,0 +1,31 @@
|
|||||||
|
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>
|
||||||
|
/// Request definition for placing a spot trigger order on an exchange.
|
||||||
|
/// </summary>
|
||||||
|
public interface IPlaceSpotTriggerOrderEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Place spot trigger order options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
PlaceSpotTriggerOrderOptions PlaceSpotTriggerOrderOptions { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Place a new trigger order, see <see cref="PlaceSpotTriggerOrderOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<HttpResult<SharedId>> PlaceSpotTriggerOrderAsync(PlaceSpotTriggerOrderRequest request, CancellationToken ct = default);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
+30
@@ -0,0 +1,30 @@
|
|||||||
|
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>
|
||||||
|
/// Request definition for getting trades for a specific spot order on an exchange.
|
||||||
|
/// </summary>
|
||||||
|
public interface IGetSpotOrderTradesEndpoint : ISharedApiEndpoint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Spot get order trades request options.<br />
|
||||||
|
/// Use <see cref="EndpointOptions{TRequest, TClient}.RequiredRequestParameters"/>, <see cref="EndpointOptions.RequiredExchangeParameters"/> and <see cref="EndpointOptions.OptionalExchangeParameters"/> 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>
|
||||||
|
GetSpotOrderTradesOptions GetSpotOrderTradesOptions { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Get trades for a specific spot order, see <see cref="GetSpotOrderTradesOptions"/> for request options and exchange specific required/optional parameters. <br />
|
||||||
|
/// The result is paginated, if there are more results to be retrieved, the `NextPageRequest` property of the result will contain the pagination request to be used for the next request to continue pagination.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">Request info</param>
|
||||||
|
/// <param name="ct">Cancellation token</param>
|
||||||
|
Task<HttpResult<SharedUserTrade[]>> GetSpotOrderTradesAsync(GetOrderTradesRequest request, CancellationToken ct = default);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user