backtrader2 / backtrader

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

No such file or directory: 'YHOO' #75

Closed kernytsky closed 2 years ago

kernytsky commented 2 years ago

I tried this in backtester as well and made a post there.

I've installed backtrader2 in a new conda environment as follows with python 3.8.11 and attempted to run the hello algorithm code and get the YHOO not found error. Is there something I should be doing differently? Thanks a lot! Am excited that this looks like a good and maintained library to get started with.

pip install git+https://github.com/backtrader2/backtrader
git clone https://github.com/backtrader2/backtrader.gitpython 
python backtrader/samples/sigsmacross/sigsmacross2.py

Traceback (most recent call last):
  File "samples/sigsmacross/sigsmacross.py", line 109, in <module>
    runstrat()
  File "samples/sigsmacross/sigsmacross.py", line 68, in runstrat
    cerebro.run()
  File "/Users/andrew/opt/anaconda3/envs/anaconcda_made_38/lib/python3.8/site-packages/backtrader/cerebro.py", line 1127, in run
    runstrat = self.runstrategies(iterstrat)
  File "/Users/andrew/opt/anaconda3/envs/anaconcda_made_38/lib/python3.8/site-packages/backtrader/cerebro.py", line 1210, in runstrategies
    data._start()
  File "/Users/andrew/opt/anaconda3/envs/anaconcda_made_38/lib/python3.8/site-packages/backtrader/feed.py", line 203, in _start
    self.start()
  File "/Users/andrew/opt/anaconda3/envs/anaconcda_made_38/lib/python3.8/site-packages/backtrader/feeds/yahoo.py", line 361, in start
    super(YahooFinanceData, self).start()
  File "/Users/andrew/opt/anaconda3/envs/anaconcda_made_38/lib/python3.8/site-packages/backtrader/feeds/yahoo.py", line 94, in start
    super(YahooFinanceCSVData, self).start()
  File "/Users/andrew/opt/anaconda3/envs/anaconcda_made_38/lib/python3.8/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: 'YHOO'

Also had to pip install requests as suggested by an earlier error but that didn't resolve it.

neilsmurphy commented 2 years ago

Are you still having difficulty?

kernytsky commented 2 years ago

Nope. Your help in the post at the backtrader board resolved it. For some reason using YHOO didn't work but other tickers worked fine.