Bitvavo: Limit order precision is incorrect (resulting in 214: Precision to detailed)
See original GitHub issueCCXT version: 1.40.20
When placing limit orders on the Bitvavo exchange (with e.g. NEO-EUR or BCH-EUR) I got an error: 214 Precision to detailed.
bitvavo {"errorCode":214,"error":"Price is too detailed. Examples of valid prices for precision (number of significant digits) 5 are: 11313, 7500.10, 7500.20, 500.12, 0.0012345. Examples of precision 6 are: 11313.1, 7500.11, 7500.25, 500.123, 0.00123456."}
Checking the market data indicated it should have a precision of 5:
Request: GET https://api.bitvavo.com/v2/markets None None
Response: GET https://api.bitvavo.com/v2/markets 200 <CIMultiDictProxy('Content-Type': 'application/json; charset=utf-8', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Vary': 'Accept-Encoding', 'Date': 'Sun, 17 Jan 2021 09:59:23 GMT', 'Access-Control-Allow-Origin': '*', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains', 'Bitvavo-Ratelimit-Limit': '1000', 'Bitvavo-Ratelimit-Remaining': '988', 'Bitvavo-Ratelimit-ResetAt': '1610877600000', 'Etag': 'W/"6e15-xxx"', 'Content-Encoding': 'gzip', 'X-Cache': 'Miss from cloudfront', 'Via': '1.1 xxx.cloudfront.net (CloudFront)', 'X-Amz-Cf-Pop': 'FRA2-C1', 'X-Amz-Cf-Id': 'xxx-xxx==')> [{"market":"NEO-EUR","status":"trading","base":"NEO","quote":"EUR","pricePrecision":5,"minOrderInBaseAsset":"0.2","minOrderInQuoteAsset":"5","orderTypes":["market","limit","stopLoss","stopLossLimit","takeProfit","takeProfitLimit"]}]
It seems CCXT is parsing that correctly:
{'percentage': True, 'tierBased': True, 'taker': 0.0025, 'maker': 0.002, 'tiers': {'taker': [[0, 0.0025], [50000, 0.0024], [100000, 0.0022], [250000, 0.002], [500000, 0.0018], [1000000, 0.0016], [2500000, 0.0014], [5000000, 0.0012], [10000000, 0.001]], 'maker': [[0, 0.002], [50000, 0.0015], [100000, 0.001], [250000, 0.0006], [500000, 0.0003], [1000000, 0.0001], [2500000, -0.0001], [5000000, -0.0003], [10000000, -0.0005]]}, 'precision': {'price': 5, 'amount': 7}, 'limits': {'amount': {'min': 10.0, 'max': None}, 'price': {'min': None, 'max': None}, 'cost': {'min': 5.0, 'max': None}}, 'id': 'XLM-EUR', 'symbol': 'XLM/EUR', 'base': 'XLM', 'quote': 'EUR', 'baseId': 'XLM', 'quoteId': 'EUR', 'info': {'market': 'XLM-EUR', 'status': 'trading', 'base': 'XLM', 'quote': 'EUR', 'pricePrecision': 5, 'minOrderInBaseAsset': '10', 'minOrderInQuoteAsset': '5', 'orderTypes': ['market', 'limit', 'stopLoss', 'stopLossLimit', 'takeProfit', 'takeProfitLimit']}, 'active': True}
BUT when placing a limit order, it seems to send more than precision 5:
Request: POST https://api.bitvavo.com/v2/order {'BITVAVO-ACCESS-KEY': 'xxx', 'BITVAVO-ACCESS-SIGNATURE': 'xxx', 'BITVAVO-ACCESS-TIMESTAMP': '1610877568315', 'BITVAVO-ACCESS-WINDOW': '10000', 'Content-Type': 'application/json', 'User-Agent': 'python-requests/2.23.0', 'Accept-Encoding': 'gzip, deflate'} {"market":"NEO-EUR","side":"buy","orderType":"limit","price":"18.04491","amount":"0.28262817","postOnly":true}
Response: POST https://api.bitvavo.com/v2/order 400 <CIMultiDictProxy('Content-Type': 'application/json; charset=utf-8', 'Content-Length': '248', 'Connection': 'keep-alive', 'Date': 'Sun, 17 Jan 2021 09:59:28 GMT', 'Access-Control-Allow-Origin': '*', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains', 'Bitvavo-Ratelimit-Limit': '1000', 'Bitvavo-Ratelimit-Remaining': '914', 'Bitvavo-Ratelimit-ResetAt': '1610877600000', 'Etag': 'W/"f8-xxx"', 'X-Cache': 'Error from cloudfront', 'Via': '1.1 xxx.cloudfront.net (CloudFront)', 'X-Amz-Cf-Pop': 'FRA2-C1', 'X-Amz-Cf-Id': 'xxx-xxx==')> {"errorCode":214,"error":"Price is too detailed. Examples of valid prices for precision (number of significant digits) 5 are: 11313, 7500.10, 7500.20, 500.12, 0.0012345. Examples of precision 6 are: 11313.1, 7500.11, 7500.25, 500.123, 0.00123456."}
So it seems to parse the price precision incorrectly.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
@kroitor Confirmed that currency_to_precision is now working as expected in v1.40.70.
Thanks again for the fast fix! 👍
@kroitor It’s working flawless! Thanks for the super fast fix!
Limit order was successfully placed and response from Exchange now shows indeed 5 digits for the price in the order:
'info': {'orderId': 'a46c3ee6-0fe1-41ac-88e8-93799a133882', 'market': 'NEO-EUR', 'created': 1610880380366, 'updated': 1610880380366, 'status': 'new', 'side': 'buy', 'orderType': 'limit', 'amount': '0.27631553', 'amountRemaining': '0.27631553', 'price': '18.457', 'onHold': '5.12', 'onHoldCurrency': 'EUR', 'filledAmount': '0', 'filledAmountQuote': '0', 'feePaid': '0', 'feeCurrency': 'EUR', 'fills': [], 'selfTradePrevention': 'decrementAndCancel', 'visible': True, 'timeInForce': 'GTC', 'postOnly': True}, 'id': 'a46c3ee6-0fe1-41ac-88e8-93799a133882', 'clientOrderId': None, 'timestamp': 1610880380366, 'datetime': '2021-01-17T10:46:20.366Z', 'lastTradeTimestamp': None, 'symbol': 'NEO/EUR', 'type': 'limit', 'timeInForce': 'GTC', 'postOnly': True, 'side': 'buy', 'price': 18.457, 'stopPrice': None, 'amount': 0.27631553, 'cost': 0.0, 'average': None, 'filled': 0, 'remaining': 0.27631553, 'status': 'open', 'fee': {'cost': 0.0, 'currency': 'EUR'}, 'trades': []