quick introduction to PyAlgoTrade

PHOTO EMBED

Fri Oct 08 2021 00:10:23 GMT+0000 (Coordinated Universal Time)

Saved by @trivent

from pyalgotrade import strategy
from pyalgotrade.barfeed import quandlfeed


class MyStrategy(strategy.BacktestingStrategy):
    def __init__(self, feed, instrument):
        super(MyStrategy, self).__init__(feed)
        self.__instrument = instrument

    def onBars(self, bars):
        bar = bars[self.__instrument]
        self.info(bar.getClose())

# Load the bar feed from the CSV file
feed = quandlfeed.Feed()
feed.addBarsFromCSV("orcl", "WIKI-ORCL-2000-quandl.csv")

# Evaluate the strategy with the feed's bars.
myStrategy = MyStrategy(feed, "orcl")
myStrategy.run()
content_copyCOPY

http://gbeced.github.io/pyalgotrade/docs/v0.20/html/tutorial.html