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/

    Error:AttributeError: module 'backtrader' has no attribute 'feeds'

    General Discussion
    3
    6
    3032
    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.
    • Nguyễn Tài Nguyên
      Nguyễn Tài Nguyên last edited by Nguyễn Tài Nguyên

      When I create basic code, it shows "AttributeError: module 'backtrader' has no attribute 'Cerebro'

      from __future__ import (absolute_import, division, print_function,
                              unicode_literals)
      
      import backtrader as bt
      
      if __name__ == '__main__':
          cerebro = bt.Cerebro()
          cerebro.broker.setcash(100000.0)
      
          print('Starting Portfolio Value: %.2f' % cerebro.broker.getvalue())
      
          cerebro.run()
      
          print('Final Portfolio Value: %.2f' % cerebro.broker.getvalue())
      

      I am using 1.9.59.122 version
      Windows 10

      Can you help me fix it ? Thank you !

      1 Reply Last reply Reply Quote 0
      • A
        ab_trader last edited by ab_trader

        Will be helpful to have your code posted here, otherwise it can be only stated that you did something wrong.

        1 Reply Last reply Reply Quote 2
        • Nguyễn Tài Nguyên
          Nguyễn Tài Nguyên last edited by

          Hi,
          I updated the code. Thank you :)

          1 Reply Last reply Reply Quote 0
          • A
            ab_trader last edited by

            You need to add data feeds.

            1 Reply Last reply Reply Quote 0
            • Nguyễn Tài Nguyên
              Nguyễn Tài Nguyên last edited by

              I just tried to run that code in command line. That code worked but my IDE. So, I think there is problem in my IDE Pycharm.

              1 Reply Last reply Reply Quote 0
              • P
                Paska Houso last edited by

                Might it be that the Python interpreter (or virtualenv) used inside Pycharm is not the same as the one you use in the console?

                • https://www.jetbrains.com/help/pycharm/configuring-python-interpreter.html
                1 Reply Last reply Reply Quote 1
                • 1 / 1
                • First post
                  Last post
                Copyright © 2016, 2017, 2018 NodeBB Forums | Contributors
                $(document).ready(function () { app.coldLoad(); }); }