From 9545f6c172ef5c28848784bececd814385f71f1d Mon Sep 17 00:00:00 2001 From: BZ-CO <30245815+BZ-CO@users.noreply.github.com> Date: Tue, 3 Dec 2024 23:02:21 +0200 Subject: [PATCH] MEXC: Add base and quote precision (#861) --- src/ExchangeSharp/API/Exchanges/MEXC/ExchangeMEXCAPI.cs | 5 ++++- .../API/Exchanges/MEXC/Models/ExchangeMarketMexc.cs | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 src/ExchangeSharp/API/Exchanges/MEXC/Models/ExchangeMarketMexc.cs diff --git a/src/ExchangeSharp/API/Exchanges/MEXC/ExchangeMEXCAPI.cs b/src/ExchangeSharp/API/Exchanges/MEXC/ExchangeMEXCAPI.cs index 0c5c341b..613d7153 100644 --- a/src/ExchangeSharp/API/Exchanges/MEXC/ExchangeMEXCAPI.cs +++ b/src/ExchangeSharp/API/Exchanges/MEXC/ExchangeMEXCAPI.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using ExchangeSharp.Models; using Newtonsoft.Json.Linq; namespace ExchangeSharp @@ -51,13 +52,15 @@ protected internal override async Task> OnGetMarketS var symbols = await MakeJsonRequestAsync("/exchangeInfo", BaseUrl); return (symbols["symbols"] ?? throw new ArgumentNullException()) - .Select(symbol => new ExchangeMarket() + .Select(symbol => new ExchangeMarketMexc() { MarketSymbol = symbol["symbol"].ToStringInvariant(), IsActive = symbol["isSpotTradingAllowed"].ConvertInvariant(), MarginEnabled = symbol["isMarginTradingAllowed"].ConvertInvariant(), BaseCurrency = symbol["baseAsset"].ToStringInvariant(), QuoteCurrency = symbol["quoteAsset"].ToStringInvariant(), + BaseAssetPrecision = symbol["baseAssetPrecision"].ConvertInvariant(), + QuoteAssetPrecision = symbol["quoteAssetPrecision"].ConvertInvariant(), QuantityStepSize = symbol["baseSizePrecision"].ConvertInvariant(), // Not 100% sure about this PriceStepSize = diff --git a/src/ExchangeSharp/API/Exchanges/MEXC/Models/ExchangeMarketMexc.cs b/src/ExchangeSharp/API/Exchanges/MEXC/Models/ExchangeMarketMexc.cs new file mode 100644 index 00000000..8b59ddf5 --- /dev/null +++ b/src/ExchangeSharp/API/Exchanges/MEXC/Models/ExchangeMarketMexc.cs @@ -0,0 +1,8 @@ +namespace ExchangeSharp.Models +{ + public class ExchangeMarketMexc : ExchangeMarket + { + public int BaseAssetPrecision { get; set; } + public int QuoteAssetPrecision { get; set; } + } +}