diff --git a/CryptoExchange.Net/ExchangeInterfaces/ICommonBalance.cs b/CryptoExchange.Net/ComonObjects/Balance.cs
similarity index 51%
rename from CryptoExchange.Net/ExchangeInterfaces/ICommonBalance.cs
rename to CryptoExchange.Net/ComonObjects/Balance.cs
index 816b351..b52b9c6 100644
--- a/CryptoExchange.Net/ExchangeInterfaces/ICommonBalance.cs
+++ b/CryptoExchange.Net/ComonObjects/Balance.cs
@@ -1,21 +1,21 @@
-namespace CryptoExchange.Net.ExchangeInterfaces
+namespace CryptoExchange.Net.ComonObjects
{
///
- /// Common balance
+ /// Balance data
///
- public interface ICommonBalance
+ public class Balance: BaseComonObject
{
///
/// The asset name
///
- public string CommonAsset { get; }
+ public string Asset { get; set; } = string.Empty;
///
/// Quantity available
///
- public decimal CommonAvailable { get; }
+ public decimal? Available { get; set; }
///
/// Total quantity
///
- public decimal CommonTotal { get; }
+ public decimal? Total { get; set; }
}
}
diff --git a/CryptoExchange.Net/ComonObjects/BaseComonObject.cs b/CryptoExchange.Net/ComonObjects/BaseComonObject.cs
new file mode 100644
index 0000000..ee34d63
--- /dev/null
+++ b/CryptoExchange.Net/ComonObjects/BaseComonObject.cs
@@ -0,0 +1,13 @@
+namespace CryptoExchange.Net.ComonObjects
+{
+ ///
+ /// Base class for comon objects
+ ///
+ public class BaseComonObject
+ {
+ ///
+ /// The source object the data is derived from
+ ///
+ public object SourceObject { get; set; } = null!;
+ }
+}
diff --git a/CryptoExchange.Net/ComonObjects/Enums.cs b/CryptoExchange.Net/ComonObjects/Enums.cs
new file mode 100644
index 0000000..998c157
--- /dev/null
+++ b/CryptoExchange.Net/ComonObjects/Enums.cs
@@ -0,0 +1,77 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace CryptoExchange.Net.ComonObjects
+{
+ ///
+ /// Order type
+ ///
+ public enum OrderType
+ {
+ ///
+ /// Limit type
+ ///
+ Limit,
+ ///
+ /// Market type
+ ///
+ Market,
+ ///
+ /// Other order type
+ ///
+ Other
+ }
+
+ ///
+ /// Order side
+ ///
+ public enum OrderSide
+ {
+ ///
+ /// Buy order
+ ///
+ Buy,
+ ///
+ /// Sell order
+ ///
+ Sell
+ }
+ ///
+ /// Order status
+ ///
+ public enum OrderStatus
+ {
+ ///
+ /// placed and not fully filled order
+ ///
+ Active,
+ ///
+ /// canceled order
+ ///
+ Canceled,
+ ///
+ /// filled order
+ ///
+ Filled
+ }
+
+ ///
+ /// Position side
+ ///
+ public enum PositionSide
+ {
+ ///
+ /// Long position
+ ///
+ Long,
+ ///
+ /// Short position
+ ///
+ Short,
+ ///
+ /// Both
+ ///
+ Both
+ }
+}
diff --git a/CryptoExchange.Net/ComonObjects/Kline.cs b/CryptoExchange.Net/ComonObjects/Kline.cs
new file mode 100644
index 0000000..5a90c76
--- /dev/null
+++ b/CryptoExchange.Net/ComonObjects/Kline.cs
@@ -0,0 +1,35 @@
+using System;
+
+namespace CryptoExchange.Net.ComonObjects
+{
+ ///
+ /// Kline data
+ ///
+ public class Kline: BaseComonObject
+ {
+ ///
+ /// Opening time of the kline
+ ///
+ public DateTime OpenTime { get; set; }
+ ///
+ /// Price at the open time
+ ///
+ public decimal? OpenPrice { get; set; }
+ ///
+ /// Highest price of the kline
+ ///
+ public decimal? HighPrice { get; set; }
+ ///
+ /// Lowest price of the kline
+ ///
+ public decimal? LowPrice { get; set; }
+ ///
+ /// Close price of the kline
+ ///
+ public decimal? ClosePrice { get; set; }
+ ///
+ /// Volume of the kline
+ ///
+ public decimal? Volume { get; set; }
+ }
+}
diff --git a/CryptoExchange.Net/ComonObjects/Order.cs b/CryptoExchange.Net/ComonObjects/Order.cs
new file mode 100644
index 0000000..a8743cd
--- /dev/null
+++ b/CryptoExchange.Net/ComonObjects/Order.cs
@@ -0,0 +1,47 @@
+using System;
+
+namespace CryptoExchange.Net.ComonObjects
+{
+ ///
+ /// Order data
+ ///
+ public class Order: BaseComonObject
+ {
+ ///
+ /// Id of the order
+ ///
+ public string Id { get; set; } = string.Empty;
+ ///
+ /// Symbol of the order
+ ///
+ public string Symbol { get; set; } = string.Empty;
+ ///
+ /// Price of the order
+ ///
+ public decimal? Price { get; set; }
+ ///
+ /// Quantity of the order
+ ///
+ public decimal? Quantity { get; set; }
+ ///
+ /// The quantity of the order which has been filled
+ ///
+ public decimal? QuantityFilled { get; set; }
+ ///
+ /// Status of the order
+ ///
+ public OrderStatus Status { get; set; }
+ ///
+ /// Side of the order
+ ///
+ public OrderSide Side { get; set; }
+ ///
+ /// Type of the order
+ ///
+ public OrderType Type { get; set; }
+ ///
+ /// Order time
+ ///
+ public DateTime Timestamp { get; set; }
+ }
+}
diff --git a/CryptoExchange.Net/ComonObjects/OrderBook.cs b/CryptoExchange.Net/ComonObjects/OrderBook.cs
new file mode 100644
index 0000000..621e154
--- /dev/null
+++ b/CryptoExchange.Net/ComonObjects/OrderBook.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace CryptoExchange.Net.ComonObjects
+{
+ ///
+ /// Order book data
+ ///
+ public class OrderBook: BaseComonObject
+ {
+ ///
+ /// List of bids
+ ///
+ public IEnumerable Bids { get; set; } = Array.Empty();
+ ///
+ /// List of asks
+ ///
+ public IEnumerable Asks { get; set; } = Array.Empty();
+ }
+}
diff --git a/CryptoExchange.Net/ComonObjects/OrderBookEntry.cs b/CryptoExchange.Net/ComonObjects/OrderBookEntry.cs
new file mode 100644
index 0000000..96d2e93
--- /dev/null
+++ b/CryptoExchange.Net/ComonObjects/OrderBookEntry.cs
@@ -0,0 +1,17 @@
+namespace CryptoExchange.Net.ComonObjects
+{
+ ///
+ /// Order book entry
+ ///
+ public class OrderBookEntry
+ {
+ ///
+ /// Quantity of the entry
+ ///
+ public decimal Quantity { get; set; }
+ ///
+ /// Price of the entry
+ ///
+ public decimal Price { get; set; }
+ }
+}
diff --git a/CryptoExchange.Net/ComonObjects/OrderId.cs b/CryptoExchange.Net/ComonObjects/OrderId.cs
new file mode 100644
index 0000000..8e3e74f
--- /dev/null
+++ b/CryptoExchange.Net/ComonObjects/OrderId.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace CryptoExchange.Net.ComonObjects
+{
+ ///
+ /// Id of an order
+ ///
+ public class OrderId: BaseComonObject
+ {
+ ///
+ /// Id of an order
+ ///
+ public string Id { get; set; } = string.Empty;
+ }
+}
diff --git a/CryptoExchange.Net/ComonObjects/Position.cs b/CryptoExchange.Net/ComonObjects/Position.cs
new file mode 100644
index 0000000..09d6609
--- /dev/null
+++ b/CryptoExchange.Net/ComonObjects/Position.cs
@@ -0,0 +1,65 @@
+namespace CryptoExchange.Net.ComonObjects
+{
+ ///
+ /// Position data
+ ///
+ public class Position: BaseComonObject
+ {
+ ///
+ /// Id of the position
+ ///
+ public string? Id { get; set; }
+ ///
+ /// Symbol of the position
+ ///
+ public string Symbol { get; set; } = string.Empty;
+ ///
+ /// Leverage
+ ///
+ public decimal Leverage { get; set; }
+ ///
+ /// Position quantity
+ ///
+ public decimal Quantity { get; set; }
+ ///
+ /// Entry price
+ ///
+ public decimal? EntryPrice { get; set; }
+ ///
+ /// Liquidation price
+ ///
+ public decimal? LiquidationPrice { get; set; }
+ ///
+ /// Unrealized profit and loss
+ ///
+ public decimal? UnrealizedPnl { get; set; }
+ ///
+ /// Realized profit and loss
+ ///
+ public decimal? RealizedPnl { get; set; }
+ ///
+ /// Mark price
+ ///
+ public decimal? MarkPrice { get; set; }
+ ///
+ /// Auto adding margin
+ ///
+ public bool? AutoMargin { get; set; }
+ ///
+ /// Position margin
+ ///
+ public decimal? PositionMargin { get; set; }
+ ///
+ /// Position side
+ ///
+ public PositionSide? Side { get; set; }
+ ///
+ /// Is isolated
+ ///
+ public bool? Isolated { get; set; }
+ ///
+ /// Maintenance margin
+ ///
+ public decimal? MaintananceMargin { get; set; }
+ }
+}
diff --git a/CryptoExchange.Net/ComonObjects/Symbol.cs b/CryptoExchange.Net/ComonObjects/Symbol.cs
new file mode 100644
index 0000000..ee4b28e
--- /dev/null
+++ b/CryptoExchange.Net/ComonObjects/Symbol.cs
@@ -0,0 +1,33 @@
+namespace CryptoExchange.Net.ComonObjects
+{
+ ///
+ /// Symbol data
+ ///
+ public class Symbol: BaseComonObject
+ {
+ ///
+ /// Name of the symbol
+ ///
+ public string Name { get; set; } = string.Empty;
+ ///
+ /// Minimal quantity of an order
+ ///
+ public decimal? MinTradeQuantity { get; set; }
+ ///
+ /// Step with which the quantity should increase
+ ///
+ public decimal? QuantityStep { get; set; }
+ ///
+ /// step with which the price should increase
+ ///
+ public decimal? PriceStep { get; set; }
+ ///
+ /// The max amount of decimals for quantity
+ ///
+ public int? QuantityDecimals { get; set; }
+ ///
+ /// The max amount of decimal for price
+ ///
+ public int? PriceDecimals { get; set; }
+ }
+}
diff --git a/CryptoExchange.Net/ComonObjects/Ticker.cs b/CryptoExchange.Net/ComonObjects/Ticker.cs
new file mode 100644
index 0000000..f9c2889
--- /dev/null
+++ b/CryptoExchange.Net/ComonObjects/Ticker.cs
@@ -0,0 +1,35 @@
+using System;
+
+namespace CryptoExchange.Net.ComonObjects
+{
+ ///
+ /// Ticker data
+ ///
+ public class Ticker: BaseComonObject
+ {
+ ///
+ /// Symbol
+ ///
+ public string Symbol { get; set; } = string.Empty;
+ ///
+ /// Price 24 hours ago
+ ///
+ public decimal? Price24H { get; set; }
+ ///
+ /// Last trade price
+ ///
+ public decimal? LastPrice { get; set; }
+ ///
+ /// 24 hour low price
+ ///
+ public decimal? LowPrice { get; set; }
+ ///
+ /// 24 hour high price
+ ///
+ public decimal? HighPrice { get; set; }
+ ///
+ /// 24 hour volume
+ ///
+ public decimal? Volume { get; set; }
+ }
+}
diff --git a/CryptoExchange.Net/ComonObjects/Trade.cs b/CryptoExchange.Net/ComonObjects/Trade.cs
new file mode 100644
index 0000000..a493a91
--- /dev/null
+++ b/CryptoExchange.Net/ComonObjects/Trade.cs
@@ -0,0 +1,50 @@
+using System;
+
+namespace CryptoExchange.Net.ComonObjects
+{
+ ///
+ /// Trade data
+ ///
+ public class Trade: BaseComonObject
+ {
+ ///
+ /// Symbol of the trade
+ ///
+ public string Symbol { get; set; } = string.Empty;
+ ///
+ /// Price of the trade
+ ///
+ public decimal Price { get; set; }
+ ///
+ /// Quantity of the trade
+ ///
+ public decimal Quantity { get; set; }
+ ///
+ /// Timestamp of the trade
+ ///
+ public DateTime Timestamp { get; set; }
+ }
+
+ ///
+ /// User trade info
+ ///
+ public class UserTrade: Trade
+ {
+ ///
+ /// Id of the trade
+ ///
+ public string Id { get; set; } = string.Empty;
+ ///
+ /// Order id of the trade
+ ///
+ public string? OrderId { get; set; }
+ ///
+ /// Fee of the trade
+ ///
+ public decimal? Fee { get; set; }
+ ///
+ /// The asset the fee is paid in
+ ///
+ public string? FeeAsset { get; set; }
+ }
+}
diff --git a/CryptoExchange.Net/ExchangeInterfaces/ICommonTrade.cs b/CryptoExchange.Net/ExchangeInterfaces/ICommonTrade.cs
deleted file mode 100644
index 3ac0d49..0000000
--- a/CryptoExchange.Net/ExchangeInterfaces/ICommonTrade.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using System;
-
-namespace CryptoExchange.Net.ExchangeInterfaces
-{
- ///
- /// Common trade
- ///
- public interface ICommonTrade
- {
- ///
- /// Id of the trade
- ///
- public string CommonId { get; }
- ///
- /// Price of the trade
- ///
- public decimal CommonPrice { get; }
- ///
- /// Quantity of the trade
- ///
- public decimal CommonQuantity { get; }
- ///
- /// Fee paid for the trade
- ///
- public decimal CommonFee { get; }
- ///
- /// The asset fee was paid in
- ///
- public string? CommonFeeAsset { get; }
- ///
- /// Trade time
- ///
- DateTime CommonTradeTime { get; }
- }
-}
diff --git a/CryptoExchange.Net/ExchangeInterfaces/IKline.cs b/CryptoExchange.Net/ExchangeInterfaces/IKline.cs
deleted file mode 100644
index 8dbb535..0000000
--- a/CryptoExchange.Net/ExchangeInterfaces/IKline.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using System;
-
-namespace CryptoExchange.Net.ExchangeInterfaces
-{
- ///
- /// Common kline
- ///
- public interface ICommonKline
- {
- ///
- /// High price for this kline
- ///
- decimal CommonHighPrice { get; }
- ///
- /// Low price for this kline
- ///
- decimal CommonLowPrice { get; }
- ///
- /// Open price for this kline
- ///
- decimal CommonOpenPrice { get; }
- ///
- /// Close price for this kline
- ///
- decimal CommonClosePrice { get; }
- ///
- /// Open time for this kline
- ///
- DateTime CommonOpenTime { get; }
- ///
- /// Volume of this kline
- ///
- decimal CommonVolume { get; }
- }
-}
diff --git a/CryptoExchange.Net/ExchangeInterfaces/IOrder.cs b/CryptoExchange.Net/ExchangeInterfaces/IOrder.cs
deleted file mode 100644
index ed526a3..0000000
--- a/CryptoExchange.Net/ExchangeInterfaces/IOrder.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-using System;
-
-namespace CryptoExchange.Net.ExchangeInterfaces
-{
- ///
- /// Common order
- ///
- public interface ICommonOrder: ICommonOrderId
- {
- ///
- /// Symbol of the order
- ///
- public string CommonSymbol { get; }
- ///
- /// Price of the order
- ///
- public decimal CommonPrice { get; }
- ///
- /// Quantity of the order
- ///
- public decimal CommonQuantity { get; }
- ///
- /// Status of the order
- ///
- public IExchangeClient.OrderStatus CommonStatus { get; }
- ///
- /// Whether the order is active
- ///
- public bool IsActive { get; }
- ///
- /// Side of the order
- ///
- public IExchangeClient.OrderSide CommonSide { get; }
- ///
- /// Type of the order
- ///
- public IExchangeClient.OrderType CommonType { get; }
- ///
- /// order time
- ///
- DateTime CommonOrderTime { get; }
- }
-}
diff --git a/CryptoExchange.Net/ExchangeInterfaces/IOrderBook.cs b/CryptoExchange.Net/ExchangeInterfaces/IOrderBook.cs
deleted file mode 100644
index 9ebfd6e..0000000
--- a/CryptoExchange.Net/ExchangeInterfaces/IOrderBook.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System.Collections.Generic;
-using CryptoExchange.Net.Interfaces;
-
-namespace CryptoExchange.Net.ExchangeInterfaces
-{
- ///
- /// Common order book
- ///
- public interface ICommonOrderBook
- {
- ///
- /// Bids
- ///
- IEnumerable CommonBids { get; }
- ///
- /// Asks
- ///
- IEnumerable CommonAsks { get; }
- }
-}
diff --git a/CryptoExchange.Net/ExchangeInterfaces/IPlacedOrder.cs b/CryptoExchange.Net/ExchangeInterfaces/IPlacedOrder.cs
deleted file mode 100644
index b576f96..0000000
--- a/CryptoExchange.Net/ExchangeInterfaces/IPlacedOrder.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-namespace CryptoExchange.Net.ExchangeInterfaces
-{
- ///
- /// Common order id
- ///
- public interface ICommonOrderId
- {
- ///
- /// Id of the order
- ///
- public string CommonId { get; }
- }
-}
diff --git a/CryptoExchange.Net/ExchangeInterfaces/IRecentTrade.cs b/CryptoExchange.Net/ExchangeInterfaces/IRecentTrade.cs
deleted file mode 100644
index e1a4a27..0000000
--- a/CryptoExchange.Net/ExchangeInterfaces/IRecentTrade.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using System;
-
-namespace CryptoExchange.Net.ExchangeInterfaces
-{
- ///
- /// Recent trade
- ///
- public interface ICommonRecentTrade
- {
- ///
- /// Price of the trade
- ///
- decimal CommonPrice { get; }
- ///
- /// Quantity of the trade
- ///
- decimal CommonQuantity { get; }
- ///
- /// Trade time
- ///
- DateTime CommonTradeTime { get; }
- }
-}
diff --git a/CryptoExchange.Net/ExchangeInterfaces/ISymbol.cs b/CryptoExchange.Net/ExchangeInterfaces/ISymbol.cs
deleted file mode 100644
index 9cb73de..0000000
--- a/CryptoExchange.Net/ExchangeInterfaces/ISymbol.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-namespace CryptoExchange.Net.ExchangeInterfaces
-{
- ///
- /// Common symbol
- ///
- public interface ICommonSymbol
- {
- ///
- /// Symbol name
- ///
- public string CommonName { get; }
- ///
- /// Minimum trade quantity
- ///
- public decimal CommonMinimumTradeQuantity { get; }
- }
-}
diff --git a/CryptoExchange.Net/ExchangeInterfaces/ITicker.cs b/CryptoExchange.Net/ExchangeInterfaces/ITicker.cs
deleted file mode 100644
index f2c7360..0000000
--- a/CryptoExchange.Net/ExchangeInterfaces/ITicker.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-namespace CryptoExchange.Net.ExchangeInterfaces
-{
- ///
- /// Common ticker
- ///
- public interface ICommonTicker
- {
- ///
- /// Symbol name
- ///
- public string CommonSymbol { get; }
- ///
- /// High price
- ///
- public decimal CommonHighPrice { get; }
- ///
- /// Low price
- ///
- public decimal CommonLowPrice { get; }
- ///
- /// Volume
- ///
- public decimal CommonVolume { get; }
- }
-}
diff --git a/CryptoExchange.Net/ExchangeInterfaces/IExchangeClient.cs b/CryptoExchange.Net/Interfaces/ISpotClient.cs
similarity index 60%
rename from CryptoExchange.Net/ExchangeInterfaces/IExchangeClient.cs
rename to CryptoExchange.Net/Interfaces/ISpotClient.cs
index 500eada..84910ea 100644
--- a/CryptoExchange.Net/ExchangeInterfaces/IExchangeClient.cs
+++ b/CryptoExchange.Net/Interfaces/ISpotClient.cs
@@ -1,14 +1,15 @@
-using System;
+using CryptoExchange.Net.ComonObjects;
+using CryptoExchange.Net.Objects;
+using System;
using System.Collections.Generic;
using System.Threading.Tasks;
-using CryptoExchange.Net.Objects;
-namespace CryptoExchange.Net.ExchangeInterfaces
+namespace CryptoExchange.Net.Interfaces
{
///
- /// Shared interface for exchange wrappers based on the CryptoExchange.Net package
+ /// Comon rest client endpoints
///
- public interface IExchangeClient
+ public interface IBaseRestClient
{
///
/// The name of the exchange
@@ -18,11 +19,11 @@ namespace CryptoExchange.Net.ExchangeInterfaces
///
/// Should be triggered on order placing
///
- event Action OnOrderPlaced;
+ event Action OnOrderPlaced;
///
/// Should be triggered on order cancelling
///
- event Action OnOrderCanceled;
+ event Action OnOrderCanceled;
///
/// Get the symbol name based on a base and quote asset
@@ -36,20 +37,20 @@ namespace CryptoExchange.Net.ExchangeInterfaces
/// Get a list of symbols for the exchange
///
///
- Task>> GetSymbolsAsync();
-
- ///
- /// Get a list of tickers for the exchange
- ///
- ///
- Task>> GetTickersAsync();
+ Task>> GetSymbolsAsync();
///
/// Get a ticker for the exchange
///
/// The symbol to get klines for
///
- Task> GetTickerAsync(string symbol);
+ Task> GetTickerAsync(string symbol);
+
+ ///
+ /// Get a list of tickers for the exchange
+ ///
+ ///
+ Task>> GetTickersAsync();
///
/// Get a list of candles for a given symbol on the exchange
@@ -60,20 +61,98 @@ namespace CryptoExchange.Net.ExchangeInterfaces
/// [Optional] End time to retrieve klines for
/// [Optional] Max number of results
///
- Task>> GetKlinesAsync(string symbol, TimeSpan timespan, DateTime? startTime = null, DateTime? endTime = null, int? limit = null);
+ Task>> GetKlinesAsync(string symbol, TimeSpan timespan, DateTime? startTime = null, DateTime? endTime = null, int? limit = null);
+
///
/// Get the order book for a symbol
///
/// The symbol to get the book for
///
- Task> GetOrderBookAsync(string symbol);
+ Task> GetOrderBookAsync(string symbol);
+
///
/// The recent trades for a symbol
///
/// The symbol to get the trades for
///
- Task>> GetRecentTradesAsync(string symbol);
+ Task>> GetRecentTradesAsync(string symbol);
+ ///
+ /// Get balances
+ ///
+ /// [Optional] The account id to retrieve balances for, required for some exchanges, ignored otherwise
+ ///
+ Task>> GetBalancesAsync(string? accountId = null);
+
+ ///
+ /// Get an order by id
+ ///
+ /// The id
+ /// [Optional] The symbol the order is on, required for some exchanges, ignored otherwise
+ ///
+ Task> GetOrderAsync(string orderId, string? symbol = null);
+
+ ///
+ /// Get trades for an order by id
+ ///
+ /// The id
+ /// [Optional] The symbol the order is on, required for some exchanges, ignored otherwise
+ ///
+ Task>> GetOrderTradesAsync(string orderId, string? symbol = null);
+
+ ///
+ /// Get a list of open orders
+ ///
+ /// [Optional] The symbol to get open orders for, required for some exchanges, ignored otherwise
+ ///
+ Task>> GetOpenOrdersAsync(string? symbol = null);
+
+ ///
+ /// Get a list of closed orders
+ ///
+ /// [Optional] The symbol to get closed orders for, required for some exchanges, ignored otherwise
+ ///
+ Task>> GetClosedOrdersAsync(string? symbol = null);
+
+ ///
+ /// Cancel an order by id
+ ///
+ /// The id
+ /// [Optional] The symbol the order is on, required for some exchanges, ignored otherwise
+ ///
+ Task> CancelOrderAsync(string orderId, string? symbol = null);
+ }
+
+ ///
+ /// Comon 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)
+ /// The id of the resulting order
+ Task> PlaceOrderAsync(string symbol, OrderSide side, OrderType type, decimal quantity, decimal? price = null, int? leverage = null, string? accountId = null);
+
+ ///
+ /// Get position
+ ///
+ ///
+ Task>> GetPositionsAsync();
+ }
+
+ ///
+ /// Comon spot endpoints
+ ///
+ public interface ISpotClient: IBaseRestClient
+ {
///
/// Place an order
///
@@ -84,99 +163,6 @@ namespace CryptoExchange.Net.ExchangeInterfaces
/// The price of the order, only for limit orders
/// [Optional] The account id to place the order on, required for some exchanges, ignored otherwise
/// The id of the resulting order
- Task> PlaceOrderAsync(string symbol, OrderSide side, OrderType type, decimal quantity, decimal? price = null, string? accountId = null);
- ///
- /// Get an order by id
- ///
- /// The id
- /// [Optional] The symbol the order is on, required for some exchanges, ignored otherwise
- ///
- Task> GetOrderAsync(string orderId, string? symbol = null);
- ///
- /// Get trades for an order by id
- ///
- /// The id
- /// [Optional] The symbol the order is on, required for some exchanges, ignored otherwise
- ///
- Task>> GetTradesAsync(string orderId, string? symbol = null);
- ///
- /// Get a list of open orders
- ///
- /// [Optional] The symbol to get open orders for, required for some exchanges, ignored otherwise
- ///
- Task>> GetOpenOrdersAsync(string? symbol = null);
-
- ///
- /// Get a list of closed orders
- ///
- /// [Optional] The symbol to get closed orders for, required for some exchanges, ignored otherwise
- ///
- Task>> GetClosedOrdersAsync(string? symbol = null);
- ///
- /// Cancel an order by id
- ///
- /// The id
- /// [Optional] The symbol the order is on, required for some exchanges, ignored otherwise
- ///
- Task> CancelOrderAsync(string orderId, string? symbol = null);
-
- ///
- /// Get balances
- ///
- /// [Optional] The account id to retrieve balances for, required for some exchanges, ignored otherwise
- ///
- Task>> GetBalancesAsync(string? accountId = null);
-
- ///
- /// Common order id
- ///
- public enum OrderType
- {
- ///
- /// Limit type
- ///
- Limit,
- ///
- /// Market type
- ///
- Market,
- ///
- /// Other order type
- ///
- Other
- }
-
- ///
- /// Common order side
- ///
- public enum OrderSide
- {
- ///
- /// Buy order
- ///
- Buy,
- ///
- /// Sell order
- ///
- Sell
- }
- ///
- /// Common order status
- ///
- public enum OrderStatus
- {
- ///
- /// placed and not fully filled order
- ///
- Active,
- ///
- /// canceled order
- ///
- Canceled,
- ///
- /// filled order
- ///
- Filled
- }
+ Task> PlaceOrderAsync(string symbol, OrderSide side, OrderType type, decimal quantity, decimal? price = null, string? accountId = null);
}
}