Base class for data series. A data series is an abstraction used to manage historical data.
Note
This is a base class and should not be used directly.
Returns the first valid position in the dataseries.
Returns the number of values in the data series.
Returns the value at a given instant, relative to the last value, or None if the value doesn’t exist.
Parameters: | valuesAgo (int) – The position of the value relative to the last one. Must be >= 0. |
---|
Returns the value at a given instant, or None if the value doesn’t exist.
Parameters: | pos – The absolute position of the value in the dataseries. Must be >= 0. |
---|
A sequence based DataSeries.
Parameters: | values (list.) – The values that this DataSeries will hold. If its None, an empty list is used. Note that the list is not cloned and it takes ownership of it. |
---|
Appends a value.
A DataSeries of pyalgotrade.bar.Bar instances.
Returns a DataSeries with the adjusted close prices.
Returns a DataSeries with the close prices.
Returns a DataSeries with the high prices.
Returns a DataSeries with the low prices.
Returns a DataSeries with the open prices.
Returns a DataSeries with the volume.
from pyalgotrade import dataseries
# Build a sequence based DataSeries.
ds = dataseries.SequenceDataSeries(range(0, 50))
# Get the last value.
print ds.getValue()
print ds.getValueAbsolute(49)
# Get the previous value.
print ds.getValue(1)
print ds.getValueAbsolute(48)
# Get the first value.
print ds.getValue(49)
print ds.getValueAbsolute(0)
The output should be:
49
49
48
48
0
0