resolve_pairs_based_on_ticker(df, chain_id, exchange_slug, pair_tickers)[source]#

Resolve symbolic trading pairs to their internal integer primary key ids.

Uses pair database described DEXPair Pandas dataframe to resolve pairs to their integer ids on a single exchange.


For popular trading pairs, there will be multiple scam pairs with the same ticker name. In this case, one with the highest all-time buy volume is chosen.


Pair ids are not stable and may change long term. Always resolve pair ids before a run.


  • df (DataFrame) – DataFrame containing DEXPairs

  • chain_id (ChainId) – Blockchain the exchange is on

  • exchange_slug (str) – Symbolic exchange name

  • pair_tickers (Set[Tuple[str, str]]) – List of trading pairs as (base token, quote token) tuples. Note that giving trading pair tokens in wrong order causes pairs not to be found. If any ticker does not match it is not included in the result set.


DataFrame with filtered pairs.

Return type