erc_4626.vault_protocol.wildcat.offchain_metadata
Documentation for eth_defi.erc_4626.vault_protocol.wildcat.offchain_metadata Python module.
Wildcat market offchain metadata.
Wildcat stores borrower profiles and market descriptions in its web app database, not onchain
We read the public Next.js app source, wildcat-app-v2 (commit
1de5d59), and use two unauthenticated, undocumented API routes athttps://app.wildcat.finance/api:GET /market-summary/{market}?chainId={chain_id}returns{"description": ...}with the borrower-written market description, or 404 when the market has noneGET /profiles/{borrower}?chainId={chain_id}returns{"profile": {...}}with the borrower profile, or 404
The borrower’s legal
namecomes from Wildcat’s KYB check and is verified. Profile descriptions, aliases, links and market descriptions are supplied by the borrower and are not verified or monitored, see how borrowers are onboardedEntries are cached in one JSON file per chain, each with its own expiry. The file is guarded by a file lock and replaced atomically, so parallel scanner threads share one copy
A failed request keeps the previously cached value and retries after
FAILED_REFRESH_RETRY_DELAY. An API omission of an entry or a field never erases a previously cached value; a 404 for an uncached entry is stored asNone. A borrower’s deliberate removal is therefore not picked up; delete the chain’s cache file to invalidate stale text
Module Attributes
Wildcat web app API base URL, from the public app source |
|
How long a fetched entry is used before the scanner refreshes it. |
|
Prevent one failed refresh from being retried for every market in the same scan. |
|
HTTP timeout for one API request, in seconds. |
Functions
|
Pick the line of borrower text that a one-sentence summary starts from. |
|
Fetch a Wildcat market's description and its borrower's profile. |
|
Use another cache directory for metadata fetched by market adapters. |
|
Remove Markdown structure markers from borrower-written text. |
Classes
Offchain metadata for one Wildcat market. |
- DEFAULT_CACHE_PATH = PosixPath('/home/runner/.tradingstrategy/cache/wildcat')
Where we cache fetched Wildcat metadata files
- DEFAULT_API_BASE_URL = 'https://app.wildcat.finance/api'
Wildcat web app API base URL, from the public app source
- DEFAULT_CACHE_DURATION = datetime.timedelta(days=2)
How long a fetched entry is used before the scanner refreshes it.
- FAILED_REFRESH_RETRY_DELAY = datetime.timedelta(seconds=3600)
Prevent one failed refresh from being retried for every market in the same scan.
- REQUEST_TIMEOUT = 30
HTTP timeout for one API request, in seconds.
- class WildcatMarketMetadata
Bases:
TypedDictOffchain metadata for one Wildcat market.
Combined from the market description and its borrower’s profile.
- market_description: Optional[str]
Borrower-written market description in Markdown.
Nonewhen the market has no description. Not verified by Wildcat.
- borrower_description: Optional[str]
Borrower-written profile description in Markdown. Not verified by Wildcat.
- __init__(*args, **kwargs)
- __new__(**kwargs)
- clear()
Remove all items from the dict.
- copy()
Return a shallow copy of the dict.
- fromkeys(value=None, /)
Create a new dictionary with keys from iterable and values set to value.
- get(key, default=None, /)
Return the value for key if key is in the dictionary, else default.
- items()
Return a set-like object providing a view on the dict’s items.
- keys()
Return a set-like object providing a view on the dict’s keys.
- pop(k[, d]) v, remove specified key and return the corresponding value.
If the key is not found, return the default if given; otherwise, raise a KeyError.
- popitem()
Remove and return a (key, value) pair as a 2-tuple.
Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.
- setdefault(key, default=None, /)
Insert key with a value of default if key is not in the dictionary.
Return the value for key if key is in the dictionary, else default.
- update([E, ]**F) None. Update D from mapping/iterable E and F.
If E is present and has a .keys() method, then does: for k in E.keys(): D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]
- values()
Return an object providing a view on the dict’s values.
- strip_markdown(text)
Remove Markdown structure markers from borrower-written text.
Headings, list bullets and
*,**and__emphasis are removed, so a summary is plain text.
- extract_summary_line(text)
Pick the line of borrower text that a one-sentence summary starts from.
Borrowers often open with a heading, a date or a link on its own line, such as
Loan market infoorMarch 25, 2026. Flattening the text would join that line to the first real sentence. Instead, use the first line that contains a sentence boundary, or the first line when none does. A line starting with a lower-case letter continues a sentence the borrower wrapped, so it is joined to the previous line first.
- redirect_metadata_cache(cache_path)
Use another cache directory for metadata fetched by market adapters.
Market adapters fetch metadata lazily with the default cache. A migration preview must not write provider caches, so it builds scanner rows inside this context with a temporary directory. Not thread-safe: use it around sequential work only.
- Parameters
cache_path (pathlib.Path) – Directory for the cache files while the context is active.
- Returns
Context manager restoring the default cache on exit.
- Return type
collections.abc.Iterator[None]
- fetch_wildcat_market_metadata(web3, market_address, borrower_address, *, now_=None, cache_path=None, api_base_url='https://app.wildcat.finance/api', max_cache_duration=datetime.timedelta(days=2))
Fetch a Wildcat market’s description and its borrower’s profile.
Reads the chain’s cache file under a file lock, refreshes expired entries from the Wildcat app API and writes the file back atomically.
- Parameters
web3 (web3.main.Web3) – Web3 connection of the market’s chain.
market_address (Union[eth_typing.evm.HexAddress, str]) – Market address.
borrower_address (Union[eth_typing.evm.HexAddress, str]) – Market
borrower()address.now – Override the current naive UTC time for testing.
cache_path (Optional[pathlib.Path]) – Directory containing Wildcat metadata cache files. Defaults to the
redirect_metadata_cache()directory, thenDEFAULT_CACHE_PATH.api_base_url (str) – Wildcat app API base URL.
max_cache_duration (datetime.timedelta) – How long a successful fetch is used.
now_ (Optional[datetime.datetime]) –
- Returns
Combined metadata. Fields are
Nonewhen Wildcat has no value.- Return type
eth_defi.erc_4626.vault_protocol.wildcat.offchain_metadata.WildcatMarketMetadata