AssetIdentifier#

tradeexecutor.state.identifier.AssetIdentifier Python class in Trading Strategy framework.

class AssetIdentifier[source]#

Bases: object

Identify a blockchain asset for trade execution.

As internal token_ids and pair_ids may be unstable, trading pairs and tokens are explicitly referred by their smart contract addresses when a strategy decision moves to the execution. We duplicate data here to make sure we have a persistent record that helps to diagnose the sisues.

__init__(chain_id, address, token_symbol, decimals, internal_id=None, info_url=None)#
Parameters:
Return type:

None

Methods

__init__(chain_id, address, token_symbol, ...)

convert_to_decimal(raw_amount)

convert_to_raw_amount(amount)

Return any amount in token native units.

from_dict(kvs, *[, infer_missing])

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

get_identifier()

Assets are identified by their smart contract address.

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

to_dict([encode_json])

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

Attributes

checksum_address

Ethereum madness.

info_url

Info page URL for this asset

internal_id

How this asset is referred in the internal database

chain_id

See https://chainlist.org/

address

Smart contract address of the asset.

token_symbol

The ticker symbol of this token.

decimals

How many tokens this decimals.

chain_id: int#

See https://chainlist.org/

address: str#

Smart contract address of the asset. Always lowercase.

token_symbol: str#

The ticker symbol of this token.

decimals: int#

How many tokens this decimals. Must be always set and non-negative.

internal_id: Optional[int] = None#

How this asset is referred in the internal database

info_url: Optional[str] = None#

Info page URL for this asset

get_identifier()[source]#

Assets are identified by their smart contract address.

Return type:

str

property checksum_address: HexAddress#

Ethereum madness.

convert_to_raw_amount(amount)[source]#

Return any amount in token native units.

Convert decimal to fixed point integer.

Parameters:

amount (Decimal) –

Return type:

int

__init__(chain_id, address, token_symbol, decimals, internal_id=None, info_url=None)#
Parameters:
Return type:

None