state#

API documentation for tradeexecutor.state Python module in Trading Strategy.

Module description#

Strategy execution state.

This module defines data structures used to manage the strategy execution.

  • The internal data is a nested tree structure starting with tradeexecutor.state.state.State root class.

  • The state includes portfolios, open and closed positions, trades being currently executed, deposits and withdraws, portfolio valuation events and such.

  • The whole state must be serialisable as JSON, so that the JavaScript clients can read it.

  • The same state structure is used for both backtesting (simulation) and live trading

  • The application also internally stores its state as a flat file on the disk, see tradeexecutor.state.store

For an overview, see architecture documentation.

Submodules#

tradeexecutor.state.other_data

Storing of custom variables in the backtesting state.

tradeexecutor.state.pickle_over_json

Serialise complex Python types to JSON using pickled hex.

tradeexecutor.state.position_internal_share_price

Running state for position internal share price tracking.

tradeexecutor.state.revaluation

Position valuation state management.

tradeexecutor.state.trigger

Trigger order structure.

tradeexecutor.state.types

Type aliases for state data structures.

tradeexecutor.state.valuation

Position valuations.