convert_and_validate_timestamp_as_float#

API documentation for tradeexecutor.utils.timestamp.convert_and_validate_timestamp_as_float Python function.

convert_and_validate_timestamp_as_float(timestamp)[source]#

Serialise timestamp as UNIX epoch seconds UTC.

Needed when we need to have time based keys in our state, as the current JSON encoder cannot directly encode datetime.datetime keys.

Returns:

UNIX UTC timestamp

Parameters:

timestamp (Union[Timestamp, datetime]) –

Return type:

float