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/

    module 'backtrader.stores' has no attribute 'IBStore'

    General Code/Help
    2
    8
    2136
    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.
    • Y
      yukking last edited by

      ibpy2 is installed and it can import.

      But when I test this code:

      import ib
      import backtrader as bt
      store = bt.stores.IBStore(port=7497)'
      

      I get the error:

      AttributeError: module 'backtrader.stores' has no attribute 'IBStore'
      

      Can someone help me?

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

        You didnt import the module ibstore. Try e.g.

        import backtrader.stores.ibstore as ibstore
        store = ibstore.IBStore(port=7497)
        
        Y 1 Reply Last reply Reply Quote 0
        • Y
          yukking @vbs last edited by

          Thx@vbs, I tried it but got the same error.

          AttributeError: module 'backtrader.stores.ibstore' has no attribute 'IBStore'
          
          1 Reply Last reply Reply Quote 0
          • vbs
            vbs last edited by

            @vbs said in module 'backtrader.stores' has no attribute 'IBStore':

            import backtrader.stores.ibstore

            Hm please open a python shell and do this:

            import backtrader.stores.ibstore
            

            and then

            dir(backtrader.stores.ibstore)
            

            and post the output.

            Y 1 Reply Last reply Reply Quote 0
            • Y
              yukking @vbs last edited by

              python shell output

              >>> import backtrader.stores.ibstore
              >>> dir(backtrader.stores.ibstore)
              ['AutoDict', 'Contract', 'IBStore', 'MetaParams', 'MetaSingleton', 'Position', 'RTVolume', 'TimeFrame', 'UTC', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', '_ts2dt', 'absolute_import', 'bstr', 'bytes', 'collections', 'copy', 'date', 'datetime', 'division', 'ibopt', 'ibregister', 'inspect', 'itertools', 'long', 'print_function', 'queue', 'random', 'threading', 'time', 'timedelta', 'unicode_literals', 'with_metaclass']
              >>>
              
              1 Reply Last reply Reply Quote 0
              • vbs
                vbs last edited by

                IBStore is clearly in there, I can see it :P

                And you are sure that this does not work now? Well, it has to work

                store = backtrader.stores.ibstore.IBStore(port=7497)
                
                1 Reply Last reply Reply Quote 0
                • Y
                  yukking last edited by

                  I think I found the problem, but I don't know how to fix it.
                  When I used the python shell, it didn't report an error.
                  But when I use python script, it gives an error.

                  AttributeError: module 'backtrader.stores' has no attribute 'ibstore'
                  
                  1 Reply Last reply Reply Quote 0
                  • Y
                    yukking last edited by

                    Finally, I found the problem and solved it.
                    My file name is ib.py, which is the same as the module name of ibpy.
                    Anyway, thank you all.

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