state#

tradeexecutor.state Python module in Trading Strategy framework.

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.balance_update

Balance update data.

tradeexecutor.state.blockhain_transaction

Tracking of blockchain transactions.

tradeexecutor.state.freeze

Frozen position management.

tradeexecutor.state.generic_position

Base class for trading and reserve positions.

tradeexecutor.state.identifier

Asset and trading pair identifiers.

tradeexecutor.state.metadata

Metadata describes strategy for website rendering.

tradeexecutor.state.pickle_over_json

Serialise complex Python types to JSON using pickled hex.

tradeexecutor.state.portfolio

Portfolio state management.

tradeexecutor.state.position

Trading position state info.

tradeexecutor.state.repair

Maanually repair broken states.

tradeexecutor.state.reserve

Strategy reserve currency management.

tradeexecutor.state.revaluation

Position valuation state management.

tradeexecutor.state.state

Trade executor state.

tradeexecutor.state.statistics

Various statistics calculated across portfolios and positions.

tradeexecutor.state.store

State serialisation to disk and JavaScript clients.

tradeexecutor.state.sync

"Store information about caught up chain state.

tradeexecutor.state.trade

Trade execution state info.

tradeexecutor.state.types

Type aliases for state data structures.

tradeexecutor.state.uptime

Uptime statistics.

tradeexecutor.state.validator

Stateful data validation.

tradeexecutor.state.visualisation

Visualisation of a strategy.