backtrader的设计很新颖。
两个基础
1. lines
Data Feeds, Indicators and Strategies have lines.
A line is a succession of points that when joined together form this line. When talking about the markets, a Data Feed has usually the following set of points per day:
Open, High, Low, Close, Volume, OpenInterest
The series of “Open”s along time is a Line. And therefore a Data Feed has usually 6 lines.
If we also consider “DateTime” (which is the actual reference for a single point), we could count 7 lines.
backtraders 自己创造了个“线”的概念,数据是由 Open, High, Low, Close, Volume, OpenInterest 这6个元素构成,每个元素的序列就是一条“线”
DataFeeds, Indicators, Strategies 都有“线”。
2. index 0
backtrader的索引和python不同,索引0指向当前的数值,-1是倒数第二个数值。
之所以这样做,是方便在时间序列里获取当前的数值。我认为
其他方面
-
system clock (backtrader立时)
无论是回测或者