mirror of
https://github.com/JKorf/CryptoExchange.Net
synced 2025-06-08 16:36:15 +00:00
Added new shared interface implementation
This commit is contained in:
parent
f8c3b37cdf
commit
f4b4c93e64
@ -1,21 +1,21 @@
|
|||||||
namespace CryptoExchange.Net.ExchangeInterfaces
|
namespace CryptoExchange.Net.ComonObjects
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Common balance
|
/// Balance data
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface ICommonBalance
|
public class Balance: BaseComonObject
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The asset name
|
/// The asset name
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string CommonAsset { get; }
|
public string Asset { get; set; } = string.Empty;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Quantity available
|
/// Quantity available
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public decimal CommonAvailable { get; }
|
public decimal? Available { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Total quantity
|
/// Total quantity
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public decimal CommonTotal { get; }
|
public decimal? Total { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
13
CryptoExchange.Net/ComonObjects/BaseComonObject.cs
Normal file
13
CryptoExchange.Net/ComonObjects/BaseComonObject.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
namespace CryptoExchange.Net.ComonObjects
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Base class for comon objects
|
||||||
|
/// </summary>
|
||||||
|
public class BaseComonObject
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The source object the data is derived from
|
||||||
|
/// </summary>
|
||||||
|
public object SourceObject { get; set; } = null!;
|
||||||
|
}
|
||||||
|
}
|
77
CryptoExchange.Net/ComonObjects/Enums.cs
Normal file
77
CryptoExchange.Net/ComonObjects/Enums.cs
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace CryptoExchange.Net.ComonObjects
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Order type
|
||||||
|
/// </summary>
|
||||||
|
public enum OrderType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Limit type
|
||||||
|
/// </summary>
|
||||||
|
Limit,
|
||||||
|
/// <summary>
|
||||||
|
/// Market type
|
||||||
|
/// </summary>
|
||||||
|
Market,
|
||||||
|
/// <summary>
|
||||||
|
/// Other order type
|
||||||
|
/// </summary>
|
||||||
|
Other
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Order side
|
||||||
|
/// </summary>
|
||||||
|
public enum OrderSide
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Buy order
|
||||||
|
/// </summary>
|
||||||
|
Buy,
|
||||||
|
/// <summary>
|
||||||
|
/// Sell order
|
||||||
|
/// </summary>
|
||||||
|
Sell
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Order status
|
||||||
|
/// </summary>
|
||||||
|
public enum OrderStatus
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// placed and not fully filled order
|
||||||
|
/// </summary>
|
||||||
|
Active,
|
||||||
|
/// <summary>
|
||||||
|
/// canceled order
|
||||||
|
/// </summary>
|
||||||
|
Canceled,
|
||||||
|
/// <summary>
|
||||||
|
/// filled order
|
||||||
|
/// </summary>
|
||||||
|
Filled
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Position side
|
||||||
|
/// </summary>
|
||||||
|
public enum PositionSide
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Long position
|
||||||
|
/// </summary>
|
||||||
|
Long,
|
||||||
|
/// <summary>
|
||||||
|
/// Short position
|
||||||
|
/// </summary>
|
||||||
|
Short,
|
||||||
|
/// <summary>
|
||||||
|
/// Both
|
||||||
|
/// </summary>
|
||||||
|
Both
|
||||||
|
}
|
||||||
|
}
|
35
CryptoExchange.Net/ComonObjects/Kline.cs
Normal file
35
CryptoExchange.Net/ComonObjects/Kline.cs
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace CryptoExchange.Net.ComonObjects
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Kline data
|
||||||
|
/// </summary>
|
||||||
|
public class Kline: BaseComonObject
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Opening time of the kline
|
||||||
|
/// </summary>
|
||||||
|
public DateTime OpenTime { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Price at the open time
|
||||||
|
/// </summary>
|
||||||
|
public decimal? OpenPrice { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Highest price of the kline
|
||||||
|
/// </summary>
|
||||||
|
public decimal? HighPrice { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Lowest price of the kline
|
||||||
|
/// </summary>
|
||||||
|
public decimal? LowPrice { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Close price of the kline
|
||||||
|
/// </summary>
|
||||||
|
public decimal? ClosePrice { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Volume of the kline
|
||||||
|
/// </summary>
|
||||||
|
public decimal? Volume { get; set; }
|
||||||
|
}
|
||||||
|
}
|
47
CryptoExchange.Net/ComonObjects/Order.cs
Normal file
47
CryptoExchange.Net/ComonObjects/Order.cs
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace CryptoExchange.Net.ComonObjects
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Order data
|
||||||
|
/// </summary>
|
||||||
|
public class Order: BaseComonObject
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Id of the order
|
||||||
|
/// </summary>
|
||||||
|
public string Id { get; set; } = string.Empty;
|
||||||
|
/// <summary>
|
||||||
|
/// Symbol of the order
|
||||||
|
/// </summary>
|
||||||
|
public string Symbol { get; set; } = string.Empty;
|
||||||
|
/// <summary>
|
||||||
|
/// Price of the order
|
||||||
|
/// </summary>
|
||||||
|
public decimal? Price { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Quantity of the order
|
||||||
|
/// </summary>
|
||||||
|
public decimal? Quantity { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// The quantity of the order which has been filled
|
||||||
|
/// </summary>
|
||||||
|
public decimal? QuantityFilled { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Status of the order
|
||||||
|
/// </summary>
|
||||||
|
public OrderStatus Status { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Side of the order
|
||||||
|
/// </summary>
|
||||||
|
public OrderSide Side { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Type of the order
|
||||||
|
/// </summary>
|
||||||
|
public OrderType Type { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Order time
|
||||||
|
/// </summary>
|
||||||
|
public DateTime Timestamp { get; set; }
|
||||||
|
}
|
||||||
|
}
|
21
CryptoExchange.Net/ComonObjects/OrderBook.cs
Normal file
21
CryptoExchange.Net/ComonObjects/OrderBook.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace CryptoExchange.Net.ComonObjects
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Order book data
|
||||||
|
/// </summary>
|
||||||
|
public class OrderBook: BaseComonObject
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// List of bids
|
||||||
|
/// </summary>
|
||||||
|
public IEnumerable<OrderBookEntry> Bids { get; set; } = Array.Empty<OrderBookEntry>();
|
||||||
|
/// <summary>
|
||||||
|
/// List of asks
|
||||||
|
/// </summary>
|
||||||
|
public IEnumerable<OrderBookEntry> Asks { get; set; } = Array.Empty<OrderBookEntry>();
|
||||||
|
}
|
||||||
|
}
|
17
CryptoExchange.Net/ComonObjects/OrderBookEntry.cs
Normal file
17
CryptoExchange.Net/ComonObjects/OrderBookEntry.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
namespace CryptoExchange.Net.ComonObjects
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Order book entry
|
||||||
|
/// </summary>
|
||||||
|
public class OrderBookEntry
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Quantity of the entry
|
||||||
|
/// </summary>
|
||||||
|
public decimal Quantity { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Price of the entry
|
||||||
|
/// </summary>
|
||||||
|
public decimal Price { get; set; }
|
||||||
|
}
|
||||||
|
}
|
17
CryptoExchange.Net/ComonObjects/OrderId.cs
Normal file
17
CryptoExchange.Net/ComonObjects/OrderId.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace CryptoExchange.Net.ComonObjects
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Id of an order
|
||||||
|
/// </summary>
|
||||||
|
public class OrderId: BaseComonObject
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Id of an order
|
||||||
|
/// </summary>
|
||||||
|
public string Id { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
65
CryptoExchange.Net/ComonObjects/Position.cs
Normal file
65
CryptoExchange.Net/ComonObjects/Position.cs
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
namespace CryptoExchange.Net.ComonObjects
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Position data
|
||||||
|
/// </summary>
|
||||||
|
public class Position: BaseComonObject
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Id of the position
|
||||||
|
/// </summary>
|
||||||
|
public string? Id { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Symbol of the position
|
||||||
|
/// </summary>
|
||||||
|
public string Symbol { get; set; } = string.Empty;
|
||||||
|
/// <summary>
|
||||||
|
/// Leverage
|
||||||
|
/// </summary>
|
||||||
|
public decimal Leverage { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Position quantity
|
||||||
|
/// </summary>
|
||||||
|
public decimal Quantity { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Entry price
|
||||||
|
/// </summary>
|
||||||
|
public decimal? EntryPrice { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Liquidation price
|
||||||
|
/// </summary>
|
||||||
|
public decimal? LiquidationPrice { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Unrealized profit and loss
|
||||||
|
/// </summary>
|
||||||
|
public decimal? UnrealizedPnl { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Realized profit and loss
|
||||||
|
/// </summary>
|
||||||
|
public decimal? RealizedPnl { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Mark price
|
||||||
|
/// </summary>
|
||||||
|
public decimal? MarkPrice { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Auto adding margin
|
||||||
|
/// </summary>
|
||||||
|
public bool? AutoMargin { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Position margin
|
||||||
|
/// </summary>
|
||||||
|
public decimal? PositionMargin { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Position side
|
||||||
|
/// </summary>
|
||||||
|
public PositionSide? Side { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Is isolated
|
||||||
|
/// </summary>
|
||||||
|
public bool? Isolated { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Maintenance margin
|
||||||
|
/// </summary>
|
||||||
|
public decimal? MaintananceMargin { get; set; }
|
||||||
|
}
|
||||||
|
}
|
33
CryptoExchange.Net/ComonObjects/Symbol.cs
Normal file
33
CryptoExchange.Net/ComonObjects/Symbol.cs
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
namespace CryptoExchange.Net.ComonObjects
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Symbol data
|
||||||
|
/// </summary>
|
||||||
|
public class Symbol: BaseComonObject
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Name of the symbol
|
||||||
|
/// </summary>
|
||||||
|
public string Name { get; set; } = string.Empty;
|
||||||
|
/// <summary>
|
||||||
|
/// Minimal quantity of an order
|
||||||
|
/// </summary>
|
||||||
|
public decimal? MinTradeQuantity { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Step with which the quantity should increase
|
||||||
|
/// </summary>
|
||||||
|
public decimal? QuantityStep { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// step with which the price should increase
|
||||||
|
/// </summary>
|
||||||
|
public decimal? PriceStep { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// The max amount of decimals for quantity
|
||||||
|
/// </summary>
|
||||||
|
public int? QuantityDecimals { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// The max amount of decimal for price
|
||||||
|
/// </summary>
|
||||||
|
public int? PriceDecimals { get; set; }
|
||||||
|
}
|
||||||
|
}
|
35
CryptoExchange.Net/ComonObjects/Ticker.cs
Normal file
35
CryptoExchange.Net/ComonObjects/Ticker.cs
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace CryptoExchange.Net.ComonObjects
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Ticker data
|
||||||
|
/// </summary>
|
||||||
|
public class Ticker: BaseComonObject
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Symbol
|
||||||
|
/// </summary>
|
||||||
|
public string Symbol { get; set; } = string.Empty;
|
||||||
|
/// <summary>
|
||||||
|
/// Price 24 hours ago
|
||||||
|
/// </summary>
|
||||||
|
public decimal? Price24H { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Last trade price
|
||||||
|
/// </summary>
|
||||||
|
public decimal? LastPrice { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 24 hour low price
|
||||||
|
/// </summary>
|
||||||
|
public decimal? LowPrice { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 24 hour high price
|
||||||
|
/// </summary>
|
||||||
|
public decimal? HighPrice { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 24 hour volume
|
||||||
|
/// </summary>
|
||||||
|
public decimal? Volume { get; set; }
|
||||||
|
}
|
||||||
|
}
|
50
CryptoExchange.Net/ComonObjects/Trade.cs
Normal file
50
CryptoExchange.Net/ComonObjects/Trade.cs
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace CryptoExchange.Net.ComonObjects
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Trade data
|
||||||
|
/// </summary>
|
||||||
|
public class Trade: BaseComonObject
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Symbol of the trade
|
||||||
|
/// </summary>
|
||||||
|
public string Symbol { get; set; } = string.Empty;
|
||||||
|
/// <summary>
|
||||||
|
/// Price of the trade
|
||||||
|
/// </summary>
|
||||||
|
public decimal Price { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Quantity of the trade
|
||||||
|
/// </summary>
|
||||||
|
public decimal Quantity { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Timestamp of the trade
|
||||||
|
/// </summary>
|
||||||
|
public DateTime Timestamp { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// User trade info
|
||||||
|
/// </summary>
|
||||||
|
public class UserTrade: Trade
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Id of the trade
|
||||||
|
/// </summary>
|
||||||
|
public string Id { get; set; } = string.Empty;
|
||||||
|
/// <summary>
|
||||||
|
/// Order id of the trade
|
||||||
|
/// </summary>
|
||||||
|
public string? OrderId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Fee of the trade
|
||||||
|
/// </summary>
|
||||||
|
public decimal? Fee { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// The asset the fee is paid in
|
||||||
|
/// </summary>
|
||||||
|
public string? FeeAsset { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -1,35 +0,0 @@
|
|||||||
using System;
|
|
||||||
|
|
||||||
namespace CryptoExchange.Net.ExchangeInterfaces
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Common trade
|
|
||||||
/// </summary>
|
|
||||||
public interface ICommonTrade
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Id of the trade
|
|
||||||
/// </summary>
|
|
||||||
public string CommonId { get; }
|
|
||||||
/// <summary>
|
|
||||||
/// Price of the trade
|
|
||||||
/// </summary>
|
|
||||||
public decimal CommonPrice { get; }
|
|
||||||
/// <summary>
|
|
||||||
/// Quantity of the trade
|
|
||||||
/// </summary>
|
|
||||||
public decimal CommonQuantity { get; }
|
|
||||||
/// <summary>
|
|
||||||
/// Fee paid for the trade
|
|
||||||
/// </summary>
|
|
||||||
public decimal CommonFee { get; }
|
|
||||||
/// <summary>
|
|
||||||
/// The asset fee was paid in
|
|
||||||
/// </summary>
|
|
||||||
public string? CommonFeeAsset { get; }
|
|
||||||
/// <summary>
|
|
||||||
/// Trade time
|
|
||||||
/// </summary>
|
|
||||||
DateTime CommonTradeTime { get; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,35 +0,0 @@
|
|||||||
using System;
|
|
||||||
|
|
||||||
namespace CryptoExchange.Net.ExchangeInterfaces
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Common kline
|
|
||||||
/// </summary>
|
|
||||||
public interface ICommonKline
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// High price for this kline
|
|
||||||
/// </summary>
|
|
||||||
decimal CommonHighPrice { get; }
|
|
||||||
/// <summary>
|
|
||||||
/// Low price for this kline
|
|
||||||
/// </summary>
|
|
||||||
decimal CommonLowPrice { get; }
|
|
||||||
/// <summary>
|
|
||||||
/// Open price for this kline
|
|
||||||
/// </summary>
|
|
||||||
decimal CommonOpenPrice { get; }
|
|
||||||
/// <summary>
|
|
||||||
/// Close price for this kline
|
|
||||||
/// </summary>
|
|
||||||
decimal CommonClosePrice { get; }
|
|
||||||
/// <summary>
|
|
||||||
/// Open time for this kline
|
|
||||||
/// </summary>
|
|
||||||
DateTime CommonOpenTime { get; }
|
|
||||||
/// <summary>
|
|
||||||
/// Volume of this kline
|
|
||||||
/// </summary>
|
|
||||||
decimal CommonVolume { get; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,43 +0,0 @@
|
|||||||
using System;
|
|
||||||
|
|
||||||
namespace CryptoExchange.Net.ExchangeInterfaces
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Common order
|
|
||||||
/// </summary>
|
|
||||||
public interface ICommonOrder: ICommonOrderId
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Symbol of the order
|
|
||||||
/// </summary>
|
|
||||||
public string CommonSymbol { get; }
|
|
||||||
/// <summary>
|
|
||||||
/// Price of the order
|
|
||||||
/// </summary>
|
|
||||||
public decimal CommonPrice { get; }
|
|
||||||
/// <summary>
|
|
||||||
/// Quantity of the order
|
|
||||||
/// </summary>
|
|
||||||
public decimal CommonQuantity { get; }
|
|
||||||
/// <summary>
|
|
||||||
/// Status of the order
|
|
||||||
/// </summary>
|
|
||||||
public IExchangeClient.OrderStatus CommonStatus { get; }
|
|
||||||
/// <summary>
|
|
||||||
/// Whether the order is active
|
|
||||||
/// </summary>
|
|
||||||
public bool IsActive { get; }
|
|
||||||
/// <summary>
|
|
||||||
/// Side of the order
|
|
||||||
/// </summary>
|
|
||||||
public IExchangeClient.OrderSide CommonSide { get; }
|
|
||||||
/// <summary>
|
|
||||||
/// Type of the order
|
|
||||||
/// </summary>
|
|
||||||
public IExchangeClient.OrderType CommonType { get; }
|
|
||||||
/// <summary>
|
|
||||||
/// order time
|
|
||||||
/// </summary>
|
|
||||||
DateTime CommonOrderTime { get; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using CryptoExchange.Net.Interfaces;
|
|
||||||
|
|
||||||
namespace CryptoExchange.Net.ExchangeInterfaces
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Common order book
|
|
||||||
/// </summary>
|
|
||||||
public interface ICommonOrderBook
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Bids
|
|
||||||
/// </summary>
|
|
||||||
IEnumerable<ISymbolOrderBookEntry> CommonBids { get; }
|
|
||||||
/// <summary>
|
|
||||||
/// Asks
|
|
||||||
/// </summary>
|
|
||||||
IEnumerable<ISymbolOrderBookEntry> CommonAsks { get; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
namespace CryptoExchange.Net.ExchangeInterfaces
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Common order id
|
|
||||||
/// </summary>
|
|
||||||
public interface ICommonOrderId
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Id of the order
|
|
||||||
/// </summary>
|
|
||||||
public string CommonId { get; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
using System;
|
|
||||||
|
|
||||||
namespace CryptoExchange.Net.ExchangeInterfaces
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Recent trade
|
|
||||||
/// </summary>
|
|
||||||
public interface ICommonRecentTrade
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Price of the trade
|
|
||||||
/// </summary>
|
|
||||||
decimal CommonPrice { get; }
|
|
||||||
/// <summary>
|
|
||||||
/// Quantity of the trade
|
|
||||||
/// </summary>
|
|
||||||
decimal CommonQuantity { get; }
|
|
||||||
/// <summary>
|
|
||||||
/// Trade time
|
|
||||||
/// </summary>
|
|
||||||
DateTime CommonTradeTime { get; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
namespace CryptoExchange.Net.ExchangeInterfaces
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Common symbol
|
|
||||||
/// </summary>
|
|
||||||
public interface ICommonSymbol
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Symbol name
|
|
||||||
/// </summary>
|
|
||||||
public string CommonName { get; }
|
|
||||||
/// <summary>
|
|
||||||
/// Minimum trade quantity
|
|
||||||
/// </summary>
|
|
||||||
public decimal CommonMinimumTradeQuantity { get; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
namespace CryptoExchange.Net.ExchangeInterfaces
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Common ticker
|
|
||||||
/// </summary>
|
|
||||||
public interface ICommonTicker
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Symbol name
|
|
||||||
/// </summary>
|
|
||||||
public string CommonSymbol { get; }
|
|
||||||
/// <summary>
|
|
||||||
/// High price
|
|
||||||
/// </summary>
|
|
||||||
public decimal CommonHighPrice { get; }
|
|
||||||
/// <summary>
|
|
||||||
/// Low price
|
|
||||||
/// </summary>
|
|
||||||
public decimal CommonLowPrice { get; }
|
|
||||||
/// <summary>
|
|
||||||
/// Volume
|
|
||||||
/// </summary>
|
|
||||||
public decimal CommonVolume { get; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,14 +1,15 @@
|
|||||||
using System;
|
using CryptoExchange.Net.ComonObjects;
|
||||||
|
using CryptoExchange.Net.Objects;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using CryptoExchange.Net.Objects;
|
|
||||||
|
|
||||||
namespace CryptoExchange.Net.ExchangeInterfaces
|
namespace CryptoExchange.Net.Interfaces
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Shared interface for exchange wrappers based on the CryptoExchange.Net package
|
/// Comon rest client endpoints
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IExchangeClient
|
public interface IBaseRestClient
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The name of the exchange
|
/// The name of the exchange
|
||||||
@ -18,11 +19,11 @@ namespace CryptoExchange.Net.ExchangeInterfaces
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Should be triggered on order placing
|
/// Should be triggered on order placing
|
||||||
/// </summary>
|
/// </summary>
|
||||||
event Action<ICommonOrderId> OnOrderPlaced;
|
event Action<OrderId> OnOrderPlaced;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Should be triggered on order cancelling
|
/// Should be triggered on order cancelling
|
||||||
/// </summary>
|
/// </summary>
|
||||||
event Action<ICommonOrderId> OnOrderCanceled;
|
event Action<OrderId> OnOrderCanceled;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the symbol name based on a base and quote asset
|
/// 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
|
/// Get a list of symbols for the exchange
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<WebCallResult<IEnumerable<ICommonSymbol>>> GetSymbolsAsync();
|
Task<WebCallResult<IEnumerable<Symbol>>> GetSymbolsAsync();
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get a list of tickers for the exchange
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
Task<WebCallResult<IEnumerable<ICommonTicker>>> GetTickersAsync();
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get a ticker for the exchange
|
/// Get a ticker for the exchange
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="symbol">The symbol to get klines for</param>
|
/// <param name="symbol">The symbol to get klines for</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<WebCallResult<ICommonTicker>> GetTickerAsync(string symbol);
|
Task<WebCallResult<Ticker>> GetTickerAsync(string symbol);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get a list of tickers for the exchange
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<WebCallResult<IEnumerable<Ticker>>> GetTickersAsync();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get a list of candles for a given symbol on the exchange
|
/// Get a list of candles for a given symbol on the exchange
|
||||||
@ -60,20 +61,98 @@ namespace CryptoExchange.Net.ExchangeInterfaces
|
|||||||
/// <param name="endTime">[Optional] End time to retrieve klines for</param>
|
/// <param name="endTime">[Optional] End time to retrieve klines for</param>
|
||||||
/// <param name="limit">[Optional] Max number of results</param>
|
/// <param name="limit">[Optional] Max number of results</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<WebCallResult<IEnumerable<ICommonKline>>> GetKlinesAsync(string symbol, TimeSpan timespan, DateTime? startTime = null, DateTime? endTime = null, int? limit = null);
|
Task<WebCallResult<IEnumerable<Kline>>> GetKlinesAsync(string symbol, TimeSpan timespan, DateTime? startTime = null, DateTime? endTime = null, int? limit = null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the order book for a symbol
|
/// Get the order book for a symbol
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="symbol">The symbol to get the book for</param>
|
/// <param name="symbol">The symbol to get the book for</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<WebCallResult<ICommonOrderBook>> GetOrderBookAsync(string symbol);
|
Task<WebCallResult<ComonObjects.OrderBook>> GetOrderBookAsync(string symbol);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The recent trades for a symbol
|
/// The recent trades for a symbol
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="symbol">The symbol to get the trades for</param>
|
/// <param name="symbol">The symbol to get the trades for</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<WebCallResult<IEnumerable<ICommonRecentTrade>>> GetRecentTradesAsync(string symbol);
|
Task<WebCallResult<IEnumerable<Trade>>> GetRecentTradesAsync(string symbol);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get balances
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="accountId">[Optional] The account id to retrieve balances for, required for some exchanges, ignored otherwise</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<WebCallResult<IEnumerable<Balance>>> GetBalancesAsync(string? accountId = null);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get an order by id
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="orderId">The id</param>
|
||||||
|
/// <param name="symbol">[Optional] The symbol the order is on, required for some exchanges, ignored otherwise</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<WebCallResult<Order>> GetOrderAsync(string orderId, string? symbol = null);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get trades for an order by id
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="orderId">The id</param>
|
||||||
|
/// <param name="symbol">[Optional] The symbol the order is on, required for some exchanges, ignored otherwise</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<WebCallResult<IEnumerable<UserTrade>>> GetOrderTradesAsync(string orderId, string? symbol = null);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get a list of open orders
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="symbol">[Optional] The symbol to get open orders for, required for some exchanges, ignored otherwise</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<WebCallResult<IEnumerable<Order>>> GetOpenOrdersAsync(string? symbol = null);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get a list of closed orders
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="symbol">[Optional] The symbol to get closed orders for, required for some exchanges, ignored otherwise</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<WebCallResult<IEnumerable<Order>>> GetClosedOrdersAsync(string? symbol = null);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cancel an order by id
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="orderId">The id</param>
|
||||||
|
/// <param name="symbol">[Optional] The symbol the order is on, required for some exchanges, ignored otherwise</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<WebCallResult<OrderId>> CancelOrderAsync(string orderId, string? symbol = null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Comon futures endpoints
|
||||||
|
/// </summary>
|
||||||
|
public interface IFuturesClient: IBaseRestClient
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Place an order
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="symbol">The symbol the order is for</param>
|
||||||
|
/// <param name="side">The side of the order</param>
|
||||||
|
/// <param name="type">The type of the order</param>
|
||||||
|
/// <param name="quantity">The quantity of the order</param>
|
||||||
|
/// <param name="price">The price of the order, only for limit orders</param>
|
||||||
|
/// <param name="accountId">[Optional] The account id to place the order on, required for some exchanges, ignored otherwise</param>
|
||||||
|
/// <param name="leverage">[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)</param>
|
||||||
|
/// <returns>The id of the resulting order</returns>
|
||||||
|
Task<WebCallResult<OrderId>> PlaceOrderAsync(string symbol, OrderSide side, OrderType type, decimal quantity, decimal? price = null, int? leverage = null, string? accountId = null);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get position
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<WebCallResult<IEnumerable<Position>>> GetPositionsAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Comon spot endpoints
|
||||||
|
/// </summary>
|
||||||
|
public interface ISpotClient: IBaseRestClient
|
||||||
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Place an order
|
/// Place an order
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -84,99 +163,6 @@ namespace CryptoExchange.Net.ExchangeInterfaces
|
|||||||
/// <param name="price">The price of the order, only for limit orders</param>
|
/// <param name="price">The price of the order, only for limit orders</param>
|
||||||
/// <param name="accountId">[Optional] The account id to place the order on, required for some exchanges, ignored otherwise</param>
|
/// <param name="accountId">[Optional] The account id to place the order on, required for some exchanges, ignored otherwise</param>
|
||||||
/// <returns>The id of the resulting order</returns>
|
/// <returns>The id of the resulting order</returns>
|
||||||
Task<WebCallResult<ICommonOrderId>> PlaceOrderAsync(string symbol, OrderSide side, OrderType type, decimal quantity, decimal? price = null, string? accountId = null);
|
Task<WebCallResult<OrderId>> PlaceOrderAsync(string symbol, OrderSide side, OrderType type, decimal quantity, decimal? price = null, string? accountId = null);
|
||||||
/// <summary>
|
|
||||||
/// Get an order by id
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="orderId">The id</param>
|
|
||||||
/// <param name="symbol">[Optional] The symbol the order is on, required for some exchanges, ignored otherwise</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
Task<WebCallResult<ICommonOrder>> GetOrderAsync(string orderId, string? symbol = null);
|
|
||||||
/// <summary>
|
|
||||||
/// Get trades for an order by id
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="orderId">The id</param>
|
|
||||||
/// <param name="symbol">[Optional] The symbol the order is on, required for some exchanges, ignored otherwise</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
Task<WebCallResult<IEnumerable<ICommonTrade>>> GetTradesAsync(string orderId, string? symbol = null);
|
|
||||||
/// <summary>
|
|
||||||
/// Get a list of open orders
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="symbol">[Optional] The symbol to get open orders for, required for some exchanges, ignored otherwise</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
Task<WebCallResult<IEnumerable<ICommonOrder>>> GetOpenOrdersAsync(string? symbol = null);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get a list of closed orders
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="symbol">[Optional] The symbol to get closed orders for, required for some exchanges, ignored otherwise</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
Task<WebCallResult<IEnumerable<ICommonOrder>>> GetClosedOrdersAsync(string? symbol = null);
|
|
||||||
/// <summary>
|
|
||||||
/// Cancel an order by id
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="orderId">The id</param>
|
|
||||||
/// <param name="symbol">[Optional] The symbol the order is on, required for some exchanges, ignored otherwise</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
Task<WebCallResult<ICommonOrderId>> CancelOrderAsync(string orderId, string? symbol = null);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get balances
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="accountId">[Optional] The account id to retrieve balances for, required for some exchanges, ignored otherwise</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
Task<WebCallResult<IEnumerable<ICommonBalance>>> GetBalancesAsync(string? accountId = null);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Common order id
|
|
||||||
/// </summary>
|
|
||||||
public enum OrderType
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Limit type
|
|
||||||
/// </summary>
|
|
||||||
Limit,
|
|
||||||
/// <summary>
|
|
||||||
/// Market type
|
|
||||||
/// </summary>
|
|
||||||
Market,
|
|
||||||
/// <summary>
|
|
||||||
/// Other order type
|
|
||||||
/// </summary>
|
|
||||||
Other
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Common order side
|
|
||||||
/// </summary>
|
|
||||||
public enum OrderSide
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Buy order
|
|
||||||
/// </summary>
|
|
||||||
Buy,
|
|
||||||
/// <summary>
|
|
||||||
/// Sell order
|
|
||||||
/// </summary>
|
|
||||||
Sell
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Common order status
|
|
||||||
/// </summary>
|
|
||||||
public enum OrderStatus
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// placed and not fully filled order
|
|
||||||
/// </summary>
|
|
||||||
Active,
|
|
||||||
/// <summary>
|
|
||||||
/// canceled order
|
|
||||||
/// </summary>
|
|
||||||
Canceled,
|
|
||||||
/// <summary>
|
|
||||||
/// filled order
|
|
||||||
/// </summary>
|
|
||||||
Filled
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user