RollingWindow
QuantConnect.Indicators.RollingWindow
RollingWindow(size: int)
Bases: Generic[QuantConnect_Indicators_RollingWindow_T], Object, IReadOnlyWindow[QuantConnect_Indicators_RollingWindow_T], Iterable[QuantConnect_Indicators_RollingWindow_T]
This is a window that allows for list access semantics,
where this<0> refers to the most recent item in the
window and this
Initializes a new RollingWindow with the specified size.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
size
|
int
|
The number of elements to store in the window |
required |
size
size: int
Gets the size of this window
count
count: int
Gets the current number of elements in this window
samples
samples: int
Gets the number of samples that have been added to this window over its lifetime
most_recently_removed
most_recently_removed: (
QuantConnect_Indicators_RollingWindow_T
)
Gets the most recently removed item from the window. This is the piece of data that just 'fell off' as a result of the most recent add. If no items have been removed, this will throw an exception.
is_ready
is_ready: bool
Gets a value indicating whether or not this window is ready, i.e, it has been filled to its capacity
__getitem__
__getitem__(
i: int,
) -> QuantConnect_Indicators_RollingWindow_T
Indexes into this window, where index 0 is the most recently entered value
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
i
|
int
|
the index, i |
required |
Returns:
| Type | Description |
|---|---|
QuantConnect_Indicators_RollingWindow_T
|
the ith most recent entry. |
__iter__
__iter__() -> (
Iterator[QuantConnect_Indicators_RollingWindow_T]
)
__setitem__
__setitem__(
i: int, value: QuantConnect_Indicators_RollingWindow_T
) -> None
Indexes into this window, where index 0 is the most recently entered value
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
i
|
int
|
the index, i |
required |
Returns:
| Type | Description |
|---|---|
None
|
the ith most recent entry. |
add
add(item: QuantConnect_Indicators_RollingWindow_T) -> None
Adds an item to this window and shifts all other elements
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
item
|
QuantConnect_Indicators_RollingWindow_T
|
The item to be added |
required |
get_enumerator
get_enumerator() -> (
IEnumerator[QuantConnect_Indicators_RollingWindow_T]
)
Returns an enumerator that iterates through the collection.
Returns:
| Type | Description |
|---|---|
IEnumerator[QuantConnect_Indicators_RollingWindow_T]
|
A System.Collections.Generic.IEnumerator`1 that can be used to iterate through the collection. |
reset
reset() -> None
Clears this window of all data