question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bitvavo: Limit order precision is incorrect (resulting in 214: Precision to detailed)

See original GitHub issue

CCXT 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:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
marcoismobilecommented, Jan 17, 2021

@kroitor Confirmed that currency_to_precision is now working as expected in v1.40.70.

Thanks again for the fast fix! 👍

2reactions
marcoismobilecommented, Jan 17, 2021

@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': []

Read more comments on GitHub >

github_iconTop Results From Across the Web

Trading Rules
Bitvavo operates a central limit order book (CLOB) trading platform, where digital ... Fees are rounded up, to the precision of the asset....
Read more >
Which different order types exist? - Support - Bitvavo.com
Bitvavo currently supports the following order types: 1. Market order (standard). 2. Limit order. Good Till Cancelled. Immediate Or Cancel. Fill or Kill....
Read more >
Limit order - Immediate Or Cancel – Bitvavo Help Center
An Immediate Or Cancel limit order has the following characteristics: Your order will be executed at the price you've entered or at an...
Read more >
Limit buy orders in app - Support - Bitvavo.com
Currently, Bitvavo only supports a Good Til Canceled limit order in the app, this order ... The buy instructions will be explained in...
Read more >
Limit order - Fill Or Kill – Bitvavo Help Center - Support
As there is currently no seller who is willing to sell at least 10 Bitcoin for €999 per item, your order cannot be...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found