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 value at a given position/slice. It raises IndexError if the position is invalid, or TypeError if the key type is invalid.
Returns the number of elements in the data series.
list of weak references to the object (if defined)
Returns a list of datetime.datetime associated with each value.
A sequence based DataSeries.
Parameters: |
|
---|
Note
Neither values nor dateTimes get cloned, and this class takes ownership of them.
Appends a value.
Appends a value with an associated datetime.
Note
If dateTime is not None, it must be greater than the last one.
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.
Returns two dataseries that exhibit only those values whose datetimes are in both dataseries.
Parameters: |
|
---|
from pyalgotrade import dataseries
# Build a sequence based DataSeries.
ds = dataseries.SequenceDataSeries(range(0, 50))
# Get the last value.
print ds[49]
print ds[-1]
# Get the previous value.
print ds[48]
print ds[-2]
# Get the first value.
print ds[0]
print ds[-50]
# Get the last 3 values.
print ds[-3:]
The output should be:
49
49
48
48
0
0
[47, 48, 49]