Exchange information and analysis.
- class tradingstrategy.exchange.ExchangeType¶
What kind of an decentralised exchange, AMM or other the pair is trading on.
Note that each type can have multiple implementations. For example QuickSwap, Sushi and Pancake are all Uniswap v2 types.
- uniswap_v2 = 'uni_v2'¶
Uniswap v2 style exchange
- uniswap_v3 = 'uni_v3'¶
Uniswap v3 style exchange
- sushi_v3 = 'uni_v3'¶
Sushiswap v3 style exchange
- class tradingstrategy.exchange.Exchange¶
A decentralised exchange.
Each chain can have multiple active or abadon decentralised exchanges of different types, like AMM based or order book based.
The dataset server server automatically discovers exchanges and tries to add meaningful label and risk data for them.
Regarding 30d and life time stats like buy_volume_30d: These stats calculated only if exchanged deemed active and we can convert the volume to a supported quote token. Any unsupported token volume does not show up in these stats. Useful mostly for risk assessment, as this data is not accurate, but gives some reference information about the popularity of the token.
- chain_id: tradingstrategy.chain.ChainId¶
The chain id on which chain this pair is trading. 1 for Ethereum. For JSON, this is serialised as one of the name of enum memmbers of ChainId e.g. “ethereum”.
- chain_slug: str¶
The URL slug derived from the blockchain name. Used as the primary key in URLs and other user facing services.] Example: “ethereum”, “polygon”
- exchange_slug: str¶
The URL slug derived from the exchange name. Used as the primary key in URLs and other user facing addressers.
- address: tradingstrategy.types.NonChecksummedAddress¶
The factory smart contract address of Uniswap based exchanges
- last_trade_at: Optional[tradingstrategy.types.UNIXTimestamp] = None¶
When someone traded on this exchange last time
- __init__(chain_id: tradingstrategy.chain.ChainId, chain_slug: str, exchange_id: tradingstrategy.types.PrimaryKey, exchange_slug: str, address: tradingstrategy.types.NonChecksummedAddress, exchange_type: tradingstrategy.exchange.ExchangeType, pair_count: int, last_trade_at: Optional[tradingstrategy.types.UNIXTimestamp] = None, name: Optional[str] = None, buy_count_all_time: Optional[int] = None, sell_count_all_time: Optional[int] = None, buy_volume_all_time: Optional[float] = None, sell_volume_all_time: Optional[float] = None, buy_count_30d: Optional[int] = None, sell_count_30d: Optional[int] = None, buy_volume_30d: Optional[float] = None, sell_volume_30d: Optional[float] = None) None ¶
- class tradingstrategy.exchange.ExchangeUniverse¶
Contains look up for exchanges by their internal primary key ids.
- exchanges: Dict[tradingstrategy.types.PrimaryKey, tradingstrategy.exchange.Exchange]¶
Exchange id -> Exchange data mapping
- get_top_exchanges_by_30d_volume() List[tradingstrategy.exchange.Exchange] ¶
Get top exchanges sorted by their 30d volume.
Note that we consider volume only for supported quote tokens. See
tradingstrategy.exchange.Exchangefor more details.
- get_by_name_and_chain(chain_id: tradingstrategy.chain.ChainId, name: str) Optional[tradingstrategy.exchange.Exchange] ¶
Get the exchange implementation on a specific chain.
chain_id – Blockchain this exchange is on
name – Like sushiswap or uniswap v2. Case insensitive.