Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught Swoole\Error: API must be called in the coroutine in #101

Open
mkmnstr123 opened this issue Jun 8, 2021 · 0 comments
Open

Uncaught Swoole\Error: API must be called in the coroutine in #101

mkmnstr123 opened this issue Jun 8, 2021 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@mkmnstr123
Copy link

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

@ISAAC-XXYYZZ ISAAC-XXYYZZ self-assigned this Aug 15, 2024
@ISAAC-XXYYZZ ISAAC-XXYYZZ added the enhancement New feature or request label Aug 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants