okama

Quick Start

  • Get information about a single asset
  • Financial Database: Tickers & Namespaces
  • Compare assets from different stock markets
  • Basic portfolio methods

Index Funds Performance

  • Tracking difference
  • Tracking Error
  • Beta
  • Correlation with index

Investment Portfolios

  • Create an investment portfolio
  • Rebalancing strategy and asset allocation
  • Risk metrics of the portfolio
  • Accumulated return, CAGR and dividend yield
  • Compare several portfolios

Main

  • Asset
  • AssetList
  • Portfolio
  • Rebalance
  • PortfolioDCF
  • MonteCarlo
  • IndexationStrategy
  • PercentageStrategy
  • TimeSeriesStrategy
  • VanguardDynamicSpending
  • CutWithdrawalsIfDrawdown
  • EfficientFrontier

Macroeconomics

  • Inflation
  • Rate
  • Indicator

Data Access & Search

  • okama.search
  • okama.symbols_in_namespace
  • okama.namespaces
okama
  • okama.search
  • View page source

okama.search

search(search_string, namespace=None, response_format='frame')

Search symbols by ticker, name, native local name, or ISIN.

When namespace is provided, the search is performed within the cached table returned by ok.symbols_in_namespace(namespace); if that table carries a local_name column (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 DataFrame when response_format='frame'.

  • Returns a JSON string in pandas records orientation when namespace is provided and response_format='json'.

  • Returns the parsed API JSON payload as a list when namespace is omitted and response_format='json'.

Raises:
ValueError

If response_format is not 'frame' or 'json'.

Examples

>>> result = ok.search("SPY", namespace="US")
>>> result.empty
False
>>> {"symbol", "ticker", "name"}.issubset(result.columns)
True
Previous Next

© Copyright 2021, MBK Development LLC.

Built with Sphinx using a theme provided by Read the Docs.