API Bitfinex question: "key amount should be a decimal string"?

1

I started writing code for the Bitfinex api yesterday and I've been struggling quite a lot with this. I am using jndok's python implementation.

I added my pyblic and secret keys and wrote this line of code at the end with python 2.7 on Windows 8:

rep = place_order(0.001, 589.0, 'sell', 'limit', exchange='bitfinex')

And I thought that would do it but the reply I get 'Key amount should be a decimal string' and the order is not placed. I also tried to print the reply code I get from the server and it is 400.

How can this be resolved?

Erik Sillén

Posted 2014-06-28T12:50:31.450

Reputation: 19

Answers

3

You are submitting a float value. Float values are not totaly accurate:

>>> 0.9 
0.90000000000000002

Thats why the specification requires a Decimal datatype:

>>> from decimal import Decimal
>>> Decimal("0.001") 

Dennis Kriechel

Posted 2014-06-28T12:50:31.450

Reputation: 1 603