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/

    5min data from yahoo

    General Code/Help
    2
    3
    53
    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.
    • A
      anders_lind last edited by

      Hi everyone!

      I'm currently trying to create a trading-strategy using 5-min data formatting as below in a CSV file downloaded from Yahoo:

      2022-05-17 09:00:00+02:00
      

      However when I feed the data the output when running the script is:

      2022-05-17 23:59:59.999989
      

      I'm aware that a similar question have been asked on other posts, but none of the solutions provided in the other posts have solved the issue.

      The code for my datafeed is as follows:

      data = bt.feeds.YahooFinanceCSVData(
          dataname='/Users/anderslindstrom/Python/quant_1.1/algo_trader/pullback_strategy/dax_5min.csv',
          timeframe=bt.TimeFrame.Minutes,
          dtformat='%Y-%m-%d %H:%M:%S',
          compression=1
          reverse=True)
      

      Would really appreciate any suggestions and help! :D

      B 1 Reply Last reply Reply Quote 0
      • B
        BorutF @anders_lind last edited by

        @anders_lind

        2022-05-17 23:59:59.999989

        This happens to every datetime??

        I always use bt.feeds.PandasData , it can work on yfinance downloads as well.

        A 1 Reply Last reply Reply Quote 1
        • A
          anders_lind @BorutF last edited by

          @borutf WOW! Using feeds.PandasData worked, thank you so much! :D

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post
          Copyright © 2016, 2017, 2018, 2019, 2020, 2021 NodeBB Forums | Contributors