resolve_pairs_based_on_ticker#
API documentation for tradingstrategy.pair.resolve_pairs_based_on_ticker Python function.
- resolve_pairs_based_on_ticker(df, chain_id=None, exchange_slug=None, pairs=None, sorting_criteria_by=('fee', 'buy_volume_all_time'), sorting_criteria_ascending=(True, False))[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.Warning
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.
Note
Pair ids are not stable and may change long term. Always resolve pair ids before a run.
Example:
Alternative Example:
- Parameters:
df (DataFrame) – DataFrame containing DEXPairs
chain_id (Optional[ChainId]) –
Blockchain the exchange is on.
Set None if given part of HumanReadableTradingPairDescription.
exchange_slug (Optional[str]) –
Symbolic exchange name
Set None if given part of HumanReadableTradingPairDescription.
pairs (Union[set[tuple[tradingstrategy.chain.ChainId, str, str, str] | tuple[tradingstrategy.chain.ChainId, str, str, str, int]], Collection[Union[Tuple[ChainId, str | None, str, str, float], Tuple[ChainId, str | None, 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.
See
tradingstrategy.pair.HumanReadableTradingPairDescription
.sorting_criteria_by (Tuple) – Resulting DataFrame sorting
sorting_criteria_ascending (Tuple) – Resulting DataFrame sorting
- Returns:
DataFrame with filtered pairs.
- Return type:
DataFrame