gateio / gateapi-python

250 stars 92 forks source link

Scientific notation price #51

Closed Kalindro closed 3 years ago

Kalindro commented 3 years ago

Hello, I have encountered a weird thing. Why can't I pass price as scientific notation? It's not a case for all other exchanges, I get an "Invalid requests parameter 'price' value: 6.521e-05" (here is an example for HSC/USDT) error, how is it possible that endpoint doesn't accept scientific notation? Making it a string doesn't help. How can I solve that?

revilwang commented 3 years ago

The server does not parse any scientific notations. One way you can do is using decimal.Decimal to wrap your price or amount. Then use format(your_decimal_object, 'f') to format it into a string without scientific notation

Kalindro commented 3 years ago

Thanks, I will try that!