For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See:

how to save datafeed into csv file?

  • hello,
    how can i save the'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(
        fromdate=datetime.datetime(2020, 1, 1),
        todate=datetime.datetime(2020, 12, 31),

    is there some code like below?



  • You can use writer. Or extract this data from cerebro() after the run. Or write strategy which will gather all prices during next() calls and then save .csv in the stop()

    Docs - Logging - Writer
    Docs - Cerebro - Returning the results

Log in to reply