MEXC v3 fetch_markets() returns both decimals and tick sizes for price and amount precisions
See original GitHub issue- OS: Linux Mint
- Programming Language version: Python 3.10
- CCXT version: 1.84.42
exchange = ccxt.mexc3()
print(exchange.fetch_markets())
...
{'id': 'ORBUSDT', 'symbol': 'ORB/USDT', 'base': 'ORB', 'quote': 'USDT', 'settle': None, 'baseId': 'ORB', 'quoteId': 'USDT', 'settleId': None, 'type': 'spot', 'spot': True, 'margin': False, 'swap': False, 'future': False, 'option': False, 'active': True, 'contract': False, 'linear': None, 'inverse': None, 'taker': None, 'maker': None, 'contractSize': None, 'expiry': None, 'expiryDatetime': None, 'strike': None, 'optionType': None, 'precision': {'amount': 2, 'price': 4, 'base': 2, 'quote': 4}, 'limits': {'leverage': {'min': None, 'max': None}, 'amount': {'min': None, 'max': None}, 'price': {'min': None, 'max': None}, 'cost': {'min': None, 'max': None}}, 'info': {'symbol': 'ORBUSDT', 'status': 'ENABLED', 'baseAsset': 'ORB', 'baseAssetPrecision': '2', 'quoteAsset': 'USDT', 'quotePrecision': '4', 'quoteAssetPrecision': '4', 'baseCommissionPrecision': '2', 'quoteCommissionPrecision': '4', 'orderTypes': ['LIMIT', 'LIMIT_MAKER'], 'quoteOrderQtyMarketAllowed': False, 'isSpotTradingAllowed': True, 'isMarginTradingAllowed': False, 'quoteAmountPrecision': '5', 'baseSizePrecision': '0.001', 'permissions': ['SPOT
...
{'id': 'XMR_USDT', 'symbol': 'XMR/USDT:USDT', 'base': 'XMR', 'quote': 'USDT', 'settle': 'USDT', 'baseId': 'XMR', 'quoteId': 'USDT', 'settleId': 'USDT', 'type': 'swap', 'spot': False, 'margin': False, 'swap': True, 'future': False, 'option': False, 'active': True, 'contract': True, 'linear': True, 'inverse': False, 'taker': 0.0006, 'maker': 0.0002, 'contractSize': 0.01, 'expiry': None, 'expiryDatetime': None, 'strike': None, 'optionType': None, 'precision': {'amount': 1.0, 'price': 0.01}, 'limits': {'leverage': {'min': 1.0, 'max': 50.0}, 'amount': {'min': 1.0, 'max': 100000.0}, 'price': {'min': None, 'max': None}, 'cost': {'min': None, 'max': None}}, 'info': {'symbol': 'XMR_USDT', 'displayName': 'XMR_USDT永续', 'displayNameEn': 'XMR_USDT PERPETUAL', 'positionOpenType': '3', 'baseCoin': 'XMR', 'quoteCoin': 'USDT', 'baseCoinName': 'XMR', 'quoteCoinName': 'USDT', 'futureType': '1', 'settleCoin': 'USDT', 'contractSize': '0.01', 'minLeverage': '1', 'maxLeverage': '50', 'priceScale': '2', 'volScale': '0', 'amountScale': '4', 'priceUnit': '0.01', 'volUnit': '1', 'minVol': '1', 'maxVol': '100000', 'bidLimitPriceRate': '0.2', 'askLimitPriceRate': '0.2', 'takerFeeRate': '0.0006', 'makerFeeRate': '0.0002', 'maintenanceMarginRate': '0.01', 'initialMarginRate': '0.02', 'riskBaseVol': '40000', 'riskIncrVol': '40000', 'riskIncrMmr': '0.005', 'riskIncrImr': '0.005', 'riskLevelLimit': '5', 'priceCoefficientVariation': '0.1', 'indexOrigin': ['BINANCE', 'HUOBI', 'MEXC'], 'state': '0', 'isNew': False, 'isHot': False, 'isHidden': False, 'conceptPlate': ['mc-trade-zone-privity'], 'riskLimitType': 'BY_VOLUME', 'triggerProtect': '0.1', 'maxNumOrders': ['200', '30']}}
...
mexc3 fetch_markets
has both number of decimals and tick sizes as price and amount precisions. The logic seems to be that spot markets use decimals and swap markets tick sizes, and both market types are returned with the same fetch_markets
call. exchange.precisionMode
is equal to 2 aka DECIMAL_PLACES constant. Is there any unified way of telling what precision mode each market uses? If not, is there something that could be done about it?
I was also wondering what is the meaning of ‘base’ and ‘quote’ in the ‘ORB/USDT’ market and how do they work in combination with ‘amount’ and ‘price’?
'precision': {'amount': 2, 'price': 4, 'base': 2, 'quote': 4}
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Introduction – API Document - GitHub Pages
Documentation for the mexc global API. ... 3.Deposit Address: The return parameter tag is changed to memo , and the memo ... price,...
Read more >Binance API : How i get Price Digits and Lots size Digits
You can get the decimal information from exchange_info API: spot: /api/v3/ ... and baseAssetPrecision to indicate the decimal precision.
Read more >LOT_SIZE step size not correct on all pairs - Spot/Margin API
So basically why is there 2 decimals instead of one, and if I should not use the LOT_SIZE.tick_size as base asset amount precision,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
floating-point notation is a common problem in computer world, which has different ways to solve (which I can’t suggest in this post as it depends on your custom implementations and goals). you can read more here: https://0.30000000000000004.com/
so, if you want more accuracy, you might use string for
exchange.number
.Above, I’ve linked a PR. when it’s merged, the issue will be fixed and mexc3 will use TICK_SIZE. I made a mistake delibeartely when I said DECIMAL_PLACES should have 0 and TICK_SIZE should have 2 - because these values were correct for JS version, but in python, you are right - they are with those opposite values as you noted.
when that PR is merged, the base & quote keys will be removed from
precision
and thus, you will haveprice
andamount
andcost
keys.