Skip to content

MEXC: Add base and quote precision #861

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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; }
}
}
Loading