PositionInternalSharePriceState#

API documentation for tradeexecutor.state.position_internal_share_price.PositionInternalSharePriceState Python class in Trading Strategy framework.

class PositionInternalSharePriceState[source]#

Bases: object

Running state for internal share price tracking.

Updated incrementally on each trade execution rather than recalculated from scratch. Follows the pattern of TradingPosition.loan.

See tradeexecutor.strategy.position_internal_share_price.create_share_price_state() and tradeexecutor.strategy.position_internal_share_price.update_share_price_state().

__init__(current_share_price, total_supply, cumulative_quantity, total_invested, peak_total_supply, initial_share_price=1.0, last_updated_at=None)#
Parameters:
Return type:

None

Methods

__init__(current_share_price, total_supply, ...)

from_dict(kvs, *[, infer_missing])

from_json(s, *[, parse_float, parse_int, ...])

schema(*[, infer_missing, only, exclude, ...])

to_dict([encode_json])

to_json(*[, skipkeys, ensure_ascii, ...])

Attributes

current_share_price

Current share price (total_assets / total_supply)

total_supply

Total internal shares outstanding

cumulative_quantity

Cumulative quantity held (for proportion calculations on sells)

total_invested

Total amount invested (for profit calculations)

peak_total_supply

Peak total supply seen (for closed position profit calc)

initial_share_price

Initial share price (typically 1.0)

last_updated_at

When this state was last updated

current_share_price: float#

Current share price (total_assets / total_supply)

total_supply: float#

Total internal shares outstanding

cumulative_quantity: float#

Cumulative quantity held (for proportion calculations on sells)

total_invested: float#

Total amount invested (for profit calculations)

peak_total_supply: float#

Peak total supply seen (for closed position profit calc)

initial_share_price: float#

Initial share price (typically 1.0)

last_updated_at: datetime.datetime | None#

When this state was last updated

__init__(current_share_price, total_supply, cumulative_quantity, total_invested, peak_total_supply, initial_share_price=1.0, last_updated_at=None)#
Parameters:
Return type:

None