Skip to content

Commit

Permalink
MEXC: Add base and quote precision (#861)
Browse files Browse the repository at this point in the history
  • Loading branch information
BZ-CO authored Dec 3, 2024
1 parent 2e68817 commit 9545f6c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/ExchangeSharp/API/Exchanges/MEXC/ExchangeMEXCAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using ExchangeSharp.Models;
using Newtonsoft.Json.Linq;

namespace ExchangeSharp
Expand Down Expand Up @@ -51,13 +52,15 @@ protected internal override async Task<IEnumerable<ExchangeMarket>> OnGetMarketS
var symbols = await MakeJsonRequestAsync<JToken>("/exchangeInfo", BaseUrl);

return (symbols["symbols"] ?? throw new ArgumentNullException())
.Select(symbol => new ExchangeMarket()
.Select(symbol => new ExchangeMarketMexc()
{
MarketSymbol = symbol["symbol"].ToStringInvariant(),
IsActive = symbol["isSpotTradingAllowed"].ConvertInvariant<bool>(),
MarginEnabled = symbol["isMarginTradingAllowed"].ConvertInvariant<bool>(),
BaseCurrency = symbol["baseAsset"].ToStringInvariant(),
QuoteCurrency = symbol["quoteAsset"].ToStringInvariant(),
BaseAssetPrecision = symbol["baseAssetPrecision"].ConvertInvariant<int>(),
QuoteAssetPrecision = symbol["quoteAssetPrecision"].ConvertInvariant<int>(),
QuantityStepSize = symbol["baseSizePrecision"].ConvertInvariant<decimal>(),
// Not 100% sure about this
PriceStepSize =
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace ExchangeSharp.Models
{
public class ExchangeMarketMexc : ExchangeMarket
{
public int BaseAssetPrecision { get; set; }
public int QuoteAssetPrecision { get; set; }
}
}

0 comments on commit 9545f6c

Please sign in to comment.