getHistoricalFinancials method
Future<CompanyFinancials>
getHistoricalFinancials(
- String ticker, {
- int years = 10,
- bool includeQuarterly = true,
- Set<
FinancialMetric> ? metrics,
override
Fetch historical financial data for a company.
Returns structured CompanyFinancials with up to years years of data.
Set includeQuarterly to true to include Q1-Q4 data.
Implementation
@override
Future<CompanyFinancials> getHistoricalFinancials(
String ticker, {
int years = 10,
bool includeQuarterly = true,
Set<FinancialMetric>? metrics,
}) async {
final cik = await getCik(ticker);
if (cik == null) {
throw Exception('Ticker $ticker not found.');
}
final facts = await getCompanyFacts(ticker);
return _parser.parseCompanyFacts(
ticker: ticker,
cik: cik,
facts: facts,
options: FetchOptions(
years: years,
includeQuarterly: includeQuarterly,
metricsToFetch: metrics,
),
);
}