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/

    timer support and IB

    General Code/Help
    2
    3
    341
    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.
    • rami
      rami last edited by rami

      @backtrader Somehow I get timer notification before the time arrived(marked bold), what issue can be?
      you can see difference with (when parameter, and data timestamp).

         def __init__(self):
              print("Init ")
              self.add_timer(when=datetime.time(16,30), #bt.timer.SESSION_END,
                  offset=datetime.timedelta(minutes=10),
                  repeat=datetime.timedelta(),
                  weekdays=[]) # , tzdata=self.dnames['MKTD'])   #tz.timezone('America/New_York')
      
      
          def notify_timer(self, timer, when, *args, **kwargs):
              print('strategy notify_timer with tid {}, when {} cheat {} feed stamp {}'.
                    format(timer.p.tid, when, timer.p.cheat,self.data.datetime.datetime(-1)))
      
      

      strategy notify_timer with tid 0, when 2019-04-30 16:40:00 cheat False feed stamp 2019-04-29 15:00:00
      NEXT
      strategy notify_timer with tid 0, when 2019-05-01 16:40:00 cheat False feed stamp 2019-04-30 15:00:00
      NEXT
      ***** DATA NOTIF: MKTD LIVE
      ***** DATA NOTIF: BONDLONGD LIVE
      ***** DATA NOTIF: GOLDLONGD LIVE

      1 Reply Last reply Reply Quote 0
      • B
        backtrader administrators last edited by

        Timezone, timeframe and printing the date from the previous day.

        1 Reply Last reply Reply Quote 0
        • rami
          rami last edited by rami

          @backtrader, have a couple of questions:
          how to make algo skeleton, that can trade, not on a day close, but on ticker price at a specific time like 15:30?
          To make resampling with 30min, and wait for a specific time to validate and execute?
          How I can get a historical daily price this specific time 15:30 (for example for 200 days)?

          thank you in advance.

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