question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Network Errors. Unable to download even one complete set of historical candles.

See original GitHub issue

No matter how low I set the limit, the connection always drops out. Usually it is able to get about 1 year of data before the errors below occur. Since this is public data, I am not using a key. Does that effect how much data can be downloaded? Thanks for looking.

  • OS: Mac
  • Programming Language version: Python 3.8
  • CCXT version:most recent
def scrape_ohlcv(symbol):

    exchange = ccxt.binance({
    'rateLimit': 200,
    'enableRateLimit': True,
    #'verbose': True,
    })

    start_timestamp = exchange.fetch_ohlcv(symbol, '1m', since=0, limit=1)[0][0]

    now = exchange.milliseconds()

    data = []

    while start_timestamp < end_time:

        try:


            print(exchange.iso8601(exchange.milliseconds()))
            print(f'Fetching {symbol} minutes from:')
            print(exchange.iso8601(start_timestamp))
            ohlcvs = exchange.fetch_ohlcv(symbol, '1m', since=start_timestamp, limit=200 )
            print('Fetched', len(ohlcvs), 'minutes')
            print()
            start_timestamp = ohlcvs[-1][0]
            data += ohlcvs
            time.sleep(1)

        except (ccxt.ExchangeError, ccxt.AuthenticationError, ccxt.ExchangeNotAvailable, ccxt.RequestTimeout) as error:

            print('Got an error', type(error).__name__, error.args, ', retrying in', hold, 'seconds...')
            time.sleep(hold)

    return data```

Traceback (most recent call last)

ConnectionResetError: [Errno 104] Connection reset by peer

urllib3.exceptions.ProtocolError: (‘Connection aborted.’, ConnectionResetError(104, ‘Connection reset by peer’))

requests.exceptions.ConnectionError: (‘Connection aborted.’, ConnectionResetError(104, ‘Connection reset by peer’))

ccxt.base.errors.NetworkError: binance GET https://api.binance.com/api/v3/klines?symbol=BTCUSDT&interval=1m&startTime=1540008480000&limit=200

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:21 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
mrwonderfulnesscommented, Mar 14, 2021

thanks again.

1reaction
mrwonderfulnesscommented, Mar 14, 2021

Thanks for your help, I’ll try to get it to work. Cheers.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can i sort Binance historical candles for multiple pairs ...
Method tries to load data by weekly chunks (parameter step) and supports resending requests on failures after timeout. It may helps when you ......
Read more >
MT4 fail to download history data / There are no new data for a ...
3 solutions to fix the problem of MT4 fail to download history data / There are no new data for a symbol Metatrader.Join...
Read more >
Download failed? - Support Board - Sierra Chart
When the charts are loading, a red box appears saying "download failed / error downloading historical intraday data for GCG23_FUT_COMEX.
Read more >
Having trouble connecting to your NOOK? - Barnes & Noble
Be sure to download the software update for your device if you are experiencing issues, even with the correct Software Version number. Go...
Read more >
Change Log – Binance API Documentation - GitHub Pages
The following liquidation orders streams do not push realtime order data anymore. Instead, they push snapshot order data at a maximum frequency of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found