For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

Newbie to Backtrader -Sierra Chart Data Feed



  • I am trying to use sierra chart as my data feed but I dont understand how to use it. It appear that the parser is still trying to use the YHOO parser instead of that of the Sierra chart class as I am a native sierra chart user

    I thought I could use this;

    s=filename
    s="CLRaw-SC.csv"
    data=bt.feeds.SierraChartCSVData(dataname=s)
    cerebro.adddata(data)   
    

    when I run I get:

    <backtrader.feeds.sierrachart.SierraChartCSVData at 0x1c981507400>
    

    when i run cerebro via
    %time cerebro.run()
    it get this:

    ---------------------------------------------------------------------------
    FileNotFoundError                         Traceback (most recent call last)
    <ipython-input-33-3a641146f119> in <module>()
    ----> 1 get_ipython().magic('time cerebro.run()')
    
    C:\Users\jngri\Anaconda3\envs\finpy\lib\site-packages\IPython\core\interactiveshell.py in magic(self, arg_s)
       2156         magic_name, _, magic_arg_s = arg_s.partition(' ')
       2157         magic_name = magic_name.lstrip(prefilter.ESC_MAGIC)
    -> 2158         return self.run_line_magic(magic_name, magic_arg_s)
       2159 
       2160     #-------------------------------------------------------------------------
    
    C:\Users\jngri\Anaconda3\envs\finpy\lib\site-packages\IPython\core\interactiveshell.py in run_line_magic(self, magic_name, line)
       2077                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
       2078             with self.builtin_trap:
    -> 2079                 result = fn(*args,**kwargs)
       2080             return result
       2081 
    
    <decorator-gen-60> in time(self, line, cell, local_ns)
    
    C:\Users\jngri\Anaconda3\envs\finpy\lib\site-packages\IPython\core\magic.py in <lambda>(f, *a, **k)
        186     # but it's overkill for just that one bit of state.
        187     def magic_deco(arg):
    --> 188         call = lambda f, *a, **k: f(*a, **k)
        189 
        190         if callable(arg):
    
    C:\Users\jngri\Anaconda3\envs\finpy\lib\site-packages\IPython\core\magics\execution.py in time(self, line, cell, local_ns)
       1179         if mode=='eval':
       1180             st = clock2()
    -> 1181             out = eval(code, glob, local_ns)
       1182             end = clock2()
       1183         else:
    
    <timed eval> in <module>()
    
    C:\Users\jngri\Anaconda3\envs\finpy\lib\site-packages\backtrader\cerebro.py in run(self, **kwargs)
       1125             # let's skip process "spawning"
       1126             for iterstrat in iterstrats:
    -> 1127                 runstrat = self.runstrategies(iterstrat)
       1128                 self.runstrats.append(runstrat)
       1129         else:
    
    C:\Users\jngri\Anaconda3\envs\finpy\lib\site-packages\backtrader\cerebro.py in runstrategies(self, iterstrat, predata)
       1205                 if self._exactbars < 1:  # datas can be full length
       1206                     data.extend(size=self.params.lookahead)
    -> 1207                 data._start()
       1208                 if self._dopreload:
       1209                     data.preload()
    
    C:\Users\jngri\Anaconda3\envs\finpy\lib\site-packages\backtrader\feed.py in _start(self)
        201 
        202     def _start(self):
    --> 203         self.start()
        204 
        205         if not self._started:
    
    C:\Users\jngri\Anaconda3\envs\finpy\lib\site-packages\backtrader\feeds\yahoo.py in start(self)
        457 
        458         # Prepared a "path" file -  CSV Parser can take over
    --> 459         super(YahooFinanceData, self).start()
        460 
        461 
    
    C:\Users\jngri\Anaconda3\envs\finpy\lib\site-packages\backtrader\feeds\yahoo.py in start(self)
         88 
         89     def start(self):
    ---> 90         super(YahooFinanceCSVData, self).start()
         91 
         92         if self.p.version == 'v7':
    
    C:\Users\jngri\Anaconda3\envs\finpy\lib\site-packages\backtrader\feed.py in start(self)
        669             else:
        670                 # Let an exception propagate to let the caller know
    --> 671                 self.f = io.open(self.p.dataname, 'r')
        672 
        673         if self.p.headers:
    
    FileNotFoundError: [Errno 2] No such file or directory: 'YHOO'
    

    thanks for the help.



  • Could you format the code and output, please?
    Hard to understand what is going on there.