Navigation

    Backtrader Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    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?

    General Code/Help
    2
    2
    226
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Barney Stinson
      Barney Stinson last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • A
        ab_trader last edited by

        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

        1 Reply Last reply Reply Quote 1
        • 1 / 1
        • First post
          Last post
        Copyright © 2016, 2017, 2018 NodeBB Forums | Contributors
        $(document).ready(function () { app.coldLoad(); }); }