Bases: object
An EventWindow class is responsible for making calculation over a moving window of values.
Parameters: |
|
---|
Note
This is a base class and should not be used directly.
Override to calculate a value using the values in the window.
Returns a numpy.array with the values in the window.
Returns the window size.
Bases: pyalgotrade.dataseries.SequenceDataSeries
An EventBasedFilter class is responsible for capturing new values in a pyalgotrade.dataseries.DataSeries and using an EventWindow to calculate new values.
Parameters: |
|
---|
The following example shows how to combine an EventWindow and an EventBasedFilter to build a custom filter:
from __future__ import print_function
from pyalgotrade import dataseries
from pyalgotrade import technical
# An EventWindow is responsible for making calculations using a window of values.
class Accumulator(technical.EventWindow):
def getValue(self):
ret = None
if self.windowFull():
ret = self.getValues().sum()
return ret
# Build a sequence based DataSeries.
seqDS = dataseries.SequenceDataSeries()
# Wrap it with a filter that will get fed as new values get added to the underlying DataSeries.
accum = technical.EventBasedFilter(seqDS, Accumulator(3))
# Put in some values.
for i in range(0, 50):
seqDS.append(i)
# Get some values.
print(accum[0]) # Not enough values yet.
print(accum[1]) # Not enough values yet.
print(accum[2]) # Ok, now we should have at least 3 values.
print(accum[3])
# Get the last value, which should be equal to 49 + 48 + 47.
print(accum[-1])
The output should be:
None
None
3.0
6.0
144.0
Bases: pyalgotrade.technical.EventBasedFilter
Simple Moving Average filter.
Parameters: |
|
---|
Bases: pyalgotrade.technical.EventBasedFilter
Exponential Moving Average filter.
Parameters: |
|
---|
Bases: pyalgotrade.technical.EventBasedFilter
Weighted Moving Average filter.
Parameters: |
|
---|
Bases: pyalgotrade.technical.EventBasedFilter
Volume Weighted Average Price filter.
Parameters: |
|
---|
Bases: pyalgotrade.dataseries.SequenceDataSeries
Moving Average Convergence-Divergence indicator as described in http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:moving_average_convergence_divergence_macd.
Parameters: |
|
---|
Returns a pyalgotrade.dataseries.DataSeries with the histogram (the difference between the MACD and the Signal).
Returns a pyalgotrade.dataseries.DataSeries with the EMA over the MACD.
Bases: pyalgotrade.technical.EventBasedFilter
Relative Strength Index filter as described in http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:relative_strength_index_rsi.
Parameters: |
|
---|
Bases: pyalgotrade.technical.EventBasedFilter
Fast Stochastic Oscillator filter as described in http://stockcharts.com/school/doku.php?st=stochastic+oscillator&id=chart_school:technical_indicators:stochastic_oscillator_fast_slow_and_full. Note that the value returned by this filter is %K. To access %D use getD().
Parameters: |
|
---|
Returns a pyalgotrade.dataseries.DataSeries with the %D values.
Bases: pyalgotrade.technical.EventBasedFilter
Rate of change filter as described in http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:rate_of_change_roc_and_momentum.
Parameters: |
|
---|
Bases: pyalgotrade.technical.EventBasedFilter
Average True Range filter as described in http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:average_true_range_atr
Parameters: |
|
---|
Bases: object
Bollinger Bands filter as described in http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:bollinger_bands.
Parameters: |
|
---|
Returns the lower band as a pyalgotrade.dataseries.DataSeries.
Returns the middle band as a pyalgotrade.dataseries.DataSeries.
Returns the upper band as a pyalgotrade.dataseries.DataSeries.
Checks for a cross above conditions over the specified period between two DataSeries objects.
It returns the number of times values1 crossed above values2 during the given period.
Parameters: |
|
---|
Note
The default start and end values check for cross above conditions over the last 2 values.
Checks for a cross below conditions over the specified period between two DataSeries objects.
It returns the number of times values1 crossed below values2 during the given period.
Parameters: |
|
---|
Note
The default start and end values check for cross below conditions over the last 2 values.
Bases: pyalgotrade.technical.EventBasedFilter
This filter calculates cumulative returns over another dataseries.
Parameters: |
|
---|
Bases: pyalgotrade.technical.EventBasedFilter
This filter calculates the highest value.
Parameters: |
|
---|
Bases: pyalgotrade.technical.EventBasedFilter
This filter calculates the lowest value.
Parameters: |
|
---|
Bases: pyalgotrade.technical.EventBasedFilter
Hurst exponent filter.
Parameters: |
|
---|
Bases: object
A line in a line break chart.
The datetime.
The high value.
The low value.
True if the line is black (falling prices).
True if the line is white (rising prices).
Bases: pyalgotrade.dataseries.SequenceDataSeries
Line Break filter as described in http://stockcharts.com/school/doku.php?id=chart_school:chart_analysis:three_line_break. . This is a DataSeries of Line instances.
Parameters: |
|
---|
Bases: pyalgotrade.technical.EventBasedFilter
Calculates values based on a least-squares regression.
Parameters: |
|
---|
Calculates the value at a given time based on the regression line.
Parameters: | dateTime (datetime.datetime.) – The datetime to calculate the value at. Will return None if there are not enough values in the underlying DataSeries. |
---|
Bases: pyalgotrade.technical.EventBasedFilter
The Slope filter calculates the slope of a least-squares regression line.
Parameters: |
|
---|
Note
This filter ignores the time elapsed between the different values.
Bases: pyalgotrade.technical.EventBasedFilter
Standard deviation filter.
Parameters: |
|
---|
Bases: pyalgotrade.technical.EventBasedFilter
Z-Score filter.
Parameters: |
|
---|