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/

    Bug

    General Code/Help
    2
    3
    65
    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.
    • Aill3urs 2019
      Aill3urs 2019 last edited by

      Hello
      When i try to run a just this test on Spyder , i have this error :
      ///-------ERROR-------------------//
      File "/Users/jxx/.spyder-py3/temp.py", line 25, in <module>
      cerebro.run()

      File "/Users/jxx/anaconda3/lib/python3.7/site-packages/backtrader/cerebro.py", line 1127, in run
      runstrat = self.runstrategies(iterstrat)

      File "/Users/jxx/anaconda3/lib/python3.7/site-packages/backtrader/cerebro.py", line 1210, in runstrategies
      data._start()

      File "/Users/jxx/anaconda3/lib/python3.7/site-packages/backtrader/feed.py", line 203, in _start
      self.start()

      File "/Users/jxx/anaconda3/lib/python3.7/site-packages/backtrader/feeds/yahoo.py", line 352, in start
      super(YahooFinanceData, self).start()

      File "/Users/jxx/anaconda3/lib/python3.7/site-packages/backtrader/feeds/yahoo.py", line 94, in start
      super(YahooFinanceCSVData, self).start()

      File "/Users/jxxx/anaconda3/lib/python3.7/site-packages/backtrader/feed.py", line 674, in start
      self.f = io.open(self.p.dataname, 'r')

      FileNotFoundError: [Errno 2] No such file or directory: 'BTC-USD'

      ///--------------------------------------------//

      from datetime import datetime
      import backtrader as bt

      class SmaCross(bt.SignalStrategy):
      def init(self):
      sma1, sma2 = bt.ind.SMA(period=10), bt.ind.SMA(period=30)
      crossover = bt.ind.CrossOver(sma1, sma2)
      self.signal_add(bt.SIGNAL_LONG, crossover)

      cerebro = bt.Cerebro()
      cerebro.addstrategy(SmaCross)

      data0 = bt.feeds.YahooFinanceData(dataname='BTC-USD', fromdate=datetime(2018, 1, 1),
      todate=datetime(2019, 12, 31))
      cerebro.adddata(data0)

      cerebro.run()
      cerebro.plot()

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

        https://community.backtrader.com/topic/2363/errno-2-no-such-file-or-directory

        • If my answer helped, hit reputation up arrow at lower right corner of the post.
        • Python Debugging With Pdb
        • New to python and bt - check this out
        1 Reply Last reply Reply Quote 0
        • Aill3urs 2019
          Aill3urs 2019 last edited by

          Thanks you for your help

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