PositionInternalSharePriceState#
API documentation for tradeexecutor.state.position_internal_share_price.PositionInternalSharePriceState Python class in Trading Strategy framework.
- class PositionInternalSharePriceState[source]#
Bases:
objectRunning 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()andtradeexecutor.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)#
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 (total_assets / total_supply)
Total internal shares outstanding
Cumulative quantity held (for proportion calculations on sells)
Total amount invested (for profit calculations)
Peak total supply seen (for closed position profit calc)
Initial share price (typically 1.0)
When this state was last updated
- 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)#