validator#

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

Module description#

Stateful data validation.

Avoid non-JSON supported types to slipping into to the state. We have some common culprits we want to catch.

Any error message contains tree presentation of the state, so you can easily locate any values that are bad, unlike with json.

Functions#

validate_nested_state_dict(d)

Validate state as serialised to a dictionary tree by dataclasses_json.

validate_state_serialisation(state)

Check that we can write the state to the disk,

validate_state_value(name, val)

Check the state value against our whitelist and blacklist.

walk(name, val, key_type)

Raise hierarchical exceptions to locate the bad key-value pair in nested data.