okama.search
- search(search_string, namespace=None, response_format='frame')
Search symbols by ticker, name, native local name, or ISIN.
When
namespaceis provided, the search is performed within the cached table returned byok.symbols_in_namespace(namespace); if that table carries alocal_namecolumn (native-language name, e.g. Cyrillic for MOEX), it is matched as well. Otherwise the query is delegated to the API search endpoint across all namespaces, which matches ticker, name, native local name (e.g. Cyrillic for MOEX, Chinese for SHG/SHE/HK), and ISIN.- Parameters:
- search_stringstr
Case-insensitive text used to match symbol names, tickers, native local names (where available), 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