okama.search
- search(search_string, namespace=None, response_format='frame')
Search symbols by ticker, name, or ISIN.
When
namespaceis provided, the search is performed within the cached table returned byok.symbols_in_namespace(namespace). Otherwise the query is delegated to the API search endpoint across all namespaces.- Parameters:
- search_stringstr
Case-insensitive text used to match symbol names, tickers, and ISINs.
- namespacestr, optional
Namespace code such as
"US"or"XETR". If omitted, all available namespaces are searched.- response_format{‘frame’, ‘json’}, default ‘frame’
Format of the returned search results.
- Returns:
- pandas.DataFrame or str or list
Search results.
Returns a
DataFramewhenresponse_format='frame'.Returns a JSON string in pandas
recordsorientation whennamespaceis provided andresponse_format='json'.Returns the parsed API JSON payload as a list when
namespaceis omitted andresponse_format='json'.
- Raises:
- ValueError
If
response_formatis not'frame'or'json'.
Examples
>>> result = ok.search("SPY", namespace="US") >>> result.empty False >>> {"symbol", "ticker", "name"}.issubset(result.columns) True