From bc0b55f3372f32bf7dd6947f4ea4f02f1bfeaa05 Mon Sep 17 00:00:00 2001 From: Jkorf Date: Fri, 18 Feb 2022 10:09:26 +0100 Subject: [PATCH] Added clientOrderId parameter to common clients --- .../IBaseRestClient.cs} | 48 +------------------ .../CommonClients/IFuturesClient.cs | 37 ++++++++++++++ .../Interfaces/CommonClients/ISpotClient.cs | 28 +++++++++++ 3 files changed, 66 insertions(+), 47 deletions(-) rename CryptoExchange.Net/Interfaces/{ISpotClient.cs => CommonClients/IBaseRestClient.cs} (71%) create mode 100644 CryptoExchange.Net/Interfaces/CommonClients/IFuturesClient.cs create mode 100644 CryptoExchange.Net/Interfaces/CommonClients/ISpotClient.cs diff --git a/CryptoExchange.Net/Interfaces/ISpotClient.cs b/CryptoExchange.Net/Interfaces/CommonClients/IBaseRestClient.cs similarity index 71% rename from CryptoExchange.Net/Interfaces/ISpotClient.cs rename to CryptoExchange.Net/Interfaces/CommonClients/IBaseRestClient.cs index 6293e49..4624edf 100644 --- a/CryptoExchange.Net/Interfaces/ISpotClient.cs +++ b/CryptoExchange.Net/Interfaces/CommonClients/IBaseRestClient.cs @@ -5,7 +5,7 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; -namespace CryptoExchange.Net.Interfaces +namespace CryptoExchange.Net.Interfaces.CommonClients { /// /// Common rest client endpoints @@ -135,50 +135,4 @@ namespace CryptoExchange.Net.Interfaces /// Task> CancelOrderAsync(string orderId, string? symbol = null, CancellationToken ct = default); } - - /// - /// Common futures endpoints - /// - public interface IFuturesClient: IBaseRestClient - { - /// - /// Place an order - /// - /// The symbol the order is for - /// The side of the order - /// The type of the order - /// The quantity of the order - /// The price of the order, only for limit orders - /// [Optional] The account id to place the order on, required for some exchanges, ignored otherwise - /// [Optional] Leverage for this order. This is needed for some exchanges. For exchanges where this is not needed this parameter is ignored (and should be set before hand) - /// [Optional] Cancellation token for cancelling the request - /// The id of the resulting order - Task> PlaceOrderAsync(string symbol, CommonOrderSide side, CommonOrderType type, decimal quantity, decimal? price = null, int? leverage = null, string? accountId = null, CancellationToken ct = default); - - /// - /// Get position - /// - /// [Optional] Cancellation token for cancelling the request - /// - Task>> GetPositionsAsync(CancellationToken ct = default); - } - - /// - /// Common spot endpoints - /// - public interface ISpotClient: IBaseRestClient - { - /// - /// Place an order - /// - /// The symbol the order is for - /// The side of the order - /// The type of the order - /// The quantity of the order - /// The price of the order, only for limit orders - /// [Optional] The account id to place the order on, required for some exchanges, ignored otherwise - /// [Optional] Cancellation token for cancelling the request - /// The id of the resulting order - Task> PlaceOrderAsync(string symbol, CommonOrderSide side, CommonOrderType type, decimal quantity, decimal? price = null, string? accountId = null, CancellationToken ct = default); - } } diff --git a/CryptoExchange.Net/Interfaces/CommonClients/IFuturesClient.cs b/CryptoExchange.Net/Interfaces/CommonClients/IFuturesClient.cs new file mode 100644 index 0000000..af6c214 --- /dev/null +++ b/CryptoExchange.Net/Interfaces/CommonClients/IFuturesClient.cs @@ -0,0 +1,37 @@ +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using CryptoExchange.Net.CommonObjects; +using CryptoExchange.Net.Interfaces.CommonClients; +using CryptoExchange.Net.Objects; + +namespace CryptoExchange.Net.Interfaces.CommonClients +{ + /// + /// Common futures endpoints + /// + public interface IFuturesClient : IBaseRestClient + { + /// + /// Place an order + /// + /// The symbol the order is for + /// The side of the order + /// The type of the order + /// The quantity of the order + /// The price of the order, only for limit orders + /// [Optional] The account id to place the order on, required for some exchanges, ignored otherwise + /// [Optional] Leverage for this order. This is needed for some exchanges. For exchanges where this is not needed this parameter is ignored (and should be set before hand) + /// [Optional] Client specified id for this order + /// [Optional] Cancellation token for cancelling the request + /// The id of the resulting order + Task> PlaceOrderAsync(string symbol, CommonOrderSide side, CommonOrderType type, decimal quantity, decimal? price = null, int? leverage = null, string? accountId = null, string? clientOrderId = null, CancellationToken ct = default); + + /// + /// Get position + /// + /// [Optional] Cancellation token for cancelling the request + /// + Task>> GetPositionsAsync(CancellationToken ct = default); + } +} diff --git a/CryptoExchange.Net/Interfaces/CommonClients/ISpotClient.cs b/CryptoExchange.Net/Interfaces/CommonClients/ISpotClient.cs new file mode 100644 index 0000000..601786b --- /dev/null +++ b/CryptoExchange.Net/Interfaces/CommonClients/ISpotClient.cs @@ -0,0 +1,28 @@ +using CryptoExchange.Net.CommonObjects; +using CryptoExchange.Net.Interfaces.CommonClients; +using CryptoExchange.Net.Objects; +using System.Threading; +using System.Threading.Tasks; + +namespace CryptoExchange.Net.Interfaces.CommonClients +{ + /// + /// Common spot endpoints + /// + public interface ISpotClient: IBaseRestClient + { + /// + /// Place an order + /// + /// The symbol the order is for + /// The side of the order + /// The type of the order + /// The quantity of the order + /// The price of the order, only for limit orders + /// [Optional] The account id to place the order on, required for some exchanges, ignored otherwise + /// [Optional] Client specified id for this order + /// [Optional] Cancellation token for cancelling the request + /// The id of the resulting order + Task> PlaceOrderAsync(string symbol, CommonOrderSide side, CommonOrderType type, decimal quantity, decimal? price = null, string? accountId = null, string? clientOrderId = null, CancellationToken ct = default); + } +}