Corfucinas / crypto-candlesticks

Download candlestick data fast & easy for analysis
https://crypto-candlesticks.readthedocs.io
GNU General Public License v3.0
40 stars 10 forks source link

Extend code with limit check #461

Open paczko opened 1 year ago

paczko commented 1 year ago

Is your feature request related to a problem? Please describe. When executing the code sometime Bitfinex limitation (https://docs.bitfinex.com/docs/requirements-and-limitations) reached. A logic need to be added when it happens and sleep for a time (60s) defined by Bitfinex.

Describe the solution you'd like A logic like that would be nice to be added:

orig code:

    candle_data.extend(candlestick)
    write_to_console(
        ticker,
        interval,
        candlestick,
        live,
        setup_table(),
    )

..suggested code:

  if (len(candlestick) == 3):
      if  (candlestick[2] == 'ratelimit: error'):
          print('limit exceeded. sleep for 60s')
          sleep(60)
          continue
      break
  if len(candlestick) > 0:
    candle_data.extend(candlestick)
    write_to_console(
        ticker,
        interval,
        candlestick,
        live,
        setup_table(),
    )
  else:
    break

..the above suggested changes handles the situation if date is newer than latest data (even today added causes exception in code running)

create-issue-branch[bot] commented 1 year ago

Branch issue-461-Extend_code_with_limit_check created!