Navigation

    Backtrader Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    1. Home
    2. floodfill
    3. Posts
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
    F
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 1
    • Best 0
    • Groups 0

    Posts made by floodfill

    • IB market data subscriptions & End Date/Time: The date, time, or time-zone entered is invalid.

      I can't establish FX market data subscriptions against paper account TWS. I had this working previously, now it stopped working and I can't figure out what change on my side caused this.

      Can someone please let me know what I am doing wrong?

      Thanks.

      Code with dummy mean reverting strat:

      import backtrader as bt
      import meanrev as mr
      
      def run(args=None):
          cerebro = bt.Cerebro()
          store = bt.stores.IBStore(host='127.0.0.1', port=4002, clientId=None, reconnect=100, timeout=3.0, _debug=False)
      
          for sym,config in mr.syms.items():
              print('starting strategy for ' + sym)
              data = store.getdata(dataname=f"{sym}-CASH-IDEALPRO", tradename=f"{sym[:3]}-CFD-SMART-{sym[4:]}", timeframe=bt.TimeFrame.Ticks)
              cerebro.resampledata(data, timeframe=bt.TimeFrame.Seconds, compression=30)
          
              cerebro.addstrategy(mr.MeanRevStrat, md=data, sym=sym, config=config)
      
          cerebro.broker = store.getbroker()
          cerebro.run()
      
      if __name__ == '__main__':
          run()
      

      From IB logs API:

      10:21:34:256 <- 20-5-16777228-12087792-EUR-CASH--0.0---IDEALPRO--USD-EUR.USD-EUR.USD-0-20220914 09:21:33 GMT-30 secs-28800 S-0-BID-2-
      10:21:34:277 -> 4-2-16777228-10314-End Date/Time: The date, time, or time-zone entered is invalid. The correct format is yyyymmdd hh:mm:ss xxx where yyyymmdd and xxx are optional. E.g.: 20031126 15:59:00 US/Eastern  Note that there is a space between the date and time, and between the time and time-zone.  If no date is specified, current date is assumed. If no time-zone is specified, local time-zone is assumed(deprecated).  You can also provide yyyymmddd-hh:mm:ss time is in UTC. Note that there is a dash between the date and time in UTC notation.-
      

      venv depedencies:

      backtrader      1.9.76.123
      cycler          0.11.0
      fonttools       4.33.3
      ibapi           9.81.1.post1
      IbPy2           0.8.0
      kiwisolver      1.4.3
      matplotlib      3.5.3
      numpy           1.23.0
      packaging       21.3
      pandas          1.4.3
      Pillow          9.2.0
      pip             22.0.2
      pyparsing       3.0.9
      python-dateutil 2.8.2
      pytz            2022.1
      setuptools      59.6.0
      six             1.16.0
      

      TWS versions:

      Build 10.18.1d, Sep 13, 2022 3:41:49 PM 
      Jolt Build 1.18.9, Jul 5, 2022 05:27:19 PM 
      Nia Build 2.24.2, Jan 17, 2022 05:48:10 PM 
      ModelNav Build 1.13.2, Jan 24, 2022 04:59:21 PM 
      Riskfeed Build 2.45.3, Jul 25, 2022 06:42:42 PM
      
      posted in General Code/Help
      F
      floodfill
    • 1 / 1