andreskull / rFTX

R API for FTX
Other
5 stars 12 forks source link

ftx_place_order() fails when price has more than 4 decimal points #19

Closed andreskull closed 2 years ago

andreskull commented 2 years ago

ftx_place_order(key, secret, market="SHIB/USD", side="buy", price=0.00004, type="limit", size=100000) throws error message

2021-11-06 15:40:49 ERROR::Not logged in $success [1] FALSE

$failure_reason [1] "Not logged in"

$data NULL

ftx_place_order(key, secret, market="SHIB/USD", side="buy", price=0.0001, type="limit", size=100000) executes correctly

This is FTX REST API issue that only accepts prices at 4 dp where some coins require more. The error message returned by FTX ("Not logged in") is misleading as well.

PaulineNimo commented 2 years ago

What could be done is to alert the user that the order cannot be placed due to the 4dp restriction. With rounding up or down, I foresee an issue being raised here.

andreskull commented 2 years ago

I do not like the idea to change the code according to obvious errors in API. Those are major issues that users do not like. Let's wait for FTX answers about the reported issues.

PaulineNimo commented 2 years ago

Okay, will wait for your prompt.

andreskull commented 2 years ago

Fixed by https://github.com/andreskull/rFTX/pull/25/commits/dfbc8308a986706b4a7919cb8e676efdb18e036c