Metadata#

API documentation for tradeexecutor.state.metadata.Metadata Python class in Trading Strategy framework.

class Metadata[source]#

Bases: object

Strategy metadata.

__init__(name, short_description, long_description, icon_url, started_at, executor_running, on_chain_data=<factory>, backtested_state=None, backtest_notebook=None, backtest_html=None, key_metrics_backtest_cut_off=datetime.timedelta(days=730), badges=<factory>, tags=<factory>, sort_priority=0, fees=<factory>)#
Parameters:
Return type:

None

Methods

__init__(name, short_description, ...[, ...])

create_dummy()

from_dict(kvs, *[, infer_missing])

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

has_backtest_data()

Does this strategy have backtest data available on the file system?

parse_badges_configuration(config_line)

Parse BADGES environment variable.

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

to_dict([encode_json])

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

Attributes

backtest_html

Backtest notebook .html file

backtest_notebook

Backtest notebook .ipynb file

backtested_state

The previous backtest run results for this strategy.

key_metrics_backtest_cut_off

How many days live data is collected until key metrics are switched from backtest to live trading based

sort_priority

The display priority for this strategy.

name

Strategy name

short_description

1 sentence

long_description

Multiple paragraphs.

icon_url

For <img src>

started_at

When the instance was started last time, UTC

executor_running

Is the executor main loop running or crashed.

on_chain_data

List of smart contracts and related web3 interaction information for this strategy.

badges

List of badges strategy tile can display.

tags

Tags on this strategy

fees

Fees for this strategy In the format { management_fee, trading_strategy_protocol_fee, strategy_developer_fee, }

name: str#

Strategy name

short_description: Optional[str]#

1 sentence

long_description: Optional[str]#

Multiple paragraphs.

icon_url: Optional[str]#

For <img src>

started_at: datetime#

When the instance was started last time, UTC

executor_running: bool#

Is the executor main loop running or crashed.

Use /status endpoint to get the full exception info.

Not really a part of metadata, but added here to make frontend queries faster. See also tradeexecutor.state.executor_state.ExecutorState.

on_chain_data: OnChainData#

List of smart contracts and related web3 interaction information for this strategy.

backtested_state: Optional[State] = None#

The previous backtest run results for this strategy.

Used in the web frontend to display the backtested values.

backtest_notebook: Optional[Path] = None#

Backtest notebook .ipynb file

backtest_html: Optional[Path] = None#

Backtest notebook .html file

key_metrics_backtest_cut_off: timedelta = datetime.timedelta(days=730)#

How many days live data is collected until key metrics are switched from backtest to live trading based

Two years: by default we do not show live trading metrics until the strategy has been running for long.

badges: List[str]#

List of badges strategy tile can display.

Used for the user to visualise context information about the strategy.

E.g. “metamask”, “polygon”, “eth”, “usdc”

  • For the available badges see the frontend repo.

  • Chain badge e.g. Polygon does not need to be declared as it is part of the strategh

  • Vault type. e.g. Enzyme badge is the same

  • Can contain badges like USDC

  • Some of badges are automatically derived, some are manually set.

See also tags

tags: Set[StrategyTag]#

Tags on this strategy

See also badges

sort_priority: int = 0#

The display priority for this strategy.

Higher = the strategy apppears in the frontend first.

fees: Dict[str, str]#

Fees for this strategy In the format {

management_fee, trading_strategy_protocol_fee, strategy_developer_fee,

}

has_backtest_data()[source]#

Does this strategy have backtest data available on the file system?

Return type:

bool

static parse_badges_configuration(config_line)[source]#

Parse BADGES environment variable.

Comma separated list, support whitespaces.

Parameters:

config_line (str | None) –

Return type:

List[str]

__init__(name, short_description, long_description, icon_url, started_at, executor_running, on_chain_data=<factory>, backtested_state=None, backtest_notebook=None, backtest_html=None, key_metrics_backtest_cut_off=datetime.timedelta(days=730), badges=<factory>, tags=<factory>, sort_priority=0, fees=<factory>)#
Parameters:
Return type:

None