<s> from pyalgotrade import strategy <EOL> from pyalgotrade . barfeed import yahoofeed <EOL> from pyalgotrade . technical import ma <EOL> class MyStrategy ( strategy . BacktestingStrategy ) : <EOL> def __init__ ( self , feed , instrument ) : <EOL> super ( MyStrategy , self ) . __init__ ( feed ) <EOL> self . __sma = ma . SMA ( feed [ instrument ] . getCloseDataSeries ( ) , <NUM_LIT:15> ) <EOL> self . __instrument = instrument <EOL> def onBars ( self , bars ) : <EOL> bar = bars [ self . __instrument ] <EOL> self . info ( "<STR_LIT>" % ( bar . getClose ( ) , self . __sma [ - <NUM_LIT:1> ] ) ) <EOL> feed = yahoofeed . Feed ( ) <EOL> feed . addBarsFromCSV ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> myStrategy = MyStrategy ( feed , "<STR_LIT>" ) <EOL> myStrategy . run ( ) </s>
