JSONFileStore#

tradeexecutor.state.store.JSONFileStore Python class in Trading Strategy framework.

class JSONFileStore[source]#

Bases: StateStore

Store the state of the executor as a JSON file.

  • Read by strategy on a startup

  • Read by webhook when asked over the API

__init__(path)[source]#
Parameters:

path (Union[Path, str]) –

Methods

__init__(path)

create(name)

Create a new state storage.

is_pristine()

State has not been written yet.

load()

Load the state from the storage.

sync(state)

Write new JSON state dump using Linux atomic file replacement.

__init__(path)[source]#
Parameters:

path (Union[Path, str]) –

is_pristine()[source]#

State has not been written yet.

Return type:

bool

load()[source]#

Load the state from the storage.

Return type:

State

sync(state)[source]#

Write new JSON state dump using Linux atomic file replacement.

Parameters:

state (State) –

create(name)[source]#

Create a new state storage.

Parameters:

name (str) – Name of the strategy this State belongs to

Return type:

State