corfucinas / crypto-candlesticks Goto Github PK
View Code? Open in Web Editor NEWDownload candlestick data fast & easy for analysis
Home Page: https://crypto-candlesticks.readthedocs.io
License: GNU General Public License v3.0
Download candlestick data fast & easy for analysis
Home Page: https://crypto-candlesticks.readthedocs.io
License: GNU General Public License v3.0
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'
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)
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
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
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)")
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>
crypto-candlesticks/src/crypto_candlesticks/database.py
Lines 99 to 100 in 0b5e381
Hi - Just wondering why Open and Close values are assigned as indexes 2 and 1 respectively, and not 1 and 2?
The Bitfinex API docs shows that it should be 1, 2.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.