-
Notifications
You must be signed in to change notification settings - Fork 40
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Hello,
So I've been trying to execute the order function, but I am getting this error:
PHP Fatal error: Uncaught Swoole\Error: API must be called in the coroutine in .../vendor/react/event-loop/src/StreamSelectLoop.php:290
It is weird because I can query the websocket and everything, but not when trying to run this code:
go(function () use ($priceUSDT, $amountUSDTAfterFee) {
$auth = new Auth('**********', '****', "********", Auth::API_KEY_VERSION_V2);
$api = new Order($auth, new SwooleHttp);
go(function () use ($api, $priceUSDT, $amountUSDTAfterFee) {
try {
$result = $api->create([
'clientOid' => uniqid(),
'price' => $priceUSDT,
'size' => $amountUSDTAfterFee,
'symbol' => "{$this->workOnCurrency}-USDT",
'type' => 'market',
'side' => 'buy',
]);
var_dump($result);
} catch (\Throwable $e) {
var_dump($e->getMessage());
}
});
});
I did installed the following, as mentioned in the docs:
composer require "kucoin/kucoin-php-sdk:~1.1.0"
pecl install swoole
composer require swlib/saber
Can you guys help pls
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request