JSONFileStore#

tradeexecutor.state.store.JSONFileStore class.

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()

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()[source]#

Create a new state storage.

Return type

State