Fundamental data context.
Provides company profile, financial reports, analyst ratings, dividends, valuation, shareholder data, ETF asset allocation, and macroeconomic indicators / data.
All functions accept a Longbridge.Config struct and return
{:ok, data} | {:error, reason} tuples.
Usage
config = Longbridge.Config.new(...)
{:ok, profile} = Longbridge.FundamentalContext.company_profile(config, "AAPL.US")
{:ok, reports} = Longbridge.FundamentalContext.financial_reports(config, "AAPL.US")
# ETF asset allocation (holdings / regional / asset class / industry)
{:ok, etf} = Longbridge.FundamentalContext.etf_asset_allocation(config, "SPY.US")
# List macroeconomic indicators for a country
{:ok, indicators} = Longbridge.FundamentalContext.macroeconomic_indicators(config, :united_states)
# Historical data for a specific macroeconomic indicator
{:ok, macro} = Longbridge.FundamentalContext.macroeconomic(config, "CPI_YOY")
Summary
Functions
Returns the latest institutional analyst rating for a symbol.
Returns company profile / overview for a symbol.
Returns dividend history for a symbol.
Returns ETF asset allocation (holdings, regional, asset class, industry) for an ETF symbol.
Lists regulatory filings (e.g. SEC 10-K, 10-Q, insider trading forms) for a symbol.
Returns financial reports (income, balance, cash flow) for a symbol.
Historical data for a specific macroeconomic indicator.
Lists macroeconomic indicators for a country.
Returns shareholder distribution data for a symbol.
Returns valuation metrics (PE, PB, PS, etc.) for a symbol.
Compares valuation metrics (PE/PB/PS/market cap/close price)
across multiple stocks. When comparison_symbols is nil, the
server auto-selects peers from the same industry.
Functions
@spec analyst_ratings(Longbridge.Config.t(), String.t(), keyword()) :: {:ok, map()} | {:error, term()}
Returns the latest institutional analyst rating for a symbol.
@spec company_profile(Longbridge.Config.t(), String.t(), keyword()) :: {:ok, map()} | {:error, term()}
Returns company profile / overview for a symbol.
@spec dividends(Longbridge.Config.t(), String.t(), keyword()) :: {:ok, map()} | {:error, term()}
Returns dividend history for a symbol.
@spec etf_asset_allocation(Longbridge.Config.t(), String.t(), keyword()) :: {:ok, map()} | {:error, term()}
Returns ETF asset allocation (holdings, regional, asset class, industry) for an ETF symbol.
Endpoint: GET /v1/quote/etf-asset-allocation?counter_id=...
The user-supplied symbol is converted to a counter_id via
Longbridge.Symbol.to_counter_id/1.
@spec filings(Longbridge.Config.t(), String.t(), keyword()) :: {:ok, map()} | {:error, term()}
Lists regulatory filings (e.g. SEC 10-K, 10-Q, insider trading forms) for a symbol.
Endpoint: GET /v1/quote/filings?symbol=...
The response includes an items array, each with id, title,
description, file_name, file_urls, and publish_at
(Unix timestamp, seconds).
@spec financial_reports(Longbridge.Config.t(), String.t(), keyword(), keyword()) :: {:ok, map()} | {:error, term()}
Returns financial reports (income, balance, cash flow) for a symbol.
@spec macroeconomic(Longbridge.Config.t(), String.t(), keyword(), keyword()) :: {:ok, map()} | {:error, term()}
Historical data for a specific macroeconomic indicator.
Endpoint: GET /v2/quote/macrodata/{indicator_code}
Options
:indicator_code— string frommacroeconomic_indicators/2(or known external codes like"CPI_YOY"). Required.:start_date—"YYYY-MM-DD"string. Optional.:end_date—"YYYY-MM-DD"string. Optional.:offset— non_neg_integer page offset. Optional.:limit— non_neg_integer page size. Optional.
The response includes info (indicator metadata) and data (a
list of historical data points with period, actual_value,
previous_value, forecast_value, revised_value, unit,
unit_prefix, periodicity, importance, etc.).
@spec macroeconomic_indicators(Longbridge.Config.t(), keyword(), keyword()) :: {:ok, map()} | {:error, term()}
Lists macroeconomic indicators for a country.
Endpoint: GET /v2/quote/macrodata
Options
:country— atom::hong_kong | :china | :united_states | :euro_zone | :japan | :singapore. Required.:keyword— string for fuzzy name filtering. Optional.:offset— non_neg_integer page offset. Optional.:limit— non_neg_integer page size. Optional.
Mirrors MacroeconomicCountry from
longbridge/openapi/rust/src/fundamental/types.rs.
@spec valuation(Longbridge.Config.t(), String.t(), keyword()) :: {:ok, map()} | {:error, term()}
Returns valuation metrics (PE, PB, PS, etc.) for a symbol.
@spec valuation_comparison( Longbridge.Config.t(), String.t(), String.t(), [String.t()] | nil, keyword() ) :: {:ok, map()} | {:error, term()}
Compares valuation metrics (PE/PB/PS/market cap/close price)
across multiple stocks. When comparison_symbols is nil, the
server auto-selects peers from the same industry.
Endpoint: GET /v1/quote/compare/valuation?counter_id=...¤cy=...
currency is one of "USD", "HKD", "CNY".
comparison_symbols is a list of symbols to compare against
(omit for auto-selection).
Added in longbridge/openapi 4.2.0.