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/

    Quick Start Data Referenced but Not sourced?

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

      I've been trying to follow along in my own local enviornement with the quickstart guide.

      One thing that's tripping me up is in the section on adding a data feed.

      In the code we have something like:

      def example_3():
          """adding a data feed"""
          cerebro = bt.Cerebro()
      
          modpath = os.path.dirname(os.path.abspath(sys.argv[0]))
          datapath = os.path.join(modpath, 'datas', 'orcl-1995-2014.txt')
      
          data = bt.feeds.YahooFinanceCSVData(
              dataname=datapath,
              fromdate=datetime.datetime(2000, 1, 1),
              todate=datetime.datetime(2000, 12, 31),
              reverse=False
          )
      
          cerebro.adddata(data)
      
          cerebro.broker.setcash(100000.0)
      
          print('Starting Portfolio Value: %.2f' % cerebro.broker.getvalue())
      
          cerebro.run()
      
          print('Final Portfolio Value: %.2f' % cerebro.broker.getvalue())
      

      Where is this

      orc1-1995-2014.txt
      

      coming from? Is it expecting us to download some data from Yahoo Finance or something?

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

        The datas are located here: https://github.com/mementum/backtrader/tree/master/datas

        branhoff 1 Reply Last reply Reply Quote 1
        • branhoff
          branhoff @LeggoMaEggo last edited by

          @leggomaeggo Ah, thank you. That's a big help. Not sure where I missed that mentioned in the documentation.

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