diff --git a/src/ExchangeSharp/API/Exchanges/BinanceGroup/BinanceGroupCommon.cs b/src/ExchangeSharp/API/Exchanges/BinanceGroup/BinanceGroupCommon.cs index 41d8d8f8..542d5dad 100644 --- a/src/ExchangeSharp/API/Exchanges/BinanceGroup/BinanceGroupCommon.cs +++ b/src/ExchangeSharp/API/Exchanges/BinanceGroup/BinanceGroupCommon.cs @@ -162,12 +162,19 @@ protected internal override async Task> OnGetMarketS JToken allSymbols = obj["symbols"]; foreach (JToken marketSymbolToken in allSymbols) { - var market = new ExchangeMarket + var market = new ExchangeMarketBinance { + // common ExchangeMarket properties MarketSymbol = marketSymbolToken["symbol"].ToStringUpperInvariant(), IsActive = ParseMarketStatus(marketSymbolToken["status"].ToStringUpperInvariant()), QuoteCurrency = marketSymbolToken["quoteAsset"].ToStringUpperInvariant(), - BaseCurrency = marketSymbolToken["baseAsset"].ToStringUpperInvariant() + BaseCurrency = marketSymbolToken["baseAsset"].ToStringUpperInvariant(), + + // Binance specific properties + Status = (BinanceSymbolStatus)Enum.Parse(typeof(BinanceSymbolStatus), marketSymbolToken["status"].ToStringInvariant(), true), + BaseAssetPrecision = marketSymbolToken["baseAssetPrecision"].ConvertInvariant(), + QuotePrecision = marketSymbolToken["quotePrecision"].ConvertInvariant(), + IsIceBergAllowed = marketSymbolToken["icebergAllowed"].ConvertInvariant(), }; // "LOT_SIZE" @@ -195,6 +202,13 @@ protected internal override async Task> OnGetMarketS { market.MinTradeSizeInQuoteCurrency = minNotionalFilter["minNotional"].ConvertInvariant(); } + + // MAX_NUM_ORDERS + JToken? maxOrdersFilter = filters?.FirstOrDefault(x => string.Equals(x["filterType"].ToStringUpperInvariant(), "MAX_NUM_ORDERS")); + if (maxOrdersFilter != null) + { + market.MaxNumOrders = maxOrdersFilter["maxNumberOrders"].ConvertInvariant(); + } markets.Add(market); } diff --git a/src/ExchangeSharp/API/Exchanges/BinanceGroup/Models/BinanceAggregateTrade.cs b/src/ExchangeSharp/API/Exchanges/BinanceGroup/Models/BinanceAggregateTrade.cs index 6d4fcbb5..f3d90872 100644 --- a/src/ExchangeSharp/API/Exchanges/BinanceGroup/Models/BinanceAggregateTrade.cs +++ b/src/ExchangeSharp/API/Exchanges/BinanceGroup/Models/BinanceAggregateTrade.cs @@ -12,7 +12,7 @@ The above copyright notice and this permission notice shall be included in all c namespace ExchangeSharp.BinanceGroup { - public class BinanceAggregateTrade : ExchangeTrade + public sealed class BinanceAggregateTrade : ExchangeTrade { public long FirstTradeId { get; set; } public long LastTradeId { get; set; } diff --git a/src/ExchangeSharp/API/Exchanges/BinanceGroup/Models/BinanceDEXTrade.cs b/src/ExchangeSharp/API/Exchanges/BinanceGroup/Models/BinanceDEXTrade.cs index 7ed575ca..de4699ef 100644 --- a/src/ExchangeSharp/API/Exchanges/BinanceGroup/Models/BinanceDEXTrade.cs +++ b/src/ExchangeSharp/API/Exchanges/BinanceGroup/Models/BinanceDEXTrade.cs @@ -15,7 +15,7 @@ namespace ExchangeSharp.BinanceGroup /// /// Binance DEX doesn't suppport streaming aggregate trades like Binance/US /// - public class BinanceDEXTrade : ExchangeTrade + public sealed class BinanceDEXTrade : ExchangeTrade { public string BuyerOrderId { get; set; } public string SellerOrderId { get; set; } diff --git a/src/ExchangeSharp/API/Exchanges/BinanceGroup/Models/ExchangeMarketBinance.cs b/src/ExchangeSharp/API/Exchanges/BinanceGroup/Models/ExchangeMarketBinance.cs new file mode 100644 index 00000000..6a99a69f --- /dev/null +++ b/src/ExchangeSharp/API/Exchanges/BinanceGroup/Models/ExchangeMarketBinance.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace ExchangeSharp.BinanceGroup +{ + /// + /// Binance SymbolStatus + /// + public enum BinanceSymbolStatus : byte + { + /// + /// Pre-trading. + /// + PreTrading = 2, + + /// + /// Trading. + /// + Trading = 4, + + /// + /// Post-trading + /// + PostTrading = 6, + + /// + /// End-of-day + /// + EndOfDay = 8, + + /// + /// Halt. + /// + Halt = 10, + + /// + /// Auction match. + /// + AuctionMatch = 12, + + /// + /// Break. + /// + Break = 14, + } + + public sealed class ExchangeMarketBinance : ExchangeMarket + { + public BinanceSymbolStatus Status { get; set; } + public int BaseAssetPrecision { get; set; } + public int QuotePrecision { get; set; } + public int MaxNumOrders { get; set; } + public bool IsIceBergAllowed { get; set; } + } +} diff --git a/src/ExchangeSharp/Model/ExchangeMarket.cs b/src/ExchangeSharp/Model/ExchangeMarket.cs index d6fa4aee..f702b161 100644 --- a/src/ExchangeSharp/Model/ExchangeMarket.cs +++ b/src/ExchangeSharp/Model/ExchangeMarket.cs @@ -13,7 +13,7 @@ The above copyright notice and this permission notice shall be included in all c namespace ExchangeSharp { /// Representation of a market on an exchange. - public sealed class ExchangeMarket + public class ExchangeMarket { /// Id of the market (specific to the exchange), null if none public string MarketId { get; set; }