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

Set a dtformat well but it isn't applied at all!



  • Hi I set up a dtformat and tmformat well but it isn't reflected at all
    and the console threw an error like this below:

    /usr/lib/python3.6/_strptime.py in _strptime(data_string, format)
        360     if not found:
        361         raise ValueError("time data %r does not match format %r" %
    --> 362                          (data_string, format))
        363     if len(data_string) != found.end():
        364         raise ValueError("unconverted data remains: %s" %
    
    ValueError: time data '0' does not match format '%Y-%m-%d %H:%M:%S'
    
    data = bt.feeds.GenericCSVData(dataname='ticks2.csv',
        params = (
            
            ('nullvalue', float('NaN')),
            ('dtformat', '%Y/%m/%d'),# %H:%M:%S
            ('tmformat', '%H:%M:%S'),
            
            
            ('datetime', 0),
            ('time', 1),
            ('open', 2),
            ('high', 3),
            ('low', 4),
            ('close', 5),
            ('volume', 6),
            
        ))
    

    This is my csv

              Date	         Time	 o	 h	  l	   c	  v
    0	2020-07-09	15:10:00	8	8	7.5	7.94	41
    1	2020-07-09	15:00:00	7.61	8.24	7.61	8.24	10
    2	2020-07-09	14:50:00	8.3	8.3	7.7	7.7	7
    3	2020-07-09	14:40:00	8.72	8.72	8.3	8.3	7
    4	2020-07-09	14:30:00	8.72	8.72	8.39	8.39	8
    5	2020-07-09	14:20:00	8.35	8.6	8.3	8.6	6
    6	2020-07-09	14:10:00	8.18	8.46	8.18	8.45	22
    7	2020-07-09	14:00:00	8.5	8.5	8.5	8.5	1
    8	2020-07-09	13:50:00	9.2	9.2	8.64	8.64	4
    9	2020-07-09	13:40:00	9.13	9.13	8.95	9.1	16
    10	2020-07-09	13:30:00	9	9.06	8.97	8.97	9
    11	2020-07-09	13:20:00	9.12	9.16	9.04	9.04	4
    12	2020-07-09	13:10:00	9	9.1	9	9.1	2
    13	2020-07-09	12:50:00	8.38	8.5	8.38	8.5	7
    14	2020-07-09	12:40:00	7.93	8.39	7.9	8.39	8
    15	2020-07-09	12:30:00	8.25	8.27	8.18	8.19	9
    16	2020-07-09	12:20:00	8.35	8.35	8.21	8.24	7
    17	2020-07-09	12:10:00	8.07	8.16	8	8.14	8
    
    Date	Time	o	h	l	c	v
    

    0 2020-07-09 15:10:00 8 8 7.5 7.94 41
    1 2020-07-09 15:00:00 7.61 8.24 7.61 8.24 10
    2 2020-07-09 14:50:00 8.3 8.3 7.7 7.7 7
    3 2020-07-09 14:40:00 8.72 8.72 8.3 8.3 7
    4 2020-07-09 14:30:00 8.72 8.72 8.39 8.39 8
    5 2020-07-09 14:20:00 8.35 8.6 8.3 8.6 6
    6 2020-07-09 14:10:00 8.18 8.46 8.18 8.45 22
    7 2020-07-09 14:00:00 8.5 8.5 8.5 8.5 1
    8 2020-07-09 13:50:00 9.2 9.2 8.64 8.64 4
    9 2020-07-09 13:40:00 9.13 9.13 8.95 9.1 16
    10 2020-07-09 13:30:00 9 9.06 8.97 8.97 9
    11 2020-07-09 13:20:00 9.12 9.16 9.04 9.04 4
    12 2020-07-09 13:10:00 9 9.1 9 9.1 2
    13 2020-07-09 12:50:00 8.38 8.5 8.38 8.5 7
    14 2020-07-09 12:40:00 7.93 8.39 7.9 8.39 8
    15 2020-07-09 12:30:00 8.25 8.27 8.18 8.19 9
    16 2020-07-09 12:20:00 8.35 8.35 8.21 8.24 7
    17 2020-07-09 12:10:00 8.07 8.16 8 8.14 8
    18 2020-07-09 12:00:00 7.98 8.25 7.98 8 8
    19 2020-07-09 11:50:00 7.65 7.93 7.65 7.93 19
    20 2020-07-09 11:40:00 7.41 7.5 7.41 7.5 6
    21 2020-07-09 11:30:00 7.8 7.8 7.1 7.3 97
    22 2020-07-09 11:20:00 7.65 7.74 7.61 7.74 3
    23 2020-07-09 11:10:00 7.6 7.6 7.6 7.6 1
    24 2020-07-09 11:00:00 7.7 7.7 7.5 7.53 22
    25 2020-07-09 10:50:00 7.95 8.13 7.88 7.88 9
    26 2020-07-09 10:40:00 8.13 8.26 7.97 8.03 18
    27 2020-07-09 10:30:00 7.85 8.12 7.78 8.05 23
    28 2020-07-09 10:20:00 8.18 8.19 7.89 7.89 15
    29 2020-07-09 10:10:00 8.1 8.1 7.76 8.1 118
    30 2020-07-09 10:00:00 8.36 8.4 7.9 8.3 26
    31 2020-07-09 9:50:00 8.3 8.31 8.27 8.3 17
    32 2020-07-09 9:40:00 8.35 8.79 8.29 8.3 38
    33 2020-07-09 9:30:00 7.85 8.4 7.85 8.4 31
    34 2020-07-09 9:20:00 7.83 7.83 7.5 7.75 11
    35 2020-07-09 9:10:00 8.19 8.19 7.83 7.9 9
    36 2020-07-09 9:00:00 7.7 8.2 7.5 8.05 52
    37 2020-07-08 15:40:00 7.7 7.7 7.7 7.7 13
    38 2020-07-08 15:30:00 7.66 7.9 7.56 7.83 25
    39 2020-07-08 15:20:00 7.37 7.69 7.37 7.69 19
    40 2020-07-08 15:10:00 7.47 7.51 7.09 7.5 48
    41 2020-07-08 15:00:00 7.88 7.88 7.58 7.58 5
    42 2020-07-08 14:50:00 7.97 7.97 7.97 7.97 50
    43 2020-07-08 14:40:00 7.69 8.02 7.68 7.68 6
    44 2020-07-08 14:30:00 7.37 7.58 7.28 7.58 24
    45 2020-07-08 14:20:00 7.99 7.99 7.54 7.6 12
    46 2020-07-08 14:10:00 8 8 8 8 2
    47 2020-07-08 14:00:00 7.38 8.08 7.38 8.08 18
    48 2020-07-08 13:50:00 7.46 7.46 7.12 7.43 45
    49 2020-07-08 13:40:00 7.15 7.52 7.15 7.46 28
    50 2020-07-08 13:30:00 7.36 7.4 7.14 7.3 48
    51 2020-07-08 13:20:00 7.6 7.6 7.53 7.53 6
    52 2020-07-08 13:10:00 7.62 7.76 7.53 7.6 13
    53 2020-07-08 13:00:00 8.06 8.06 7.56 7.56 16
    54 2020-07-08 12:50:00 8.01 8.03 7.98 7.98 3
    55 2020-07-08 12:40:00 8.01 8.01 7.93 7.93 61
    56 2020-07-08 12:30:00 8.11 8.24 7.93 7.93 3
    57 2020-07-08 12:20:00 8.21 8.21 8.08 8.08 13
    58 2020-07-08 12:10:00 8.68 8.83 8.28 8.28 13
    59 2020-07-08 12:00:00 8.37 8.6 8.23 8.6 139
    60 2020-07-08 11:50:00 8.57 8.68 8.57 8.68 4


Log in to reply
 

});