私は PyAlgoTrade の学習とテストを開始しましたが、SMA や RSI などの一部の技術のコードの背後にあるロジックを理解するのに苦労しています。self.info() 関数が変数として受け取るデータフレーム フィードを出力することは理解していますが、以下に掲載されているコードの最後の行にある SMA と RSI の後の [-1] の役割は何ですか?
from pyalgotrade import strategy
from pyalgotrade.barfeed import yahoofeed
from pyalgotrade.technical import ma
from pyalgotrade.technical import rsi
class MyStrategy(strategy.BacktestingStrategy):
def __init__(self, feed, instrument):
strategy.BacktestingStrategy.__init__(self, feed)
self.__rsi = rsi.RSI(feed[instrument].getCloseDataSeries(), 14)
self.__sma = ma.SMA(self.__rsi, 15)
self.__instrument = instrument
def onBars(self, bars):
bar = bars[self.__instrument]
self.info("%s %s %s" %(bar.getClose(), self.__rsi[-1], self.__sma[-1]))