backtrader2 / backtrader

Python Backtesting library for trading strategies
https://www.backtrader.com
GNU General Public License v3.0
238 stars 54 forks source link

FileNotFoundError: [Errno 2] No such file or directory: "'^GDAXI'" #87

Open tengerye opened 2 years ago

tengerye commented 2 years ago

I used this example but unfortunately got errors. The full traceback is:

  File "/projects/quant_exp/stategies/weekdaysaligner.py", line 109, in <module>
    runstrat()
  File "/projects/quant_exp/stategies/weekdaysaligner.py", line 64, in runstrat
    cerebro.run(runonce=True, preload=True)
  File "/anaconda3/envs/cc/lib/python3.7/site-packages/backtrader/cerebro.py", line 1127, in run
    runstrat = self.runstrategies(iterstrat)
  File "/anaconda3/envs/cc/lib/python3.7/site-packages/backtrader/cerebro.py", line 1210, in runstrategies
    data._start()
  File "/anaconda3/envs/cc/lib/python3.7/site-packages/backtrader/feed.py", line 203, in _start
    self.start()
  File "/anaconda3/envs/cc/lib/python3.7/site-packages/backtrader/feeds/yahoo.py", line 361, in start
    super(YahooFinanceData, self).start()
  File "/anaconda3/envs/cc/lib/python3.7/site-packages/backtrader/feeds/yahoo.py", line 94, in start
    super(YahooFinanceCSVData, self).start()
  File "/anaconda3/envs/cc/lib/python3.7/site-packages/backtrader/feed.py", line 674, in start
    self.f = io.open(self.p.dataname, 'r')
FileNotFoundError: [Errno 2] No such file or directory: "'^GDAXI'"
martzz commented 1 year ago

Having the same issue. It seems the yahoo API has changed again. Backtrader cannot find "CrumbStore" in the reply (yahoo.py:278):

i = txt.find('CrumbStore')

martzz commented 1 year ago

Apparently, the crumb cookie is no longer needed by the yahoo API. So the first phase of obtaining the cookie can be discarded and the whole fetching simplified in yahoo.py.

BlueAndRose commented 1 year ago

Apparently, the crumb cookie is no longer needed by the yahoo API. So the first phase of obtaining the cookie can be discarded and the whole fetching simplified in yahoo.py.

Works for me just delete all the crumb related code in yahoo.py. Deleting code is always satisfying.