get_default_token_cache#

API documentation for tradeexecutor.ethereum.token_cache.get_default_token_cache Python function.

get_default_token_cache(cache_path=None, unit_testing=False)[source]#

Get a default token cache with common tokens pre-filled.

Parameters:
  • cache_path (pathlib.Path | None) –

    Base cache directory path. If provided, token cache will be stored at {cache_path}/eth-defi-tokens.sqlite.

    If not provided, falls back based on unit_testing flag.

  • unit_testing (bool) – If True and no cache_path provided, uses ~/.cache/trading-strategy-tests to match the path used by tradingstrategy.Client in test fixtures. This ensures test cache persistence and consistency.

Return type:

TokenDiskCache