Skip to content

Market Fields

Open

Bases: IndicatorBase

Open price indicator.

This indicator exposes the open price of each incoming market bar as a scalar time series. Values are stored per symbol and can be accessed historically via the indicator interface.

name property

Canonical indicator name.

Returns:

Type Description
str

Fixed identifier for the open price indicator.

Source code in src/onesecondtrader/indicators/market_fields.py
def name(self) -> str:
    """
    Canonical indicator name.

    Returns:
        Fixed identifier for the open price indicator.
    """
    return "OPEN"

_compute_indicator(incoming_bar)

Extract the open price from an incoming market bar.

Parameters:

Name Type Description Default
incoming_bar BarReceived

Market bar used as input.

required

Returns:

Type Description
float

Open price of the bar.

Source code in src/onesecondtrader/indicators/market_fields.py
def _compute_indicator(self, incoming_bar: events.market.BarReceived) -> float:
    """
    Extract the open price from an incoming market bar.

    Parameters:
        incoming_bar:
            Market bar used as input.

    Returns:
        Open price of the bar.
    """
    return incoming_bar.open

High

Bases: IndicatorBase

High price indicator.

This indicator exposes the high price of each incoming market bar as a scalar time series. Values are stored per symbol and can be accessed historically via the indicator interface.

name property

Canonical indicator name.

Returns:

Type Description
str

Fixed identifier for the high price indicator.

Source code in src/onesecondtrader/indicators/market_fields.py
def name(self) -> str:
    """
    Canonical indicator name.

    Returns:
        Fixed identifier for the high price indicator.
    """
    return "HIGH"

_compute_indicator(incoming_bar)

Extract the high price from an incoming market bar.

Parameters:

Name Type Description Default
incoming_bar BarReceived

Market bar used as input.

required

Returns:

Type Description
float

High price of the bar.

Source code in src/onesecondtrader/indicators/market_fields.py
def _compute_indicator(self, incoming_bar: events.market.BarReceived) -> float:
    """
    Extract the high price from an incoming market bar.

    Parameters:
        incoming_bar:
            Market bar used as input.

    Returns:
        High price of the bar.
    """
    return incoming_bar.high

Low

Bases: IndicatorBase

Low price indicator.

This indicator exposes the low price of each incoming market bar as a scalar time series. Values are stored per symbol and can be accessed historically via the indicator interface.

name property

Canonical indicator name.

Returns:

Type Description
str

Fixed identifier for the low price indicator.

Source code in src/onesecondtrader/indicators/market_fields.py
def name(self) -> str:
    """
    Canonical indicator name.

    Returns:
        Fixed identifier for the low price indicator.
    """
    return "LOW"

_compute_indicator(incoming_bar)

Extract the low price from an incoming market bar.

Parameters:

Name Type Description Default
incoming_bar BarReceived

Market bar used as input.

required

Returns:

Type Description
float

Low price of the bar.

Source code in src/onesecondtrader/indicators/market_fields.py
def _compute_indicator(self, incoming_bar: events.market.BarReceived) -> float:
    """
    Extract the low price from an incoming market bar.

    Parameters:
        incoming_bar:
            Market bar used as input.

    Returns:
        Low price of the bar.
    """
    return incoming_bar.low

Close

Bases: IndicatorBase

Close price indicator.

This indicator exposes the close price of each incoming market bar as a scalar time series. Values are stored per symbol and can be accessed historically via the indicator interface.

name property

Canonical indicator name.

Returns:

Type Description
str

Fixed identifier for the close price indicator.

Source code in src/onesecondtrader/indicators/market_fields.py
def name(self) -> str:
    """
    Canonical indicator name.

    Returns:
        Fixed identifier for the close price indicator.
    """
    return "CLOSE"

_compute_indicator(incoming_bar)

Extract the close price from an incoming market bar.

Parameters:

Name Type Description Default
incoming_bar BarReceived

Market bar used as input.

required

Returns:

Type Description
float

Close price of the bar.

Source code in src/onesecondtrader/indicators/market_fields.py
def _compute_indicator(self, incoming_bar: events.market.BarReceived) -> float:
    """
    Extract the close price from an incoming market bar.

    Parameters:
        incoming_bar:
            Market bar used as input.

    Returns:
        Close price of the bar.
    """
    return incoming_bar.close

Volume

Bases: IndicatorBase

Volume indicator.

This indicator exposes the traded volume of each incoming market bar as a scalar time series. Values are stored per symbol and can be accessed historically via the indicator interface. Missing volume values yield numpy.nan.

name property

Canonical indicator name.

Returns:

Type Description
str

Fixed identifier for the volume indicator.

Source code in src/onesecondtrader/indicators/market_fields.py
def name(self) -> str:
    """
    Canonical indicator name.

    Returns:
        Fixed identifier for the volume indicator.
    """
    return "VOLUME"

_compute_indicator(incoming_bar)

Extract the volume from an incoming market bar.

Parameters:

Name Type Description Default
incoming_bar BarReceived

Market bar used as input.

required

Returns:

Type Description
float

Volume of the bar, or numpy.nan if unavailable.

Source code in src/onesecondtrader/indicators/market_fields.py
def _compute_indicator(self, incoming_bar: events.market.BarReceived) -> float:
    """
    Extract the volume from an incoming market bar.

    Parameters:
        incoming_bar:
            Market bar used as input.

    Returns:
        Volume of the bar, or `numpy.nan` if unavailable.
    """
    return float(incoming_bar.volume) if incoming_bar.volume is not None else np.nan