token_filter#

API documentation for tradingstrategy.utils.token_filter Python module in Trading Strategy.

Module description#

Tokens and trading pair dataset filtering.

  • Used to build a tradeable universe for all Uniswap pairs

  • Works mainly on trading pairs dataframe - see tradingstrategy.pairs

  • See also: tradingstrategy.stablecoin for different stablecoin whitelists

  • For easy filtering “give me tradeable trading pairs universe from these pairs” see filter_default()

Classes#

StablecoinFilteringMode

How to filter pairs in stablecoin filtering.

Functions#

filter_for_base_tokens(pairs, ...)

Filter dataset so that it only contains data for the trading pairs that have a certain base token.

filter_for_blacklisted_tokens(pairs, ...)

Remove blacklisted tokens from the trading pair set.

filter_for_chain(pairs, chain_id)

Extract trading pairs for specific blockchain.

filter_for_derivatives(pairs[, derivatives])

Detect derivative token.

filter_for_exchange(pairs, exchange_slug)

Extract trading pairs for specific exchange(s).

filter_for_exchange_ids(pairs, exchange_ids)

Filter dataset so that it only contains data for the trading pairs from a certain exchange.

filter_for_exchanges(pairs, exchanges)

Filter dataset so that it only contains data for the trading pairs from a certain exchange.

filter_for_nonascii_tokens(pairs)

Remove tokens with unprintable characters

filter_for_quote_tokens(pairs, ...)

Filter dataset so that it only contains data for the trading pairs that have a certain quote tokens.

filter_for_rebases(pairs[, rebase])

Detect rebase token.

filter_for_stablecoins(pairs, mode)

Filter dataset so that it only contains data for the trading pairs that are either stablecoin pairs or not.

filter_for_trading_fee(pairs, fee)

Select only pairs with a specific trading fee.

filter_pairs_default(pairs_df[, ...])

Filter out pairs that are not interested for trading.

is_derivative(token_symbol)

Identify common derivate tokens.

is_rebase(token_symbol)

Identify common rebase tokens.