dominiktraxl / pykrakenapi

A python implementation of the Kraken API.
GNU Lesser General Public License v3.0
224 stars 53 forks source link

query_orders_info throws exception ("cannot convert float NaN to integer") #35

Closed TheOnePerson closed 4 years ago

TheOnePerson commented 4 years ago

I have the problem that calling query_orders_info() with the txid of an transaction that has not been closed yet results in an ValueError: cannot convert float NaN to integer. This is caused by the code in pykrakenapi/pykrakenapi.py beginning in line 1203:

            for col in ['closetm', 'expiretm', 'opentm', 'starttm']:
                if col in orders:
                    orders.loc[:, col] = orders[col].astype(int)

The astype(int)-method obviously does not expect NaN values which are returned from the request. My suggested quick fix would be to treat these columns as float, not int. (Which, in my case is fine, because my code does not depend on these columns being integer values.)

dominiktraxl commented 4 years ago

I don't see a problem with your solution, and have therefore implemented it (v0.1.9).