enzoampil / fastquant

fastquant — Backtest and optimize your ML trading strategies with only 3 lines of code!
MIT License
1.52k stars 239 forks source link

get_stock_data() error #394

Closed twoATOMS closed 2 years ago

twoATOMS commented 2 years ago

Hi guys, I have a problem when I run the following

from fastquant import get_stock_data
get_stock_data('AAPL', '2020-01-01', '2020-12-30')

I get the following

Exception in thread Thread-4:
Traceback (most recent call last):
  File "/home/alex/anaconda3/lib/python3.7/threading.py", line 926, in _bootstrap_inner
    self.run()
  File "/home/alex/anaconda3/lib/python3.7/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/home/alex/anaconda3/lib/python3.7/site-packages/multitasking/__init__.py", line 102, in _run_via_pool
    return callee(*args, **kwargs)
  File "/home/alex/anaconda3/lib/python3.7/site-packages/yfinance/multi.py", line 167, in _download_one_threaded
    actions, period, interval, prepost, proxy, rounding)
  File "/home/alex/anaconda3/lib/python3.7/site-packages/yfinance/multi.py", line 182, in _download_one
    rounding=rounding, many=True)
  File "/home/alex/anaconda3/lib/python3.7/site-packages/yfinance/base.py", line 155, in history
    data = data.json()
  File "/home/alex/anaconda3/lib/python3.7/site-packages/requests/models.py", line 910, in json
    return complexjson.loads(self.text, **kwargs)
  File "/home/alex/anaconda3/lib/python3.7/json/__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "/home/alex/anaconda3/lib/python3.7/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/home/alex/anaconda3/lib/python3.7/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
twoATOMS commented 2 years ago

Solved it. Sorry for the post.