[英]Arbitrage Trading of ETH/BTC using ccxt crypto API throws error while creating buy order
I am working on an app that does ETH/BTC arbitrage trading of crypto-currency using ccxt crypto API for PHP, and i keep receiving this Network Error exception thrown from the API call usually while trying to place a limit buy order.我正在开发一个应用程序,该应用程序使用 ccxt 加密 API 为 PHP 进行加密货币的ETH/BTC套利交易,并且我通常在尝试下限价买单时不断收到从 API 调用抛出的网络错误异常。
{"status":-124,"error_message":"Enter the size in units of 0.0000001 ETH.","data":null}
This above exception is thrown from Bitflyer exchange.上述异常是从 Bitflyer 交易所抛出的。
My code is as follows:我的代码如下:
$name = '\\ccxt\\'.$exchangeId;
$exchange = new $name(array (
'apiKey' => $api_key, // ←------------ replace with your keys
'secret' => $secret_key,
'enableRateLimit' => true,
));
try{
$symbol = 'ETH/BTC';
$type = 'limit'; // # or 'market', or 'Stop' or 'StopLimit'
$side = 'buy'; // 'sell' or 'buy'
$amount = $data['trade_base_amount']; //0.0515996
$price = $data['exchange_rate']; // 0.01938
// extra params and overrides
$params = array();
$response = $exchange->create_order($symbol, $type, $side, $amount, $price, $params);
print_r($response);
}catch (\ccxt\NetworkError $e) {
echo $exchange->id . ' fetch_trades failed due to a network error: '.$e->getMessage () . "\n";
}catch (\ccxt\ExchangeError $e) {
echo $exchange->id . ' fetch_trades failed due to exchange error: ' .$e->getMessage () . "\n";
}catch (\Exception $e) {
echo $exchange->id . ' fetch_trades failed with: ' . $e->getMessage () . "\n";
}
Can anyone please explain why am I getting this error?任何人都可以解释为什么我会收到此错误吗?
Thanks in advance.提前致谢。
Try using amountToPrecision for me worked get the documentation on CCXT尝试为我使用 amountToPrecision 获取关于 CCXT 的文档
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.