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

429 error #23

Open
DmitriiRabeckii opened this issue Jan 9, 2024 · 1 comment
Open

429 error #23

DmitriiRabeckii opened this issue Jan 9, 2024 · 1 comment

Comments

@DmitriiRabeckii
Copy link

DmitriiRabeckii commented Jan 9, 2024

<?php
/**
 * @author lin <465382251@qq.com>
 * */
use \Lin\Bybit\BybitSpot;

require __DIR__ .'../../../vendor/autoload.php';

include __DIR__ .'../../../vendor/key_secret.php';

$bybit=new BybitSpot($key,$secret);

//You can set special needs
$bybit->setOptions([
    //Set the request timeout to 60 seconds by default
    'timeout'=>10,
]);

try {
    $result=$bybit->privates()->getAccount();
    print_r($result);
}catch (\Exception $e){
    print_r($e->getMessage());
}

I get error {"_message":"Client error: GET https:\/\/api.bybit.com\/spot\/v1\/account? resulted in a 429 Too Many Requests response","_httpcode":429}

@zhouaini528
Copy link
Owner

<?php
/**
 * @author lin <465382251@qq.com>
 * */
use \Lin\Bybit\BybitSpot;

require __DIR__ .'../../../vendor/autoload.php';

include __DIR__ .'../../../vendor/key_secret.php';

$bybit=new BybitSpot($key,$secret);

//You can set special needs
$bybit->setOptions([
    //Set the request timeout to 60 seconds by default
    'timeout'=>10,
]);

try {
    $result=$bybit->privates()->getAccount();
    print_r($result);
}catch (\Exception $e){
    print_r($e->getMessage());
}

I get error {"_message":"Client error: GET https:\/\/api.bybit.com\/spot\/v1\/account? resulted in a 429 Too Many Requests response","_httpcode":429}

Please use v5 https://github.com/zhouaini528/bybit-php/tree/master/src/Api/V5

$bybit=new BybitV5($key,$secret);

try {
    $result=$bybit->order()->postCreate([
        'category'=>'spot',
        'symbol'=>'BTCUSDT',
        'side'=>'buy',
        'orderType'=>'limit',
        'qty'=>'1',
        'price'=>'1000',

        //'orderLinkId'=>'xxxxxxxxxxx',
    ]);
    print_r($result);
}catch (\Exception $e){
    print_r($e->getMessage());
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants