For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
how to save datafeed into csv file?
-
hello,
how can i save the backtrader.feeds.yahoo.YahooFinanceData's data into csv file?
i loaded the data like below code, but cannot find any method or variable to save its back data into csv .data = bt.feeds.YahooFinanceData( dataname='AAPL', fromdate=datetime.datetime(2020, 1, 1), todate=datetime.datetime(2020, 12, 31), reverse=False)
is there some code like below?
data.to_csv(FILE_NAME)
thanks.
-
You can use
writer
. Or extract this data fromcerebro()
after the run. Or write strategy which will gather all prices duringnext()
calls and then save.csv
in thestop()
Docs - Logging - Writer
Docs - Cerebro - Returning the results