For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See:

Date Format Error

  • The problem looks strange to me. When I load a GenericCSVData, I got this error:

    I use the same data file as another datafeed, it gives me this, neither works:

    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)

    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.