Skip to content

안녕하세요, 7.6.3 백테스트 코드에 대한 질문이 있습니다. #91

@whqtker

Description

@whqtker

ch07_08_Backtrader_RSI.py, ch07_09_Backtrader_RSI_SMA.py 을 실행하기 위해 책 p.361의 오류 해결 방법을 통해 yahoo.py 파일을 수정해주었습니다. 그러나 같은 오류가 발생했습니다. 좀 더 구글링을 해 보니, 이 오류가 최신 버전의 backtrader 패키지에는 고처졌다고 해서 최신 backtrader 패키지를 재설치하였습니다. 그러나 같은 오류가 여전히 발생합니다. 수정된 yahoo.py 일부와 오류 메세지 아래에 남기겠습니다. 문제 원인이 뭘까요?

--yahoo.py---
ctype = resp.headers['Content-Type']
# Cover as many text types as possible for Yahoo changes
if not ctype.startswith('text/'):
self.error = 'Wrong content type: %s' % ctype
continue # HTML returned? wrong url?

--오류 메세지--
Traceback (most recent call last):
File "C:\Users\성혁\source\repos\StockAnalysisInPython-master\07_Django_and_Automation\ch07_08_Backtrader_RSI.py", line 23, in
cerebro.run() # ⑧
File "C:\Users\성혁\AppData\Local\Programs\Python\Python38\lib\site-packages\backtrader\cerebro.py", line 1127, in run
runstrat = self.runstrategies(iterstrat)
File "C:\Users\성혁\AppData\Local\Programs\Python\Python38\lib\site-packages\backtrader\cerebro.py", line 1210, in runstrategies
data._start()
File "C:\Users\성혁\AppData\Local\Programs\Python\Python38\lib\site-packages\backtrader\feed.py", line 203, in _start
self.start()
File "C:\Users\성혁\AppData\Local\Programs\Python\Python38\lib\site-packages\backtrader\feeds\yahoo.py", line 355, in start
super(YahooFinanceData, self).start()
File "C:\Users\성혁\AppData\Local\Programs\Python\Python38\lib\site-packages\backtrader\feeds\yahoo.py", line 94, in start
super(YahooFinanceCSVData, self).start()
File "C:\Users\성혁\AppData\Local\Programs\Python\Python38\lib\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: '036570.KS'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions