Closed Bingonemo123 closed 2 years ago
Hi @Bingonemo123,
great issue report. I am writing a new version and should deal with this. The only problem is that it is going to take some time (months).
Let me know if it is a urgent issue or related to a bigger project and could temporary patch it.
Thanks ! :-) Savino
I got another error while trying the example.
Exception in thread Thread-1: Traceback (most recent call last): File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner self.run() File "/usr/lib/python3.6/threading.py", line 864, in run self._target(*self._args, **self._kwargs) File "/home/Ledjob/.local/lib/python3.6/site-packages/multitasking/__init__.py", line 102, in _run_via_pool return callee(*args, **kwargs) File "/home/Ledjob/.local/lib/python3.6/site-packages/yfinance/multi.py", line 167, in _download_one_threaded actions, period, interval, prepost, proxy, rounding) File "/home/Ledjob/.local/lib/python3.6/site-packages/yfinance/multi.py", line 182, in _download_one rounding=rounding, many=True) File "/home/Ledjob/.local/lib/python3.6/site-packages/yfinance/base.py", line 155, in history data = data.json() File "/home/Ledjob/.local/lib/python3.6/site-packages/requests/models.py", line 898, in json return complexjson.loads(self.text, **kwargs) File "/home/Ledjob/.local/lib/python3.6/site-packages/simplejson/__init__.py", line 525, in loads return _default_decoder.decode(s) File "/home/Ledjob/.local/lib/python3.6/site-packages/simplejson/decoder.py", line 370, in decode obj, end = self.raw_decode(s) File "/home/Ledjob/.local/lib/python3.6/site-packages/simplejson/decoder.py", line 400, in raw_decode return self.scan_once(s, idx=_w(s, idx).end()) simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
^CTraceback (most recent call last): File "<string>", line 1, in <module> File "/home/Ledjob/.local/lib/python3.6/site-packages/yfinance/multi.py", line 95, in download _time.sleep(0.01) KeyboardInterrupt
Hello @Bingonemo123
I am trying to solve the issue, could kindly provide also rates
(where it actually comes from) so that I understand better the error: I don't seem to be able to replicate it.
Thanks
@piccolomo rates comes from ohlc structured list soprices
must be list of float numbers. I don't have exact code, I changed it and it is, somewhere in git archives. If you still need exact code I will reconstruct it.
Hi @Bingonemo123, thanks for answer, the thing is that rates
seem to contain also datetime information: it would be helpful to understand what kind of structure it has.
@piccolomo It was [ timestamp, open, high, low , close, tick_volume spread real_volume] as is mentioned https://www.mql5.com/en/docs/integration/python_metatrader5/mt5copyratesfrom_py. I think, it is original source.
Understood, I will try to simulate some data later. I tried the code btw but I was not successful in installing MetaTrader5
on Linux
MetaTrader
is not available on Linux, it is available on windows but it needs standalone working Software. But I think. it is returning python object, so you can simulate just that.
Ok, I will give it a try later, but if you feel like droping a complete code, would be helpful
Hi @Bingonemo123,
I think I solved the issue in the new version 4.3 available only on GitHub for now, using:
pip install git+https://github.com/piccolomo/plotext
Here is some working code:
import yfinance as yf
import plotext as plt
plt.datetime.input_date_form(form = 'd/m/Y')
plt.datetime.output_date_form(form = 'd/m')
start = plt.datetime.string_to_datetime("11/07/2020")
end = plt.datetime.today_datetime()
data = yf.download('goog', start, end)
prices = list(data["Close"])
dates = [plt.datetime.datetime_to_string(el, form='d/m/Y') for el in data.index]
plt.plot_date(dates, prices)
plt.title("Google Stock Price")
plt.xlabel("Date")
plt.ylabel("Stock Price $")
plt.show()
plt.clf()
The new code comes from next version on which I am still working on, which I have quickly adapted to previous version, and so there may be some mistakes. Any feedback or double test is appreciated. Hopefully I didn't destroy other functionalities.
To clarify: input_date_form()
sets the datetime
form of any function which takes strings, while outout_date_form()
sets the datetime
form of any function which outputs strings. If necessary the form of functions like datetime_to_string()
could be set manually. Also I removed the % symbols in the datetime
forms for simplicity.
Thanks for the great report, Savino
P.S. I close for now, but feel free to reopen, or let me know if you can't.
Error
if date_format is not
'%d/%m/%Y'
getting Error