Backtrader Community

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    1. Home
    2. Locusta
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
    L
    • Profile
    • Following 0
    • Followers 1
    • Topics 0
    • Posts 1
    • Best 0
    • Controversial 0
    • Groups 0

    Locusta

    @Locusta

    0
    Reputation
    184
    Profile views
    1
    Posts
    1
    Followers
    0
    Following
    Joined Last Online

    Locusta Unfollow Follow

    Latest posts made by Locusta

    • RE: quandl example

      Hi , I am trying to play around with the example stategy, but can´t get the data feed to work. What am i missing ? (AttributeError: 'NoneType' object has no attribute 'close')
      Quandl returns the fx-data with a column rate instead of close.

      #!/usr/bin/python
      
      from datetime import datetime
      import backtrader as bt
      
      
      class SmaCross(bt.SignalStrategy):
      	params = (('pfast', 10), ('pslow', 30),)
      	def __init__(self):
      		sma1, sma2 = bt.ind.SMA(period=self.p.pfast), bt.ind.SMA(period=self.p.pslow)
      		self.signal_add(bt.SIGNAL_LONG, bt.ind.CrossOver(sma1, sma2))
      
      cerebro = bt.Cerebro()
      
      data = bt.feeds.Quandl(dataname='CURRFX/GBPEUR', apikey='xxxxxxxx')
      cerebro.adddata(data)
      cerebro.addstrategy(SmaCross)
      cerebro.run()
      cerebro.plot()
      
      posted in General Code/Help
      L
      Locusta