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/

    Issue with extending a data feed

    General Code/Help
    3
    3
    153
    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.
    • sirbradflies
      sirbradflies last edited by

      Hi,

      I want to extend PandasData feed to include other fields like PE, ROA, etc.. I am currently trying to add just the field 'adjclose', present in the input dataframe but the data is always 'nan'.

      To clarify here's the code that I'm using:

      class TestData(bt.feeds.PandasData):
          lines = ('adjclose',)
          params = (('adjclose', 6),)
      
      ...
      datafeed = TestData(dataname=df_prices, name=symbol, plot=False)
      cerebro.resampledata(datafeed, timeframe=bt.TimeFrame.Days)
      ...
      

      The dataframe df_prices looks like this:

                                 date        high  ...    adjclose  formatted_date
      date                                         ...                            
      2018-12-31 15:30:00  1546266600  159.360001  ...  155.405045      2018-12-31
      2019-01-02 15:30:00  1546439400  158.850006  ...  155.582367      2019-01-02
      2019-01-03 15:30:00  1546525800  145.720001  ...  140.085220      2019-01-03
      2019-01-04 15:30:00  1546612200  148.550003  ...  146.065353      2019-01-04
      2019-01-07 15:30:00  1546871400  148.830002  ...  145.740265      2019-01-07
      
      [5 rows x 8 columns]
      

      However when I check for the data the new added field 'adjclose' is always 'nan' unlike the standard fields like 'close', 'volume', etc...

      self.data.close[0] = 188.72000122070312
      self.data.volume[0] = 20780400.0
      self.data.adjclose[0] = nan
      

      I checked both the documentation and the forum on similar topics and it seems I'm following the recommended approach but for some reason I can't get this to work.
      Any obvious mistake that you can see?

      Thank you in advance

      1 Reply Last reply Reply Quote 0
      • J
        jesseliu0 last edited by

        I have the same issue. Looks like data extending does not work with cerebro.resampledata(). You can duplicate with the following code and data. @sirbradflies @backtrader

        import datetime
        import numpy as np
        import pandas as pd
        import backtrader as bt
        
        
        class PandasDataExt(bt.feeds.PandasData):
            lines = ('dtstamp',)
            params=(
                ('datetime', None),
                ('open', 'open'),
                ('high', 'high'),
                ('low', 'low'),
                ('close', 'close'),
                ('volume', 'volume'),
                ('openinterest', None),
                ('dtstamp', 'dtstamp'),
            )
        setattr(bt.metabase, PandasDataExt.__name__, PandasDataExt)
        
        class MyStrategy(bt.Strategy):
            def next(self):
                print(self.data.datetime.datetime(0), self.data0.dtstamp[0], self.data1.dtstamp[0])
        
        
        if __name__ == '__main__':
            cerebro = bt.Cerebro()
            cerebro.addstrategy(MyStrategy)
        
            df = pd.read_csv("~/Workspace/data.csv", index_col=0)
            df.index = pd.DatetimeIndex(df.index)
            df['dtstamp'] = df.index.astype(np.int64) // 10**9
            my_data = PandasDataExt(dataname=df, name='MyData', timeframe=bt.TimeFrame.Minutes)
            cerebro.adddata(my_data, name='MyData')
            resampled_data = PandasDataExt(dataname=df, name='ResampledData', timeframe=bt.TimeFrame.Minutes)
            cerebro.resampledata(resampled_data, name='ResampledData', timeframe=bt.TimeFrame.Minutes, compression=5)
            cerebro.run()
        
        datetime,open,high,low,close,volume
        2020-02-02 17:00:00,8982.75,9024.0,8975.0,9013.5,2480
        2020-02-02 17:01:00,9011.75,9024.75,9011.75,9017.75,875
        2020-02-02 17:02:00,9018.75,9032.75,9018.0,9031.0,802
        2020-02-02 17:03:00,9030.5,9032.0,9021.25,9029.0,493
        2020-02-02 17:04:00,9029.0,9032.25,9024.0,9024.0,454
        2020-02-02 17:05:00,9024.0,9024.25,9017.5,9021.75,419
        2020-02-02 17:06:00,9021.5,9027.5,9018.75,9027.25,360
        2020-02-02 17:07:00,9027.5,9032.5,9027.25,9028.0,316
        2020-02-02 17:08:00,9028.75,9029.0,9016.5,9017.0,467
        2020-02-02 17:09:00,9017.0,9017.75,9009.75,9012.0,431
        2020-02-02 17:10:00,9011.25,9012.5,9008.0,9008.0,198
        2020-02-02 17:11:00,9008.75,9008.75,8999.0,8999.5,617
        2020-02-02 17:12:00,8999.0,9017.0,8998.0,9012.5,764
        2020-02-02 17:13:00,9012.75,9018.25,9011.5,9018.0,296
        2020-02-02 17:14:00,9017.25,9023.25,9014.75,9022.75,369
        2020-02-02 17:15:00,9022.75,9024.5,9016.25,9021.5,352
        2020-02-02 17:16:00,9021.5,9028.0,9015.0,9023.5,388
        2020-02-02 17:17:00,9023.0,9025.75,9021.25,9023.75,121
        2020-02-02 17:18:00,9024.5,9026.25,9018.25,9020.25,196
        2020-02-02 17:19:00,9021.5,9021.5,9017.75,9020.75,105
        2020-02-02 17:20:00,9020.25,9023.5,9020.25,9023.0,167
        2020-02-02 17:21:00,9022.25,9028.0,9022.25,9024.75,246
        2020-02-02 17:22:00,9025.5,9031.0,9021.25,9022.5,381
        2020-02-02 17:23:00,9023.0,9023.25,9018.0,9018.5,180
        2020-02-02 17:24:00,9019.0,9029.75,9019.0,9028.0,296
        2020-02-02 17:25:00,9027.25,9031.25,9023.5,9024.5,444
        2020-02-02 17:26:00,9024.5,9028.5,9021.75,9028.5,198
        2020-02-02 17:27:00,9028.75,9031.25,9026.0,9030.25,358
        2020-02-02 17:28:00,9030.0,9030.25,9027.0,9027.25,190
        2020-02-02 17:29:00,9026.75,9030.25,9024.5,9025.5,276
        2020-02-02 17:30:00,9026.0,9028.5,9022.75,9027.5,245
        2020-02-02 17:31:00,9028.25,9031.25,9028.25,9030.75,160
        2020-02-02 17:32:00,9031.25,9038.25,9030.25,9030.5,682
        2020-02-02 17:33:00,9030.5,9031.25,9029.25,9029.5,132
        2020-02-02 17:34:00,9029.75,9030.25,9023.75,9025.25,312
        2020-02-02 17:35:00,9025.5,9029.25,9021.0,9026.0,262
        2020-02-02 17:36:00,9026.0,9027.5,9020.75,9021.5,177
        2020-02-02 17:37:00,9022.0,9026.75,9021.75,9025.75,165
        2020-02-02 17:38:00,9026.0,9029.25,9026.0,9029.0,181
        2020-02-02 17:39:00,9029.25,9031.5,9028.25,9030.5,123
        2020-02-02 17:40:00,9031.0,9034.75,9027.25,9028.5,291
        2020-02-02 17:41:00,9028.5,9031.5,9026.0,9027.0,182
        2020-02-02 17:42:00,9028.0,9030.5,9028.0,9029.5,95
        2020-02-02 17:43:00,9029.75,9030.25,9026.25,9027.75,113
        2020-02-02 17:44:00,9028.0,9031.75,9027.25,9030.0,137
        2020-02-02 17:45:00,9030.25,9031.75,9021.5,9025.5,297
        2020-02-02 17:46:00,9024.75,9024.75,9016.0,9022.25,535
        2020-02-02 17:47:00,9022.0,9026.0,9018.0,9019.75,318
        2020-02-02 17:48:00,9019.75,9023.5,9018.0,9020.0,246
        2020-02-02 17:49:00,9020.5,9021.0,9017.25,9018.75,165
        2020-02-02 17:50:00,9018.25,9019.25,9012.75,9014.5,334
        2020-02-02 17:51:00,9014.0,9018.0,9013.0,9013.25,200
        2020-02-02 17:52:00,9013.5,9016.5,9013.25,9015.25,145
        2020-02-02 17:53:00,9014.75,9015.0,9011.5,9011.75,131
        2020-02-02 17:54:00,9011.75,9014.25,9010.5,9013.0,183
        2020-02-02 17:55:00,9013.0,9016.25,9012.0,9015.0,247
        2020-02-02 17:56:00,9014.75,9018.75,9014.25,9017.75,248
        2020-02-02 17:57:00,9017.5,9020.25,9017.25,9019.25,161
        2020-02-02 17:58:00,9019.75,9020.75,9017.5,9018.75,97
        2020-02-02 17:59:00,9018.25,9020.75,9017.25,9020.75,127
        2020-02-02 18:00:00,9020.0,9020.0,9017.75,9018.0,148
        2020-02-02 18:01:00,9018.25,9019.0,9011.25,9016.25,323
        2020-02-02 18:02:00,9016.0,9020.25,9016.0,9018.75,177
        2020-02-02 18:03:00,9018.75,9024.25,9017.5,9017.5,357
        2020-02-02 18:04:00,9017.5,9021.75,9016.0,9020.25,212
        2020-02-02 18:05:00,9020.5,9025.0,9020.5,9023.25,228
        2020-02-02 18:06:00,9023.25,9024.25,9019.5,9023.0,233
        2020-02-02 18:07:00,9023.0,9023.0,9019.0,9020.0,206
        2020-02-02 18:08:00,9020.75,9023.25,9020.75,9022.5,139
        2020-02-02 18:09:00,9022.0,9023.75,9020.75,9023.25,100
        2020-02-02 18:10:00,9023.25,9027.75,9022.25,9024.0,441
        2020-02-02 18:11:00,9023.75,9032.25,9023.75,9031.25,440
        2020-02-02 18:12:00,9031.5,9035.0,9030.5,9030.75,613
        2020-02-02 18:13:00,9031.0,9034.0,9029.0,9031.0,261
        2020-02-02 18:14:00,9031.0,9031.75,9027.25,9028.0,244
        2020-02-02 18:15:00,9028.25,9028.5,9025.5,9025.75,156
        2020-02-02 18:16:00,9026.0,9026.0,9021.0,9024.0,317
        2020-02-02 18:17:00,9024.5,9026.25,9022.0,9022.5,147
        2020-02-02 18:18:00,9022.25,9024.0,9020.25,9023.0,244
        2020-02-02 18:19:00,9022.5,9025.0,9021.25,9025.0,157
        2020-02-02 18:20:00,9024.5,9026.0,9023.5,9025.75,139
        2020-02-02 18:21:00,9026.0,9028.0,9025.75,9027.75,123
        2020-02-02 18:22:00,9027.75,9029.25,9025.75,9026.5,161
        2020-02-02 18:23:00,9026.5,9028.0,9025.75,9026.75,77
        2020-02-02 18:24:00,9026.75,9029.25,9026.75,9028.25,91
        2020-02-02 18:25:00,9028.25,9031.0,9028.0,9028.5,172
        2020-02-02 18:26:00,9028.25,9028.5,9027.5,9027.5,48
        2020-02-02 18:27:00,9028.0,9029.0,9027.0,9029.0,80
        2020-02-02 18:28:00,9028.75,9029.5,9027.5,9028.25,47
        2020-02-02 18:29:00,9028.5,9029.75,9028.5,9028.5,77
        2020-02-02 18:30:00,9028.5,9029.0,9027.0,9027.75,62
        2020-02-02 18:31:00,9027.75,9031.25,9026.25,9030.5,140
        2020-02-02 18:32:00,9030.5,9032.75,9030.25,9032.5,129
        2020-02-02 18:33:00,9032.5,9032.75,9031.5,9032.75,76
        2020-02-02 18:34:00,9032.75,9034.0,9032.0,9033.75,130
        2020-02-02 18:35:00,9033.5,9040.0,9033.5,9040.0,495
        2020-02-02 18:36:00,9039.5,9044.25,9039.5,9040.75,581
        2020-02-02 18:37:00,9041.0,9048.5,9040.75,9047.5,507
        2020-02-02 18:38:00,9047.5,9055.25,9047.5,9053.25,908
        2020-02-02 18:39:00,9053.5,9053.5,9049.0,9050.0,362
        2020-02-02 18:40:00,9049.75,9051.25,9046.25,9048.0,278
        2020-02-02 18:41:00,9048.25,9048.25,9042.25,9044.25,341
        2020-02-02 18:42:00,9043.75,9046.5,9043.25,9044.75,108
        2020-02-02 18:43:00,9044.25,9047.75,9044.25,9045.5,161
        2020-02-02 18:44:00,9046.0,9053.75,9045.75,9051.75,394
        2020-02-02 18:45:00,9051.5,9058.0,9051.5,9057.25,481
        2020-02-02 18:46:00,9057.75,9065.5,9057.25,9063.75,596
        2020-02-02 18:47:00,9063.5,9063.5,9054.25,9057.25,371
        2020-02-02 18:48:00,9057.5,9058.0,9053.5,9055.25,264
        2020-02-02 18:49:00,9056.0,9056.0,9050.0,9050.25,216
        2020-02-02 18:50:00,9050.25,9051.75,9047.25,9049.75,375
        2020-02-02 18:51:00,9049.25,9050.5,9045.75,9049.25,256
        2020-02-02 18:52:00,9049.5,9051.5,9048.0,9049.0,177
        2020-02-02 18:53:00,9049.25,9049.75,9046.5,9047.0,262
        2020-02-02 18:54:00,9047.25,9049.75,9046.75,9048.75,157
        2020-02-02 18:55:00,9049.0,9051.5,9046.25,9050.75,358
        2020-02-02 18:56:00,9050.75,9053.5,9046.75,9046.75,219
        2020-02-02 18:57:00,9046.5,9049.25,9046.25,9048.0,188
        2020-02-02 18:58:00,9047.75,9048.0,9046.0,9048.0,79
        2020-02-02 18:59:00,9048.0,9049.0,9045.0,9045.0,146
        2020-02-02 19:00:00,9044.75,9045.75,9028.5,9040.5,940
        2020-02-02 19:01:00,9040.25,9043.0,9036.5,9039.25,662
        2020-02-02 19:02:00,9039.25,9044.25,9037.0,9043.75,301
        2020-02-02 19:03:00,9043.75,9044.0,9040.75,9040.75,266
        2020-02-02 19:04:00,9041.0,9041.25,9028.5,9033.75,729
        2020-02-02 19:05:00,9033.75,9037.0,9028.0,9036.75,765
        2020-02-02 19:06:00,9037.0,9037.5,9034.0,9036.75,312
        2020-02-02 19:07:00,9037.25,9047.75,9035.0,9043.5,612
        2020-02-02 19:08:00,9043.0,9051.5,9041.0,9045.75,560
        2020-02-02 19:09:00,9045.75,9053.75,9045.25,9049.0,437
        2020-02-02 19:10:00,9049.25,9056.0,9047.5,9053.25,444
        2020-02-02 19:11:00,9053.75,9058.25,9052.75,9054.0,386
        2020-02-02 19:12:00,9054.5,9057.75,9054.0,9055.0,319
        2020-02-02 19:13:00,9054.0,9054.0,9048.5,9050.5,399
        2020-02-02 19:14:00,9050.5,9053.0,9047.5,9048.25,337
        2020-02-02 19:15:00,9048.5,9051.75,9046.0,9050.5,356
        2020-02-02 19:16:00,9050.0,9050.25,9043.0,9045.0,399
        2020-02-02 19:17:00,9045.0,9045.0,9040.75,9042.5,294
        2020-02-02 19:18:00,9042.75,9050.0,9042.0,9047.75,310
        2020-02-02 19:19:00,9047.5,9047.5,9043.25,9044.75,173
        2020-02-02 19:20:00,9044.75,9049.25,9043.0,9049.25,146
        2020-02-02 19:21:00,9048.5,9050.0,9044.0,9046.25,244
        2020-02-02 19:22:00,9045.5,9047.25,9041.25,9041.5,200
        2020-02-02 19:23:00,9041.25,9041.25,9034.0,9037.0,367
        2020-02-02 19:24:00,9037.25,9038.25,9034.75,9037.75,305
        2020-02-02 19:25:00,9037.5,9045.5,9035.25,9043.75,295
        2020-02-02 19:26:00,9043.5,9044.25,9040.0,9041.75,149
        2020-02-02 19:27:00,9041.5,9043.0,9034.25,9036.75,315
        2020-02-02 19:28:00,9036.5,9040.0,9034.25,9035.25,245
        2020-02-02 19:29:00,9035.0,9045.0,9033.0,9043.75,384
        2020-02-02 19:30:00,9043.75,9048.5,9037.75,9043.5,466
        2020-02-02 19:31:00,9043.75,9056.25,9042.75,9055.75,462
        2020-02-02 19:32:00,9056.0,9058.75,9051.0,9056.5,542
        2020-02-02 19:33:00,9056.25,9069.75,9055.5,9068.25,969
        2020-02-02 19:34:00,9067.75,9068.75,9061.5,9063.0,650
        2020-02-02 19:35:00,9063.0,9066.0,9061.0,9062.75,403
        2020-02-02 19:36:00,9062.5,9067.75,9061.75,9062.75,280
        2020-02-02 19:37:00,9062.5,9076.5,9059.75,9073.5,1012
        2020-02-02 19:38:00,9073.75,9075.0,9068.5,9069.0,547
        2020-02-02 19:39:00,9069.25,9071.25,9063.75,9068.75,589
        2020-02-02 19:40:00,9068.25,9070.75,9065.75,9069.5,204
        2020-02-02 19:41:00,9069.5,9073.0,9069.25,9072.0,306
        2020-02-02 19:42:00,9072.75,9074.75,9069.25,9073.5,285
        2020-02-02 19:43:00,9073.5,9073.5,9067.0,9067.25,341
        2020-02-02 19:44:00,9067.25,9068.25,9063.75,9064.5,355
        2020-02-02 19:45:00,9064.25,9072.25,9064.0,9065.75,315
        2020-02-02 19:46:00,9065.25,9066.75,9061.5,9065.0,252
        2020-02-02 19:47:00,9065.0,9066.25,9059.75,9059.75,355
        2020-02-02 19:48:00,9059.75,9064.0,9059.5,9061.25,374
        2020-02-02 19:49:00,9060.75,9068.25,9059.75,9064.5,293
        2020-02-02 19:50:00,9065.25,9068.5,9064.25,9067.25,260
        2020-02-02 19:51:00,9067.0,9070.5,9065.0,9069.75,205
        2020-02-02 19:52:00,9070.0,9073.0,9069.0,9072.5,246
        2020-02-02 19:53:00,9072.0,9075.25,9068.5,9070.5,382
        2020-02-02 19:54:00,9071.25,9072.5,9068.5,9071.0,180
        2020-02-02 19:55:00,9070.75,9071.0,9065.75,9066.5,231
        2020-02-02 19:56:00,9066.75,9074.75,9066.5,9074.0,308
        2020-02-02 19:57:00,9074.25,9074.5,9069.75,9071.0,215
        2020-02-02 19:58:00,9071.25,9074.5,9069.0,9072.0,212
        2020-02-02 19:59:00,9072.25,9079.5,9072.25,9077.5,593
        2020-02-02 20:00:00,9077.5,9087.0,9073.5,9086.5,1824
        2020-02-02 20:01:00,9086.75,9092.25,9082.5,9082.5,1141
        2020-02-02 20:02:00,9082.75,9086.25,9080.25,9082.25,750
        2020-02-02 20:03:00,9082.5,9083.5,9077.0,9077.25,364
        2020-02-02 20:04:00,9077.0,9079.25,9076.0,9078.0,304
        2020-02-02 20:05:00,9078.25,9078.75,9074.25,9074.75,233
        2020-02-02 20:06:00,9074.75,9077.25,9072.0,9072.5,405
        2020-02-02 20:07:00,9072.25,9073.5,9069.0,9069.25,394
        2020-02-02 20:08:00,9069.25,9073.0,9066.75,9067.25,413
        2020-02-02 20:09:00,9066.75,9072.25,9066.75,9071.25,191
        2020-02-02 20:10:00,9071.5,9072.25,9070.0,9070.25,141
        2020-02-02 20:11:00,9069.75,9070.0,9064.0,9070.0,595
        2020-02-02 20:12:00,9069.75,9069.75,9065.25,9065.25,268
        2020-02-02 20:13:00,9065.75,9067.5,9064.25,9065.75,241
        2020-02-02 20:14:00,9065.75,9065.75,9061.5,9062.0,353
        2020-02-02 20:15:00,9062.25,9066.75,9060.0,9066.75,708
        2020-02-02 20:16:00,9066.25,9066.75,9062.5,9064.5,235
        2020-02-02 20:17:00,9065.0,9071.5,9065.0,9070.75,270
        2020-02-02 20:18:00,9071.25,9071.25,9067.75,9070.0,180
        2020-02-02 20:19:00,9069.75,9072.0,9068.75,9069.5,177
        2020-02-02 20:20:00,9069.25,9071.25,9067.0,9071.0,159
        2020-02-02 20:21:00,9071.0,9073.5,9069.75,9072.0,208
        2020-02-02 20:22:00,9072.5,9076.25,9071.0,9074.75,248
        2020-02-02 20:23:00,9074.25,9075.0,9071.5,9072.25,103
        2020-02-02 20:24:00,9072.5,9073.0,9066.75,9067.25,190
        2020-02-02 20:25:00,9067.0,9070.25,9065.25,9066.0,163
        2020-02-02 20:26:00,9066.25,9071.75,9066.0,9071.0,143
        2020-02-02 20:27:00,9070.25,9070.25,9065.5,9065.75,86
        2020-02-02 20:28:00,9066.0,9070.0,9065.25,9068.25,173
        2020-02-02 20:29:00,9068.25,9068.75,9066.0,9067.5,96
        2020-02-02 20:30:00,9067.25,9069.75,9066.5,9068.5,161
        2020-02-02 20:31:00,9068.0,9068.0,9066.0,9066.5,73
        2020-02-02 20:32:00,9066.75,9070.5,9065.5,9067.5,171
        2020-02-02 20:33:00,9067.25,9067.25,9061.0,9061.75,299
        2020-02-02 20:34:00,9061.5,9063.0,9060.25,9061.25,206
        2020-02-02 20:35:00,9061.5,9067.25,9060.75,9067.0,218
        2020-02-02 20:36:00,9066.5,9068.5,9064.25,9067.0,198
        2020-02-02 20:37:00,9067.0,9068.25,9066.25,9067.25,66
        2020-02-02 20:38:00,9067.0,9068.75,9065.5,9067.5,127
        2020-02-02 20:39:00,9067.75,9067.75,9062.75,9065.5,143
        2020-02-02 20:40:00,9065.5,9066.25,9063.25,9065.0,98
        2020-02-02 20:41:00,9065.0,9066.0,9064.0,9065.0,49
        2020-02-02 20:42:00,9064.75,9065.25,9062.25,9063.25,70
        2020-02-02 20:43:00,9063.75,9066.5,9063.5,9065.75,72
        2020-02-02 20:44:00,9065.5,9065.5,9061.25,9064.0,141
        2020-02-02 20:45:00,9064.25,9065.0,9061.5,9061.75,79
        2020-02-02 20:46:00,9062.25,9063.75,9059.0,9059.5,201
        2020-02-02 20:47:00,9059.5,9059.75,9055.75,9056.75,384
        2020-02-02 20:48:00,9056.75,9058.75,9056.5,9056.5,138
        2020-02-02 20:49:00,9056.5,9056.5,9053.75,9054.75,277
        2020-02-02 20:50:00,9055.0,9056.0,9053.25,9055.5,132
        2020-02-02 20:51:00,9056.0,9060.25,9056.0,9059.5,172
        2020-02-02 20:52:00,9059.25,9059.25,9055.25,9056.0,139
        2020-02-02 20:53:00,9056.0,9056.25,9053.0,9053.0,163
        2020-02-02 20:54:00,9053.25,9059.5,9053.0,9059.0,131
        2020-02-02 20:55:00,9058.75,9058.75,9056.5,9058.25,83
        2020-02-02 20:56:00,9057.75,9057.75,9054.5,9055.25,117
        2020-02-02 20:57:00,9055.5,9058.25,9054.25,9057.5,70
        2020-02-02 20:58:00,9057.5,9057.75,9055.0,9055.5,54
        2020-02-02 20:59:00,9055.5,9057.5,9054.75,9055.5,62
        2020-02-02 21:00:00,9055.75,9057.25,9055.0,9057.0,74
        2020-02-02 21:01:00,9057.0,9063.5,9056.75,9061.25,285
        2020-02-02 21:02:00,9061.0,9061.0,9057.75,9058.25,101
        2020-02-02 21:03:00,9058.25,9059.5,9057.0,9057.0,81
        2020-02-02 21:04:00,9057.0,9057.0,9051.75,9053.0,191
        2020-02-02 21:05:00,9052.75,9056.25,9052.5,9055.25,105
        2020-02-02 21:06:00,9055.25,9056.25,9054.25,9054.75,63
        2020-02-02 21:07:00,9054.75,9055.25,9052.75,9053.0,90
        2020-02-02 21:08:00,9052.75,9054.5,9052.5,9053.5,96
        2020-02-02 21:09:00,9053.25,9059.25,9052.25,9058.75,147
        2020-02-02 21:10:00,9058.5,9059.5,9057.0,9057.75,138
        2020-02-02 21:11:00,9057.75,9058.75,9056.75,9057.0,82
        2020-02-02 21:12:00,9056.5,9057.5,9055.75,9057.0,102
        2020-02-02 21:13:00,9056.75,9061.5,9056.75,9060.5,131
        2020-02-02 21:14:00,9060.75,9061.25,9059.25,9059.75,92
        2020-02-02 21:15:00,9059.5,9059.5,9056.5,9059.0,172
        2020-02-02 21:16:00,9059.25,9071.0,9059.25,9067.75,471
        2020-02-02 21:17:00,9067.75,9070.0,9066.25,9068.75,428
        2020-02-02 21:18:00,9068.5,9069.5,9067.75,9068.0,277
        2020-02-02 21:19:00,9068.0,9069.0,9067.75,9069.0,82
        2020-02-02 21:20:00,9068.75,9071.5,9068.0,9070.25,231
        2020-02-02 21:21:00,9070.25,9071.25,9069.0,9070.25,198
        2020-02-02 21:22:00,9070.5,9075.25,9070.0,9075.25,376
        2020-02-02 21:23:00,9075.5,9077.0,9074.0,9074.75,274
        2020-02-02 21:24:00,9075.25,9076.75,9074.25,9076.0,183
        2020-02-02 21:25:00,9075.75,9075.75,9073.5,9075.0,223
        2020-02-02 21:26:00,9075.0,9078.25,9073.75,9074.0,212
        2020-02-02 21:27:00,9073.75,9074.5,9071.75,9073.75,332
        2020-02-02 21:28:00,9074.25,9074.75,9070.5,9071.5,119
        2020-02-02 21:29:00,9071.75,9072.75,9070.25,9072.5,120
        2020-02-02 21:30:00,9072.25,9073.5,9070.5,9070.75,146
        2020-02-02 21:31:00,9070.5,9073.5,9067.75,9073.5,200
        2020-02-02 21:32:00,9073.75,9074.0,9072.25,9073.25,77
        2020-02-02 21:33:00,9073.75,9077.0,9073.75,9075.25,139
        2020-02-02 21:34:00,9075.25,9076.5,9074.0,9075.0,89
        2020-02-02 21:35:00,9074.5,9077.0,9074.5,9075.75,156
        2020-02-02 21:36:00,9076.25,9077.0,9072.25,9072.75,170
        2020-02-02 21:37:00,9072.75,9073.25,9070.5,9071.75,71
        2020-02-02 21:38:00,9072.0,9072.5,9070.5,9071.75,49
        2020-02-02 21:39:00,9071.25,9071.75,9070.75,9070.75,34
        2020-02-02 21:40:00,9070.5,9072.0,9069.5,9070.75,88
        2020-02-02 21:41:00,9070.25,9071.75,9070.0,9070.25,54
        2020-02-02 21:42:00,9070.25,9070.25,9068.25,9068.75,70
        2020-02-02 21:43:00,9068.75,9070.0,9068.5,9069.0,64
        2020-02-02 21:44:00,9069.0,9069.75,9068.5,9069.25,25
        2020-02-02 21:45:00,9069.0,9070.75,9068.25,9070.75,58
        2020-02-02 21:46:00,9070.5,9070.75,9066.5,9067.75,144
        2020-02-02 21:47:00,9067.75,9069.5,9067.75,9069.5,33
        2020-02-02 21:48:00,9069.5,9073.75,9069.5,9070.75,205
        2020-02-02 21:49:00,9070.75,9071.0,9068.5,9069.5,103
        2020-02-02 21:50:00,9069.5,9070.75,9069.0,9070.0,53
        2020-02-02 21:51:00,9069.75,9070.5,9069.25,9070.25,46
        2020-02-02 21:52:00,9070.25,9072.0,9070.25,9071.75,53
        2020-02-02 21:53:00,9072.0,9076.0,9072.0,9074.0,274
        2020-02-02 21:54:00,9074.25,9074.25,9071.0,9071.5,88
        2020-02-02 21:55:00,9071.5,9072.25,9070.0,9071.5,60
        2020-02-02 21:56:00,9072.0,9076.0,9072.0,9074.5,123
        2020-02-02 21:57:00,9074.0,9074.25,9072.0,9073.0,69
        2020-02-02 21:58:00,9072.5,9074.0,9072.25,9073.25,65
        2020-02-02 21:59:00,9072.75,9073.5,9072.5,9073.25,23
        2020-02-02 22:00:00,9073.75,9077.25,9073.0,9073.0,205
        2020-02-02 22:01:00,9073.5,9073.5,9071.0,9071.5,109
        2020-02-02 22:02:00,9071.25,9071.5,9069.0,9069.25,81
        2020-02-02 22:03:00,9069.0,9069.0,9065.5,9066.25,175
        2020-02-02 22:04:00,9066.5,9067.5,9065.75,9066.0,118
        2020-02-02 22:05:00,9065.75,9068.0,9065.75,9066.75,69
        2020-02-02 22:06:00,9067.0,9068.0,9066.5,9067.5,60
        2020-02-02 22:07:00,9067.75,9068.25,9066.0,9067.75,108
        2020-02-02 22:08:00,9067.75,9068.0,9066.0,9066.25,52
        2020-02-02 22:09:00,9066.25,9068.0,9065.5,9067.25,74
        2020-02-02 22:10:00,9067.5,9068.0,9066.5,9066.5,75
        2020-02-02 22:11:00,9066.5,9068.0,9065.75,9065.75,60
        2020-02-02 22:12:00,9066.25,9067.0,9065.25,9066.5,63
        2020-02-02 22:13:00,9066.25,9066.75,9066.0,9066.0,39
        2020-02-02 22:14:00,9066.0,9066.0,9064.25,9065.25,68
        2020-02-02 22:15:00,9065.5,9067.0,9065.25,9066.75,50
        2020-02-02 22:16:00,9066.75,9067.75,9066.5,9067.0,60
        2020-02-02 22:17:00,9067.5,9071.25,9067.5,9070.75,185
        2020-02-02 22:18:00,9070.5,9072.0,9070.25,9070.5,108
        2020-02-02 22:19:00,9070.75,9071.0,9069.25,9070.25,84
        2020-02-02 22:20:00,9070.25,9071.0,9069.75,9070.0,54
        2020-02-02 22:21:00,9070.25,9070.75,9069.75,9070.0,27
        2020-02-02 22:22:00,9069.75,9071.0,9069.0,9070.75,40
        2020-02-02 22:23:00,9070.75,9071.0,9069.25,9069.75,32
        2020-02-02 22:24:00,9069.25,9069.25,9067.75,9068.0,65
        2020-02-02 22:25:00,9068.0,9070.75,9067.75,9070.0,58
        2020-02-02 22:26:00,9069.75,9070.75,9069.25,9070.75,24
        2020-02-02 22:27:00,9070.75,9070.75,9069.0,9069.0,26
        2020-02-02 22:28:00,9068.75,9069.75,9067.75,9068.75,58
        2020-02-02 22:29:00,9069.0,9072.25,9068.5,9071.75,98
        2020-02-02 22:30:00,9071.75,9071.75,9070.5,9071.0,46
        2020-02-02 22:31:00,9070.75,9070.75,9067.75,9067.75,54
        2020-02-02 22:32:00,9067.75,9068.75,9067.5,9068.0,32
        2020-02-02 22:33:00,9067.75,9068.0,9066.5,9067.5,31
        2020-02-02 22:34:00,9067.75,9068.75,9067.0,9068.25,44
        2020-02-02 22:35:00,9069.0,9070.25,9068.25,9070.25,51
        2020-02-02 22:36:00,9069.75,9070.25,9069.25,9070.25,18
        2020-02-02 22:37:00,9070.0,9070.25,9069.5,9070.0,26
        2020-02-02 22:38:00,9069.75,9070.25,9068.5,9068.75,74
        2020-02-02 22:39:00,9069.0,9069.5,9068.5,9068.75,17
        2020-02-02 22:40:00,9068.5,9069.25,9067.75,9068.0,21
        2020-02-02 22:41:00,9067.75,9069.0,9066.25,9068.5,89
        2020-02-02 22:42:00,9068.5,9069.75,9068.5,9069.5,20
        2020-02-02 22:43:00,9069.75,9070.5,9067.5,9068.25,39
        2020-02-02 22:44:00,9068.0,9069.25,9068.0,9068.0,28
        2020-02-02 22:45:00,9068.0,9068.0,9066.75,9067.25,33
        2020-02-02 22:46:00,9068.75,9069.25,9068.75,9069.25,26
        2020-02-02 22:47:00,9069.0,9069.75,9068.25,9069.5,36
        2020-02-02 22:48:00,9069.5,9069.75,9067.5,9067.75,55
        2020-02-02 22:49:00,9067.5,9068.75,9066.0,9067.25,124
        2020-02-02 22:50:00,9067.25,9069.25,9066.5,9069.25,39
        2020-02-02 22:51:00,9068.75,9070.0,9068.25,9070.0,41
        2020-02-02 22:52:00,9070.0,9072.0,9070.0,9071.0,127
        2020-02-02 22:53:00,9071.0,9071.75,9071.0,9071.0,50
        2020-02-02 22:54:00,9070.75,9071.25,9070.75,9071.0,51
        2020-02-02 22:55:00,9071.0,9072.25,9071.0,9072.25,91
        2020-02-02 22:56:00,9072.25,9074.0,9072.0,9073.75,150
        2020-02-02 22:57:00,9073.75,9073.75,9072.0,9073.0,53
        2020-02-02 22:58:00,9073.25,9073.25,9071.0,9072.0,62
        2020-02-02 22:59:00,9072.0,9072.0,9071.0,9071.5,50
        2020-02-02 23:00:00,9071.25,9074.0,9070.5,9071.25,119
        2020-02-02 23:01:00,9071.25,9072.0,9070.0,9071.5,94
        2020-02-02 23:02:00,9072.25,9079.0,9072.25,9077.25,434
        2020-02-02 23:03:00,9077.25,9077.75,9075.5,9075.5,149
        2020-02-02 23:04:00,9075.5,9079.5,9075.5,9078.5,168
        2020-02-02 23:05:00,9078.25,9078.75,9076.0,9077.0,229
        2020-02-02 23:06:00,9076.75,9078.75,9076.5,9078.0,84
        2020-02-02 23:07:00,9078.75,9079.0,9077.25,9078.5,59
        2020-02-02 23:08:00,9079.0,9079.0,9077.25,9078.5,103
        2020-02-02 23:09:00,9078.25,9078.25,9077.5,9078.0,37
        2020-02-02 23:10:00,9077.75,9077.75,9075.25,9075.5,162
        2020-02-02 23:11:00,9075.5,9079.25,9074.0,9078.75,523
        2020-02-02 23:12:00,9078.5,9078.75,9076.75,9078.0,153
        2020-02-02 23:13:00,9077.5,9079.5,9077.5,9079.0,70
        2020-02-02 23:14:00,9079.5,9080.75,9079.25,9079.25,151
        2020-02-02 23:15:00,9079.0,9080.5,9078.75,9080.0,50
        2020-02-02 23:16:00,9079.75,9084.5,9079.75,9083.75,348
        2020-02-02 23:17:00,9084.0,9084.25,9081.75,9083.25,199
        2020-02-02 23:18:00,9083.5,9084.5,9082.75,9083.25,119
        2020-02-02 23:19:00,9083.5,9083.5,9081.5,9081.75,76
        2020-02-02 23:20:00,9082.25,9085.75,9082.0,9084.75,164
        2020-02-02 23:21:00,9084.75,9086.5,9084.5,9086.25,138
        2020-02-02 23:22:00,9086.25,9087.75,9085.0,9087.5,185
        2020-02-02 23:23:00,9087.75,9088.0,9085.75,9086.0,152
        2020-02-02 23:24:00,9086.0,9086.75,9085.5,9086.75,139
        2020-02-02 23:25:00,9086.75,9087.75,9084.5,9086.0,138
        2020-02-02 23:26:00,9085.25,9086.0,9084.0,9084.25,81
        2020-02-02 23:27:00,9085.25,9085.25,9082.5,9083.0,97
        2020-02-02 23:28:00,9082.75,9083.0,9079.5,9081.25,322
        2020-02-02 23:29:00,9081.5,9084.5,9081.0,9084.25,131
        2020-02-02 23:30:00,9084.25,9087.25,9084.0,9086.0,172
        2020-02-02 23:31:00,9085.5,9085.5,9080.25,9080.5,249
        2020-02-02 23:32:00,9080.75,9082.5,9080.25,9082.5,136
        2020-02-02 23:33:00,9083.0,9083.0,9081.0,9082.0,79
        2020-02-02 23:34:00,9082.25,9085.25,9082.25,9082.25,90
        2020-02-02 23:35:00,9082.5,9083.25,9081.75,9082.0,76
        2020-02-02 23:36:00,9081.5,9081.75,9080.5,9081.5,96
        2020-02-02 23:37:00,9081.5,9083.25,9081.25,9082.75,99
        2020-02-02 23:38:00,9083.0,9085.0,9082.0,9085.0,118
        2020-02-02 23:39:00,9085.25,9085.25,9081.75,9083.75,144
        2020-02-02 23:40:00,9084.0,9085.0,9080.5,9082.0,140
        2020-02-02 23:41:00,9081.75,9082.25,9080.25,9081.75,86
        2020-02-02 23:42:00,9082.0,9082.0,9079.5,9080.25,146
        2020-02-02 23:43:00,9080.25,9080.75,9077.75,9079.5,181
        2020-02-02 23:44:00,9079.75,9081.25,9078.75,9080.5,164
        2020-02-02 23:45:00,9080.25,9080.5,9078.75,9079.75,82
        2020-02-02 23:46:00,9079.5,9080.25,9078.5,9079.5,94
        2020-02-02 23:47:00,9079.25,9079.25,9076.0,9076.75,297
        2020-02-02 23:48:00,9076.25,9076.5,9074.5,9075.0,340
        2020-02-02 23:49:00,9075.0,9075.25,9074.0,9074.5,158
        2020-02-02 23:50:00,9074.75,9076.25,9074.0,9075.0,152
        2020-02-02 23:51:00,9075.0,9075.0,9073.25,9074.5,91
        2020-02-02 23:52:00,9074.25,9075.5,9073.25,9074.25,158
        2020-02-02 23:53:00,9074.5,9077.0,9074.25,9075.75,395
        2020-02-02 23:54:00,9075.75,9077.5,9075.25,9077.5,149
        2020-02-02 23:55:00,9077.25,9078.75,9077.0,9078.5,107
        2020-02-02 23:56:00,9078.75,9080.5,9078.25,9079.75,76
        2020-02-02 23:57:00,9079.5,9082.25,9079.25,9082.0,191
        2020-02-02 23:58:00,9081.75,9082.75,9080.0,9081.0,114
        2020-02-02 23:59:00,9081.0,9081.5,9080.75,9081.25,57
        
        
        1 Reply Last reply Reply Quote 0
        • B
          backtrader administrators last edited by backtrader

          The resampler filter wouldn't know what to do with extra lines (add, max, min, sub, multiply, take the 3rd one, take the last ...) and works only with the fields for which it has a rule, the standard ones.

          You can create a 2nd data feed, assign your desired fields to open (keep 1st), high/low (keep max/min), close (keep last), volume (add) and use that resampled to match the timeframe of your master data feed.

          Or create your own resampling filter.

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post
          Copyright © 2016, 2017, 2018 NodeBB Forums | Contributors
          $(document).ready(function () { app.coldLoad(); }); }