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

[retCode] => 10002. invalid request, please check your server timestamp #25

Open
VaLLDaR opened this issue Mar 14, 2024 · 3 comments
Open

Comments

@VaLLDaR
Copy link

VaLLDaR commented Mar 14, 2024

Hi i kept getting this error. Synching my comp time didn't help or helped for short time.

To solve this problem i've modified \vendor\linwj\bybit\src\RequestV5.php

There you will find function called nonce()
It need to be changed to this:

 protected function nonce() {
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_URL, 'https://api.bybit.com/v5/market/time');
            $output = curl_exec($ch);
            curl_close($ch);
	    $data = json_decode($output, true);
            $this->nonce=$data['time'];
    }

Now i always have server time in my request, so this error never appeared ever again.

P.S. hope this will be fixed in further updates.

@zhouaini528
Copy link
Owner

zhouaini528 commented Mar 15, 2024

Hi i kept getting this error. Synching my comp time didn't help or helped for short time.

To solve this problem i've modified \vendor\linwj\bybit\src\RequestV5.php

There you will find function called nonce() It need to be changed to this:

 protected function nonce() {
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_URL, 'https://api.bybit.com/v5/market/time');
            $output = curl_exec($ch);
            curl_close($ch);
	    $data = json_decode($output, true);
            $this->nonce=$data['time'];
    }

Now i always have server time in my request, so this error never appeared ever again.

P.S. hope this will be fixed in further updates.

I didn't find the problem in my tests, is it caused by the inconsistency between your server time and the exchange's server time?

What are the details of the error?

@VaLLDaR
Copy link
Author

VaLLDaR commented Mar 16, 2024

Hi, thanks for you answer.
So if there are no other complainants, i guess this is my local problem. My computer somehow doen't synch time properly. I don't want to fix it, because it is easier to use server time :)
When i used binance php sdk, i've been experiencing the same problem there.
But for binance sdk there already exist function UseServerTime().

@VaLLDaR
Copy link
Author

VaLLDaR commented Mar 16, 2024

Full error response is next:

Array
(
    [retCode] => 10002
    [retMsg] => invalid request, please check your server timestamp or recv_window param. req_timestamp[1710434116927],server_timestamp[1710434114398],recv_window[5000]
    [result] => Array
        (
        )

    [retExtInfo] => Array
        (
        )

    [time] => 1710434114398
)

Appears on $bybit->order()->postCreate() and other which requiers timestamp

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