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



  • 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()





  • Thanks you for your help


Log in to reply
 

});