Skip to main content

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.

Example​

from openbb import obb
obb.equity.compare.groups()
# Group by sector and analyze valuation
obb.equity.compare.groups(group='sector', metric='valuation')
# Group by industry and analyze performance
obb.equity.compare.groups(group='industry', metric='performance')
# Group by country and analyze valuation
obb.equity.compare.groups(group='country', metric='valuation')

Parameters​

NameTypeDescriptionDefaultOptional
groupstrThe group to compare - i.e., 'sector', 'industry', 'country'. Choices vary by provider.NoneTrue
metricstrThe type of metrics to compare - i.e, 'valuation', 'performance'. Choices vary by provider.NoneTrue
providerLiteral['finviz']The provider to use for the query, by default None. If None, the provider specified in defaults is selected or 'finviz' if there is no default.finvizTrue

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​

NameTypeDescription
namestrName or label of the group.