Cryptopia create_limit_buy_order failing with an exception
See original GitHub issueWhen using the Python version of the library, create_limit_buy_order() fails with the following exception:
Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm Community Edition 2017.3.2\helpers\pydev\_pydevd_bundle\pydevd_exec2.py", line 3, in Exec
exec(exp, global_vars, local_vars)
File "<input>", line 1, in <module>
File "D:\Development\crypto-p1\venv\lib\site-packages\ccxt\base\exchange.py", line 1009, in create_limit_buy_order
return self.create_order(symbol, 'limit', 'buy', *args)
File "D:\Development\crypto-p1\venv\lib\site-packages\ccxt\cryptopia.py", line 354, in create_order
'Amount': self.amount_to_precision(symbol, amount),
File "D:\Development\crypto-p1\venv\lib\site-packages\ccxt\base\exchange.py", line 780, in amount_to_precision
return self.truncate(amount, self.markets[symbol]['precision']['amount'])
File "D:\Development\crypto-p1\venv\lib\site-packages\ccxt\base\exchange.py", line 436, in truncate
return '{0:f}'.format(Decimal(num).quantize(math.pow(10, -precision)))
TypeError: conversion from float to Decimal is not supported
The issue is that the precision argument in Decimal.quantize(precision) should be of Decimal type rather than a float.
I’m not sure if this issue affects other exchanges, seeing that it is present in exchange.py.
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
ccxt Documentation - Read the Docs
ccxt library you may get a warning or an exception, saying No 'Access-Control-Allow-Origin' header is present on the requested resource.
Read more >Cryptopia Limited | Grant Thornton New Zealand
For information on the status of this liquidation, please refer to the information issued by the Liquidators.
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
I confirm that it works.
Thank you for the prompt fix.
Please note that commit 4aa1980 does not fix this issue. The cryptopia exchange uses the
truncate(num, precision=0)
method rather thantruncate_to_string(num, precision=0)
.