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 at https://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 none

    • GET /profiles/{borrower}?chainId={chain_id} returns {"profile": {...}} with the borrower profile, or 404

  • The borrower’s legal name comes 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 onboarded

  • Entries 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 as None. A borrower’s deliberate removal is therefore not picked up; delete the chain’s cache file to invalidate stale text

Module Attributes

DEFAULT_API_BASE_URL

Wildcat web app API base URL, from the public app source

DEFAULT_CACHE_DURATION

How long a fetched entry is used before the scanner refreshes it.

FAILED_REFRESH_RETRY_DELAY

Prevent one failed refresh from being retried for every market in the same scan.

REQUEST_TIMEOUT

HTTP timeout for one API request, in seconds.

Functions

extract_summary_line(text)

Pick the line of borrower text that a one-sentence summary starts from.

fetch_wildcat_market_metadata(web3, ...[, ...])

Fetch a Wildcat market's description and its borrower's profile.

redirect_metadata_cache(cache_path)

Use another cache directory for metadata fetched by market adapters.

strip_markdown(text)

Remove Markdown structure markers from borrower-written text.

Classes

WildcatMarketMetadata

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: TypedDict

Offchain 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. None when the market has no description. Not verified by Wildcat.

borrower_name: Optional[str]

Borrower’s KYB-verified legal name, e.g. Wintermute Trading Ltd.

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.

Parameters

text (Optional[str]) – Borrower-written Markdown, or None.

Returns

Text without Markdown markers, or None for empty input.

Return type

Optional[str]

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 info or March 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.

Parameters

text (Optional[str]) – Borrower-written Markdown, or None.

Returns

One plain-text line for normalise_vault_short_description(), or None.

Return type

Optional[str]

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
Returns

Combined metadata. Fields are None when Wildcat has no value.

Return type

eth_defi.erc_4626.vault_protocol.wildcat.offchain_metadata.WildcatMarketMetadata