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/

    Time missing from Cerebro runs

    General Code/Help
    2
    3
    32
    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.
    • C
      cantheman last edited by

      Hello,
      I got a csv file like this:
      Date,Open,High,Low,Close,Volume

      2019-01-01 22:00:00,1.14657,1.14972,1.1325,1.13442,203974
      2019-01-02 22:00:00,1.13436,1.14114,1.13084,1.13948,249340
      2019-01-03 22:00:00,1.13932,1.14193,1.13454,1.13944,206911
      

      and settings like:

      data = btfeeds.GenericCSVData(
              dataname='data/eurusd.csv',
              nullvalue=0.0,
              dtformat=('%Y-%m-%d %H:%M:%S'),
              timeframe=bt.TimeFrame.Minutes,
              datetime=0,
              time=-1,
              high=2,
              low=3,
              open=1,
              close=4,
              volume=5,
              openinterest=-1)
      

      But time never gets shown when I run Cerebro:

      Starting Portfolio Value: 1000.00
      2019-01-01, Close, 1.13442
      2019-01-02, Close, 1.13948
      2019-01-03, Close, 1.13944
      

      Where is my misstake?
      Thanks

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

        My guess would be that in your script you are printing only date, but not time, therefore you don't have it printed. cerebro prints nothing by itself.

        Also your data feed seems daily.

        • If my answer helped, hit reputation up arrow at lower right corner of the post.
        • Python Debugging With Pdb
        • New to python and bt - check this out
        C 1 Reply Last reply Reply Quote 0
        • C
          cantheman @ab_trader last edited by

          @ab_trader You were right , I needed to access it like:

          self.datas[0].datetime.time(0)
          
          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post
          Copyright © 2016, 2017, 2018, 2019, 2020, 2021 NodeBB Forums | Contributors