ccxt / ccxt

A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading API with support for more than 100 bitcoin/altcoin exchanges
https://docs.ccxt.com
MIT License
32.93k stars 7.52k forks source link

invalid request,please check your server timestamp or recv_window param #14104

Open mohder79 opened 2 years ago

mohder79 commented 2 years ago

hi .How to fix this error

import ccxt
import api_confing_my_bybit as ac
print(ccxt.__version__
      )
exchange = ccxt.bybit({
    'options': {
        'adjustForTimeDifference': True,
    },
    'apiKey': ac.API_KEY,
    'secret': ac.SECRET_KEY,
    'password': ac.PASSWORD,
})

print(exchange)

symbol = 'ADA/USDT:USDT'  # my symbol

# fetch ohlcv
bars = exchange.fetch_ohlcv(symbol, timeframe='15m', limit=80)

1.89.19
Bybit
Traceback (most recent call last):
  File "c:\Users\mohder\Documents\python\2ma.py", line 19, in <module>
    bars = exchange.fetch_ohlcv(symbol, timeframe='15m', limit=80)
  File "C:\Users\mohder\AppData\Local\Programs\Python\Python310\lib\site-packages\ccxt\bybit.py", line 1460, in fetch_ohlcv
    self.load_markets()
  File "C:\Users\mohder\AppData\Local\Programs\Python\Python310\lib\site-packages\ccxt\base\exchange.py", line 1444, in load_markets
    currencies = self.fetch_currencies()
  File "C:\Users\mohder\AppData\Local\Programs\Python\Python310\lib\site-packages\ccxt\bybit.py", line 549, in fetch_currencies
    response = self.privateGetAssetV1PrivateCoinInfoQuery(params)
  File "C:\Users\mohder\AppData\Local\Programs\Python\Python310\lib\site-packages\ccxt\base\exchange.py", line 497, in inner
    return entry(_self, **inner_kwargs)
  File "C:\Users\mohder\AppData\Local\Programs\Python\Python310\lib\site-packages\ccxt\base\exchange.py", line 2617, in request
    return self.fetch2(path, api, method, params, headers, body, config, context)
  File "C:\Users\mohder\AppData\Local\Programs\Python\Python310\lib\site-packages\ccxt\base\exchange.py", line 2614, in fetch2
    return self.fetch(request['url'], request['method'], request['headers'], request['body'])
  File "C:\Users\mohder\AppData\Local\Programs\Python\Python310\lib\site-packages\ccxt\base\exchange.py", line 659, in fetch
    self.handle_errors(http_status_code, http_status_text, url, method, headers, http_response, json_response, request_headers, request_body)
  File "C:\Users\mohder\AppData\Local\Programs\Python\Python310\lib\site-packages\ccxt\bybit.py", line 4667, in handle_errors
    self.throw_exactly_matched_exception(self.exceptions['exact'], errorCode, feedback)
  File "C:\Users\mohder\AppData\Local\Programs\Python\Python310\lib\site-packages\ccxt\base\exchange.py", line 2835, in throw_exactly_matched_exception
    raise exact[string](message)
ccxt.base.errors.InvalidNonce: bybit {"ret_code":10002,"ret_msg":"invalid request,please check your server timestamp or recv_window param","ext_code":"","result":null,"ext_info":null,"time_now":1656515198205}```
carlosmiei commented 2 years ago

Hi @mohder79 , does this error happen often?

mohder79 commented 2 years ago

yes

carlosmiei commented 2 years ago

@mohder79 Can you please post a full verbose output where we can see the request/response clearly?