Date Format Error



  • The problem looks strange to me. When I load a GenericCSVData, I got this error:
    0_1492051320133_upload-8f621b76-d419-483b-aad8-eb3053887fe3

    I use the same data file as another datafeed, it gives me this, neither works:
    0_1492051412184_upload-fb81cdc4-09ce-4f16-b7e8-c93edfcb44fc

    As you can see, the two data file, one is AG.CSV, and one is AG_1.CSV, they are exactly the same, but the parsed date format in the first case is separated by '/', and the second is separated by '-'. However, neither of them works properly.

    The code looks the following:

    data_AG = bt.feeds.GenericCSVData(dataname='AG_1.csv', dtformat='%y-%m-%d', datetime=0, open=1, high=2, low=3, close=4, volume=7, openinterest=8)
    
    cerebro.adddata(data_AG)
    

    How to deal with this problem please?


  • administrators

    %m is for months with 2-digits. See: [Python Docs - Basic date and time types](file:///D:/dro/99-misc/docs/devel/python-2.7.10-docs-html/library/datetime.html#module-datetime). Section: 8.1.7. strftime() and strptime() Behavior


Log in to reply
 

Looks like your connection to Backtrader Community was lost, please wait while we try to reconnect.