mariodian / bitfinex-api-php

Bitfinex PHP API - Access all features of https://www.bitfinex.com trading platform
Creative Commons Zero v1.0 Universal
31 stars 33 forks source link

decimal string #2

Open mmmmkkkk311 opened 7 years ago

mmmmkkkk311 commented 7 years ago

It works with this format $buy = $bfx->new_order('BTCUSD', 0.01 , 1.0, 'bitfinex', 'buy', 'exchange market');

but it doesn't work with this $x = 0.01 ; $buy = $bfx->new_order('BTCUSD', $x , 1.0, 'bitfinex', 'buy', 'exchange market'); returning error Array ( [message] => Key amount should be a decimal string. [error] => 1 ) how can I fix it?

mariodian commented 7 years ago

You have to send the amount ($x) as a string:

$x = '0.01';
$buy = $bfx->new_order('BTCUSD', $x , 1.0, 'bitfinex', 'buy', 'exchange market');

P.S. sorry for the late reply I totally missed this issue.