Giter Club home page Giter Club logo

crypto-candlesticks's Introduction

Welcome πŸ‘‹

Linkedin Badge Leetcode Badge Tryhackme Badge Lichess Badge Hack the box

Want to connect quickly?

npx mr-torres

Lines of code

🐱 My Github Data

πŸ† 924 Contributions in the Year 2022

πŸ“¦ 285.2 kB Used in Github's Storage

πŸ’Ό Opted to Hire

πŸ“œ 91 Public Repositories

πŸ”‘ 6 Private Repositories

I Mostly Code in Python

Python                   10 repos            β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘   21.74% 
JavaScript               9 repos             β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘   19.57% 
HTML                     8 repos             β–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘   17.39% 
Rust                     5 repos             β–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘   10.87% 
Java                     2 repos             β–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘   4.35%

Last Updated on 25/10/2022

crypto-candlesticks's People

Contributors

corfucinas avatar dependabot-preview[bot] avatar dependabot[bot] avatar imgbotapp avatar juandes avatar miohtama avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

crypto-candlesticks's Issues

Possibility of period overflow

Hi - this library is very interesting and perusing and running the code I noticed that there's a possibility of the download period calculation going out of bounds, which throws an error if it steps into the future (i.e., in general there is no guarantee that ((end_time - start_time) % step_size) == 0, except when step_size is set to one day and the interval is 1d ). Here's your code:

    while start_time <= end_time:
        period = start_time + step_size
        candlestick = exchange.get_candles(
            ticker=ticker,
            time_interval=interval,
            start_time=start_time,
            end_time=period,
        )
        candle_data.extend(candlestick)
        write_to_console(
            ticker,
            interval,
            candlestick,
            live,
            setup_table(),
        )
        live.refresh()
        start_time = period
        time.sleep(_RATE_LIMIT)

... whereas I suggest it should be (period has been renamed to period_end):

    while start_time < end_time:
        period_end = start_time + step_size
        if period_end > end_time:
            period_end = end_time
        candlestick = exchange.get_candles(
            ticker=ticker,
            time_interval=interval,
            start_time=start_time,
            end_time=period_end,
        )
        candle_data.extend(candlestick)
        write_to_console(
            ticker,
            interval,
            candlestick,
            live,
            setup_table(),
        )
        live.refresh()
        start_time = period_end
        time.sleep(_RATE_LIMIT)

(step_size should probably also be adjusted based on the interval, though I haven't shown that.)

Hope that makes sense.

Thanks,
Arvindra

crypto-candlesticks starts but when end fails

Show in screen all information but show this information

╢───────────┼───────────┼───────────┼───────────┼──────────────────┼───────────┼─────────────┼─────────────────────────╴
3479.6 β”‚ 3510 β”‚ 3515 β”‚ 3474.4 β”‚ 240.78283506 β”‚ ETHUSD β”‚ 1h β”‚ 2024-03-18 18:00:00
╢───────────┼───────────┼───────────┼───────────┼──────────────────┼───────────┼─────────────┼─────────────────────────╴
3476.9 β”‚ 3477.1 β”‚ 3506.5 β”‚ 3465.4 β”‚ 42.79398809 β”‚ ETHUSD β”‚ 1h β”‚ 2024-03-18 19:00:00
╢───────────┼───────────┼───────────┼───────────┼──────────────────┼───────────┼─────────────┼─────────────────────────╴
3505.4 β”‚ 3479.5 β”‚ 3508.1 β”‚ 3479.4 β”‚ 192.41570866 β”‚ ETHUSD β”‚ 1h β”‚ 2024-03-18 20:00:00
╢───────────┼───────────┼───────────┼───────────┼──────────────────┼───────────┼─────────────┼─────────────────────────╴
3525 β”‚ 3505.1 β”‚ 3543.4 β”‚ 3505.1 β”‚ 591.96635911 β”‚ ETHUSD β”‚ 1h β”‚ 2024-03-18 21:00:00
╢───────────┼───────────┼───────────┼───────────┼──────────────────┼───────────┼─────────────┼─────────────────────────╴
3521 β”‚ 3523.7 β”‚ 3527.2 β”‚ 3503.8 β”‚ 66.07186097 β”‚ ETHUSD β”‚ 1h β”‚ 2024-03-18 22:00:00
β•΅ β•΅ β•΅ β•΅ β•΅ β•΅ β•΅
Thank you for using crypto-candlesticks
Consider supporting your developers
ETH: 0x06Acb31587a96808158BdEd07e53668d8ce94cFE
Traceback (most recent call last):
File "pandas_libs\tslib.pyx", line 361, in pandas._libs.tslib.array_with_unit_to_datetime
ValueError: could not convert string to float: 't'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in run_code
File "C:\Users\Jaume\AppData\Local\Programs\Python\Python312\Scripts\crypto-candlesticks.exe_main
.py", line 7, in
File "C:\Users\Jaume\AppData\Local\Programs\Python\Python312\Lib\site-packages\crypto_candlesticks\main.py", line 82, in main
collect_arguments()
File "C:\Users\Jaume\AppData\Roaming\Python\Python312\site-packages\click\core.py", line 1157, in call
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Jaume\AppData\Roaming\Python\Python312\site-packages\click\core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "C:\Users\Jaume\AppData\Roaming\Python\Python312\site-packages\click\core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Jaume\AppData\Roaming\Python\Python312\site-packages\click\core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Jaume\AppData\Local\Programs\Python\Python312\Lib\site-packages\crypto_candlesticks\main.py", line 154, in collect_arguments
download_data(
File "C:\Users\Jaume\AppData\Local\Programs\Python\Python312\Lib\site-packages\crypto_candlesticks\get_data.py", line 164, in download_data
candle_stick_data = get_candles(
^^^^^^^^^^^^
File "C:\Users\Jaume\AppData\Local\Programs\Python\Python312\Lib\site-packages\crypto_candlesticks\get_data.py", line 87, in get_candles
write_to_console(
File "C:\Users\Jaume\AppData\Local\Programs\Python\Python312\Lib\site-packages\crypto_candlesticks\text_console.py", line 90, in write_to_console
timestamp = pd.to_datetime(single_candle[0], unit='ms')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Jaume\AppData\Roaming\Python\Python312\site-packages\pandas\core\tools\datetimes.py", line 1102, in to_datetime
result = convert_listlike(np.array([arg]), format)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Jaume\AppData\Roaming\Python\Python312\site-packages\pandas\core\tools\datetimes.py", line 393, in _convert_listlike_datetimes
return _to_datetime_with_unit(arg, unit, name, tz, errors)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Jaume\AppData\Roaming\Python\Python312\site-packages\pandas\core\tools\datetimes.py", line 557, in _to_datetime_with_unit
arr, tz_parsed = tslib.array_with_unit_to_datetime(arg, unit, errors=errors)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "pandas_libs\tslib.pyx", line 364, in pandas._libs.tslib.array_with_unit_to_datetime
ValueError: non convertible value t with the unit 'ms'

C:\Users\Jaume>

Extend code with limit check

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)

Question: Do you have a library version of crypto-candlesticks?

Hi,

Just wondering if you have an official library (non-interactive CLI) version of this application? I'd like to incorporate it in a Streamlit application. I have done some experiments a year ago and it is possible.

If I do this again (make it a library) using the latest version (so I can use it in Streamlit), and submit it back to you, would that be acceptable?

Thanks,
Arvindra

Dependabot can't evaluate your Python dependency files

Dependabot can't evaluate your Python dependency files.

As a result, Dependabot couldn't check whether any of your dependencies are out-of-date.

The error Dependabot encountered was:

InstallationError("Invalid requirement: 'οΏ½' (from line 90 of /home/dependabot/dependabot-updater/dependabot_tmp_dir/requirements.txt)")

View the update logs.

Error at the end of application

Traceback (most recent call last):
File "pandas_libs\tslib.pyx", line 298, in pandas._libs.tslib.array_with_unit_to_datetime
ValueError: could not convert string to float: 't'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.