Backtrader Community

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    1. Home
    2. pan harry
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 1
    • Best 0
    • Controversial 0
    • Groups 0

    pan harry

    @pan harry

    0
    Reputation
    1
    Profile views
    1
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    pan harry Unfollow Follow

    Latest posts made by pan harry

    • How to correctly parse Time field in GenericCSVData?

      Here's my csv data looks like:

      2022/11/15,0905,1411,1418,1407,1417,33899,749118,0
      2022/11/15,0910,1417,1419,1415,1418,23688,753590,0
      2022/11/15,0915,1418,1419,1410,1410,20393,752823,0
      

      the 2nd field indicates the time , I try to use GenericCSVData to parse the date and time

          data = btfeeds.GenericCSVData(
              headers=False,
              dataname=file,
              fromdate=datetime.datetime(2000, 11, 15),
              todate=datetime.datetime(2022, 11, 16),
              nullvalue=0.0,
              dtformat=('%Y/%m/%d'),
              tmformat=('%H%M'),
              datetime=0,
              time=1,
              open=2,
              high=3,
              low=4,
              close=5,
              volume=6,
              openinterest=7
          )
      

      but when I try to use

      self.datas[0].datetime.time(0)
      

      to access time field in next() method, it always gives me 23:59:59.999989
      Is there anything I understand incorrectly?
      Any comments would be appreciated

      Thanks

      posted in General Code/Help
      pan harry
      pan harry