Session
QuantConnect.Data.Market.Session
Session(
tick_type: TickType,
exchange_hours: SecurityExchangeHours,
symbol: Union[Symbol, str, BaseContract],
size: int = 0,
)
Bases: RollingWindow[SessionBar], IBar
Provides a rolling window of SessionBar with size 2, where <0> contains the current session values in progress (OHLCV + OpenInterest), and <1> contains the fully consolidated data of the previous trading day.
Initializes a new instance of the Session class
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tick_type
|
TickType
|
The tick type to use |
required |
exchange_hours
|
SecurityExchangeHours
|
The exchange hours |
required |
symbol
|
Union[Symbol, str, BaseContract]
|
The symbol |
required |
size
|
int
|
The number of items to hold |
0
|
open
open: float
Opening price of the session
high
high: float
High price of the session
low
low: float
Low price of the session
close
close: float
Closing price of the session
volume
volume: float
Volume traded during the session
open_interest
open_interest: float
Open Interest of the session
end_time
end_time: datetime
The end time of the session
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
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
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.
reset
reset() -> None
Resets the session
scan
scan(current_local_time: Union[datetime, date]) -> None
Scans this consolidator to see if it should emit a bar due to time passing
to_string
to_string() -> str
Returns a string representation of current session bar with OHLCV and OpenInterest values formatted. Example: "O: 101.00 H: 112.00 L: 95.00 C: 110.00 V: 1005.00 OI: 12"
update
update(data: BaseData) -> None
Updates the session with new market data and initializes the consolidator if needed
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
BaseData
|
The new data to update the session with |
required |
__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. |