Backtrader Community

    • 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/

    help,tick not run into NEXT

    General Code/Help
    1
    1
    51
    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.
    • G
      goldcar last edited by

      I am trying to make strategy then run NEXT every tick received. but it seems nothing changes.
      anyone here can help? code is below:

      if __name__ == '__main__':
          with open('./params.json', 'r') as f:
              ctp_setting = json.load(f)
          cerebro = bt.Cerebro(live=True)
          store = CTPStore(ctp_setting, debug=True)
          data0_name = 'ag2212.SHFE'
          tz = pytz.timezone('Asia/Shanghai')
          data0 = store.getdata(dataname=data0_name,
                                timeframe=bt.TimeFrame.Ticks,
                                backfill_from=None,
                                qcheck=5,
                                sessionstart=time(21, 00, 00),
                                sessionend=time(15, 00, 00),
                                name=data0_name + '_tick',
                                tzinput=tz,
                                tz=tz,
                                compression=1,
                                rtbar=True,
                                )
          cerebro.resampledata(data0, timeframe=bt.TimeFrame.Seconds, compression=5,
                               name=data0_name + '_10s')
          cerebro.addstrategy(SmaCross, store=store)
          cerebro.run(is_realtime=True, tz=tz)
      

      It still goes into minute whatever I change the timeframe. Any idea? Thanks

      1 Reply Last reply Reply Quote 0
      • 1 / 1
      • First post
        Last post
      Copyright © 2016, 2017, 2018, 2019, 2020, 2021 NodeBB Forums | Contributors