groups
Get company data grouped by sector, industry or country and display either performance or valuation metrics.
Valuation metrics include price to earnings, price to book, price to sales ratios and price to cash flow. Performance metrics include the stock price change for different time periods.
Examples
from openbb import obb
obb.equity.compare.groups(provider='finviz')
# Group by sector and analyze valuation.
obb.equity.compare.groups(group='sector', metric='valuation', provider='finviz')
# Group by industry and analyze performance.
obb.equity.compare.groups(group='industry', metric='performance', provider='finviz')
# Group by country and analyze valuation.
obb.equity.compare.groups(group='country', metric='valuation', provider='finviz')
Parameters
- standard
- finviz
Name | Type | Description | Default | Optional |
---|---|---|---|---|
group | str | The group to compare - i.e., 'sector', 'industry', 'country'. Choices vary by provider. | None | True |
metric | str | The type of metrics to compare - i.e, 'valuation', 'performance'. Choices vary by provider. | None | True |
Name | Type | Description | Default | Optional |
---|---|---|---|---|
group | Literal['sector', 'industry', 'country', 'capitalization', 'energy', 'materials', 'industrials', 'consumer_cyclical', 'consumer_defensive', 'healthcare', 'financial', 'technology', 'communication_services', 'utilities', 'real_estate'] | US-listed stocks only. When a sector is selected, it is broken down by industry. The default is sector. | sector | True |
metric | Literal['performance', 'valuation', 'overview'] | Select from: performance, valuation, overview. The default is performance. | performance | True |
Returns
OBBject
results : List[CompareGroups]
Serializable results.
provider : Optional[Literal['finviz']]
Provider name.
warnings : Optional[List[Warning_]]
List of warnings.
chart : Optional[Chart]
Chart object.
extra : Dict[str, Any]
Extra info.
Data
- standard
- finviz
Name | Type | Description |
---|---|---|
name | str | Name or label of the group. |
Name | Type | Description |
---|---|---|
name | str | Name or label of the group. |
stocks | int | The number of stocks in the group. |
market_cap | int | The market cap of the group. |
performance_1d | float | The performance in the last day, as a normalized percent. |
performance_1w | float | The performance in the last week, as a normalized percent. |
performance_1m | float | The performance in the last month, as a normalized percent. |
performance_3m | float | The performance in the last quarter, as a normalized percent. |
performance_6m | float | The performance in the last half year, as a normalized percent. |
performance_1y | float | The performance in the last year, as a normalized percent. |
performance_ytd | float | The performance in the year to date, as a normalized percent. |
dividend_yield | float | The dividend yield of the group, as a normalized percent. |
pe | float | The P/E ratio of the group. |
forward_pe | float | The forward P/E ratio of the group. |
peg | float | The PEG ratio of the group. |
eps_growth_past_5y | float | The EPS growth of the group for the past 5 years, as a normalized percent. |
eps_growth_next_5y | float | The estimated EPS growth of the groupo for the next 5 years, as a normalized percent. |
sales_growth_past_5y | float | The sales growth of the group for the past 5 years, as a normalized percent. |
float_short | float | The percent of the float shorted for the group, as a normalized value. |
analyst_recommendation | float | The analyst consensus, on a scale of 1-5 where 1 is a buy and 5 is a sell. |
volume | int | The trading volume. |
volume_average | int | The 3-month average volume of the group. |
volume_relative | float | The relative volume compared to the 3-month average volume. |