我试图遵循在PyAlgoTrade网站介绍下载数据从雅虎金融使用给定的代码。但我总有个错误。
以下是网站:http://gbeced.github.io/pyalgotrade/docs/v0.15/html/tutorial.html
..。尽管如此,我们需要测试我们的策略的第一件事是一些数据。让我们使用Oracle 2000年的股票价格,我们将使用以下命令下载该价格:
python -c "from pyalgotrade.tools import yahoofinance; yahoofinance.download_daily_bars('orcl', 2000, 'orcl-2000.csv')"运行此命令后,我得到如下错误
>>> python -c "from pyalgotrade.tools import yahoofinance; yahoofinance.download_daily_bars('orcl', 2000, 'orcl-2000.csv')"
SyntaxError: invalid syntax发布于 2014-03-31 15:05:57
>>> python -c "from pyalgotrade.tools import yahoofinance; yahoofinance.download_daily_bars('orcl', 2000, 'orcl-2000.csv')"
SyntaxError: invalid syntax您应该在shell控制台中输入,而不是从Python内部输入。在空壳处:
dsm@winter:~/coding$ python -c "from pyalgotrade.tools import yahoofinance; yahoofinance.download_daily_bars('orcl', 2000, 'orcl-2000.csv')"
dsm@winter:~/coding$ wc orcl-2000.csv
253 254 12694 orcl-2000.csvpython -c部件的意思是“启动Python,并将以下字符串提供给它执行”。
或者,您也可以在Python中这样做:
>>> from pyalgotrade.tools import yahoofinance
>>> yahoofinance.download_daily_bars('orcl', 2000, 'orcl-2000.csv')https://stackoverflow.com/questions/22764815
复制相似问题