Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update StockFinancial model (net income, EPS, and parent net income loss) #817

Merged
merged 10 commits into from
Jan 9, 2025

Conversation

justinpolygon
Copy link
Contributor

@justinpolygon justinpolygon commented Dec 24, 2024

Refactored the balance_sheet, income_statement, cash_flow_statement, and comprehensive_income sections to use typed classes and explicit fields rather than raw dictionaries. Now, each possible field from the openapi spec is represented as an optional DataPoint, ensuring we can reliably access typed data without manual dictionary lookups.

This aligns with how other APIs in the repo handle typed fields (e.g., ticker details). It provides a more user-friendly interface, improves code consistency, and reduces the risk of missing or mistyping field names. Note that fields will only be present if their values were directly reported, or if they can be computed based on other data points in the underlying data.

Each field has a direct, typed attribute (Optional[DataPoint]). If a field is absent in the API response, it gets set to None, ensuring consistent typed access. The from_dict(...) constructors build each typed object from the JSON response automatically.

Here's an example for fetching diluted_earnings_per_share and net_income_loss:

from polygon import RESTClient

client = RESTClient()  # POLYGON_API_KEY environment variable is used

financials = []
for f in client.vx.list_stock_financials("AAPL", filing_date="2024-11-01"):
    financials.append(f)

    # get diluted_earnings_per_share
    print(f.financials.income_statement.diluted_earnings_per_share)

    # get net_income_loss
    print(f.financials.income_statement.net_income_loss)

Here's the output:

$ python3 examples/rest/stocks-stock_financials.py

DataPoint(
    label="Diluted Earnings Per Share",
    order=4300,
    unit="USD / shares",
    value=6.08,
    derived_from=None,
    formula=None,
    source=None,
    xpath=None,
)
DataPoint(
    label="Net Income/Loss",
    order=3200,
    unit="USD",
    value=93736000000.0,
    derived_from=None,
    formula=None,
    source=None,
    xpath=None,
)
DataPoint(
    label="Diluted Earnings Per Share",
    order=4300,
    unit="USD / shares",
    value=6.08,
    derived_from=None,
    formula=None,
    source=None,
    xpath=None,
)
DataPoint(
    label="Net Income/Loss",
    order=3200,
    unit="USD",
    value=93736000000.0,
    derived_from=None,
    formula=None,
    source=None,
    xpath=None,
)

Here's an example of getting everything:

from polygon import RESTClient

client = RESTClient()  # POLYGON_API_KEY environment variable is used

financials = []
for f in client.vx.list_stock_financials("AAPL", filing_date="2024-11-01"):
    financials.append(f)
print(financials)

Here's the output:

$ python3 examples/rest/stocks-stock_financials.py

[
    StockFinancial(
        cik="0000320193",
        company_name="Apple Inc.",
        end_date="2024-09-28",
        filing_date="2024-11-01",
        financials=Financials(
            balance_sheet=BalanceSheet(
                assets=DataPoint(
                    label="Assets",
                    order=100,
                    unit="USD",
                    value=364980000000.0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                current_assets=DataPoint(
                    label="Current Assets",
                    order=200,
                    unit="USD",
                    value=152987000000.0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                cash=DataPoint(
                    label=None,
                    order=None,
                    unit=None,
                    value=None,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                accounts_receivable=DataPoint(
                    label=None,
                    order=None,
                    unit=None,
                    value=None,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                inventory=DataPoint(
                    label="Inventory",
                    order=230,
                    unit="USD",
                    value=7286000000.0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                prepaid_expenses=DataPoint(
                    label=None,
                    order=None,
                    unit=None,
                    value=None,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                other_current_assets=DataPoint(
                    label="Other Current Assets",
                    order=250,
                    unit="USD",
                    value=145701000000.0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                noncurrent_assets=DataPoint(
                    label="Noncurrent Assets",
                    order=300,
                    unit="USD",
                    value=211993000000.0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                long_term_investments=DataPoint(
                    label=None,
                    order=None,
                    unit=None,
                    value=None,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                fixed_assets=DataPoint(
                    label="Fixed Assets",
                    order=320,
                    unit="USD",
                    value=45680000000.0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                intangible_assets=DataPoint(
                    label=None,
                    order=None,
                    unit=None,
                    value=None,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                noncurrent_prepaid_expense=DataPoint(
                    label=None,
                    order=None,
                    unit=None,
                    value=None,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                other_noncurrent_assets=DataPoint(
                    label="Other Non-current Assets",
                    order=350,
                    unit="USD",
                    value=166313000000.0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                liabilities=DataPoint(
                    label="Liabilities",
                    order=600,
                    unit="USD",
                    value=308030000000.0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                current_liabilities=DataPoint(
                    label="Current Liabilities",
                    order=700,
                    unit="USD",
                    value=176392000000.0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                accounts_payable=DataPoint(
                    label="Accounts Payable",
                    order=710,
                    unit="USD",
                    value=68960000000.0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                interest_payable=DataPoint(
                    label=None,
                    order=None,
                    unit=None,
                    value=None,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                wages=DataPoint(
                    label=None,
                    order=None,
                    unit=None,
                    value=None,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                other_current_liabilities=DataPoint(
                    label="Other Current Liabilities",
                    order=740,
                    unit="USD",
                    value=107432000000.0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                noncurrent_liabilities=DataPoint(
                    label="Noncurrent Liabilities",
                    order=800,
                    unit="USD",
                    value=131638000000.0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                long_term_debt=DataPoint(
                    label="Long-term Debt",
                    order=810,
                    unit="USD",
                    value=96662000000.0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                other_noncurrent_liabilities=DataPoint(
                    label="Other Non-current Liabilities",
                    order=820,
                    unit="USD",
                    value=34976000000.0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                commitments_and_contingencies=DataPoint(
                    label=None,
                    order=None,
                    unit=None,
                    value=None,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                redeemable_noncontrolling_interest=DataPoint(
                    label=None,
                    order=None,
                    unit=None,
                    value=None,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                redeemable_noncontrolling_interest_common=DataPoint(
                    label=None,
                    order=None,
                    unit=None,
                    value=None,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                redeemable_noncontrolling_interest_other=DataPoint(
                    label=None,
                    order=None,
                    unit=None,
                    value=None,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                redeemable_noncontrolling_interest_preferred=DataPoint(
                    label=None,
                    order=None,
                    unit=None,
                    value=None,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                equity=DataPoint(
                    label="Equity",
                    order=1400,
                    unit="USD",
                    value=56950000000.0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                equity_attributable_to_noncontrolling_interest=DataPoint(
                    label="Equity Attributable To Noncontrolling Interest",
                    order=1500,
                    unit="USD",
                    value=0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                equity_attributable_to_parent=DataPoint(
                    label="Equity Attributable To Parent",
                    order=1600,
                    unit="USD",
                    value=56950000000.0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                temporary_equity=DataPoint(
                    label=None,
                    order=None,
                    unit=None,
                    value=None,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                temporary_equity_attributable_to_parent=DataPoint(
                    label=None,
                    order=None,
                    unit=None,
                    value=None,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                liabilities_and_equity=DataPoint(
                    label="Liabilities And Equity",
                    order=1900,
                    unit="USD",
                    value=364980000000.0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
            ),
            cash_flow_statement=CashFlowStatement(
                net_cash_flow_from_operating_activities=DataPoint(
                    label="Net Cash Flow From Operating Activities",
                    order=100,
                    unit="USD",
                    value=118254000000.0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                net_cash_flow_from_operating_activities_continuing=DataPoint(
                    label="Net Cash Flow From Operating Activities, Continuing",
                    order=200,
                    unit="USD",
                    value=118254000000.0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                net_cash_flow_from_operating_activities_discontinued=DataPoint(
                    label=None,
                    order=None,
                    unit=None,
                    value=None,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                net_cash_flow_from_investing_activities=DataPoint(
                    label="Net Cash Flow From Investing Activities",
                    order=400,
                    unit="USD",
                    value=2935000000.0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                net_cash_flow_from_investing_activities_continuing=DataPoint(
                    label="Net Cash Flow From Investing Activities, Continuing",
                    order=500,
                    unit="USD",
                    value=2935000000.0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                net_cash_flow_from_investing_activities_discontinued=DataPoint(
                    label=None,
                    order=None,
                    unit=None,
                    value=None,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                net_cash_flow_from_financing_activities=DataPoint(
                    label="Net Cash Flow From Financing Activities",
                    order=700,
                    unit="USD",
                    value=-121983000000.0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                net_cash_flow_from_financing_activities_continuing=DataPoint(
                    label="Net Cash Flow From Financing Activities, Continuing",
                    order=800,
                    unit="USD",
                    value=-121983000000.0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                net_cash_flow_from_financing_activities_discontinued=DataPoint(
                    label=None,
                    order=None,
                    unit=None,
                    value=None,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                exchange_gains_losses=DataPoint(
                    label=None,
                    order=None,
                    unit=None,
                    value=None,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                net_cash_flow=DataPoint(
                    label="Net Cash Flow",
                    order=1100,
                    unit="USD",
                    value=-794000000.0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                net_cash_flow_continuing=DataPoint(
                    label="Net Cash Flow, Continuing",
                    order=1200,
                    unit="USD",
                    value=-794000000.0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                net_cash_flow_discontinued=DataPoint(
                    label=None,
                    order=None,
                    unit=None,
                    value=None,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
            ),
            comprehensive_income=ComprehensiveIncome(
                comprehensive_income_loss=DataPoint(
                    label="Comprehensive Income/Loss",
                    order=100,
                    unit="USD",
                    value=98016000000.0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                comprehensive_income_loss_attributable_to_noncontrolling_interest=DataPoint(
                    label="Comprehensive Income/Loss Attributable To Noncontrolling Interest",
                    order=200,
                    unit="USD",
                    value=0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                comprehensive_income_loss_attributable_to_parent=DataPoint(
                    label="Comprehensive Income/Loss Attributable To Parent",
                    order=300,
                    unit="USD",
                    value=98016000000.0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                other_comprehensive_income_loss=DataPoint(
                    label="Other Comprehensive Income/Loss",
                    order=400,
                    unit="USD",
                    value=98016000000.0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                other_comprehensive_income_loss_attributable_to_noncontrolling_interest=DataPoint(
                    label=None,
                    order=None,
                    unit=None,
                    value=None,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                other_comprehensive_income_loss_attributable_to_parent=DataPoint(
                    label="Other Comprehensive Income/Loss Attributable To Parent",
                    order=600,
                    unit="USD",
                    value=4280000000.0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
            ),
            income_statement=IncomeStatement(
                revenues=DataPoint(
                    label="Revenues",
                    order=100,
                    unit="USD",
                    value=391035000000.0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                benefits_costs_expenses=DataPoint(
                    label="Benefits Costs and Expenses",
                    order=200,
                    unit="USD",
                    value=267550000000.0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                cost_of_revenue=DataPoint(
                    label="Cost Of Revenue",
                    order=300,
                    unit="USD",
                    value=210352000000.0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                cost_of_revenue_goods=DataPoint(
                    label=None,
                    order=None,
                    unit=None,
                    value=None,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                cost_of_revenue_services=DataPoint(
                    label=None,
                    order=None,
                    unit=None,
                    value=None,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                costs_and_expenses=DataPoint(
                    label="Costs And Expenses",
                    order=600,
                    unit="USD",
                    value=267550000000.0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                gross_profit=DataPoint(
                    label="Gross Profit",
                    order=800,
                    unit="USD",
                    value=180683000000.0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                gain_loss_on_sale_properties_net_tax=DataPoint(
                    label=None,
                    order=None,
                    unit=None,
                    value=None,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                nonoperating_income_loss=DataPoint(
                    label="Nonoperating Income/Loss",
                    order=900,
                    unit="USD",
                    value=269000000.0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                operating_expenses=DataPoint(
                    label="Operating Expenses",
                    order=1000,
                    unit="USD",
                    value=57467000000.0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                selling_general_and_administrative_expenses=DataPoint(
                    label="Selling, General, and Administrative Expenses",
                    order=1010,
                    unit="USD",
                    value=26097000000.0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                depreciation_and_amortization=DataPoint(
                    label=None,
                    order=None,
                    unit=None,
                    value=None,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                research_and_development=DataPoint(
                    label="Research and Development",
                    order=1030,
                    unit="USD",
                    value=31370000000.0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                other_operating_expenses=DataPoint(
                    label=None,
                    order=None,
                    unit=None,
                    value=None,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                operating_income_loss=DataPoint(
                    label="Operating Income/Loss",
                    order=1100,
                    unit="USD",
                    value=123216000000.0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                other_operating_income_expenses=DataPoint(
                    label=None,
                    order=None,
                    unit=None,
                    value=None,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                income_loss_before_equity_method_investments=DataPoint(
                    label=None,
                    order=None,
                    unit=None,
                    value=None,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                income_loss_from_continuing_operations_after_tax=DataPoint(
                    label="Income/Loss From Continuing Operations After Tax",
                    order=1400,
                    unit="USD",
                    value=93736000000.0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                income_loss_from_continuing_operations_before_tax=DataPoint(
                    label="Income/Loss From Continuing Operations Before Tax",
                    order=1500,
                    unit="USD",
                    value=123485000000.0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                income_loss_from_discontinued_operations_net_of_tax=DataPoint(
                    label=None,
                    order=None,
                    unit=None,
                    value=None,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                income_loss_from_discontinued_operations_net_of_tax_adjustment_to_prior_year_gain_loss_on_disposal=DataPoint(
                    label=None,
                    order=None,
                    unit=None,
                    value=None,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                income_loss_from_discontinued_operations_net_of_tax_during_phase_out=DataPoint(
                    label=None,
                    order=None,
                    unit=None,
                    value=None,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                income_loss_from_discontinued_operations_net_of_tax_gain_loss_on_disposal=DataPoint(
                    label=None,
                    order=None,
                    unit=None,
                    value=None,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                income_loss_from_discontinued_operations_net_of_tax_provision_for_gain_loss_on_disposal=DataPoint(
                    label=None,
                    order=None,
                    unit=None,
                    value=None,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                income_loss_from_equity_method_investments=DataPoint(
                    label=None,
                    order=None,
                    unit=None,
                    value=None,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                income_tax_expense_benefit=DataPoint(
                    label="Income Tax Expense/Benefit",
                    order=2200,
                    unit="USD",
                    value=29749000000.0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                income_tax_expense_benefit_current=DataPoint(
                    label=None,
                    order=None,
                    unit=None,
                    value=None,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                income_tax_expense_benefit_deferred=DataPoint(
                    label=None,
                    order=None,
                    unit=None,
                    value=None,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                interest_and_debt_expense=DataPoint(
                    label=None,
                    order=None,
                    unit=None,
                    value=None,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                interest_and_dividend_income_operating=DataPoint(
                    label=None,
                    order=None,
                    unit=None,
                    value=None,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                interest_expense_operating=DataPoint(
                    label=None,
                    order=None,
                    unit=None,
                    value=None,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                interest_income_expense_after_provision_for_losses=DataPoint(
                    label=None,
                    order=None,
                    unit=None,
                    value=None,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                interest_income_expense_operating_net=DataPoint(
                    label=None,
                    order=None,
                    unit=None,
                    value=None,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                noninterest_expense=DataPoint(
                    label=None,
                    order=None,
                    unit=None,
                    value=None,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                noninterest_income=DataPoint(
                    label=None,
                    order=None,
                    unit=None,
                    value=None,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                provision_for_loan_lease_and_other_losses=DataPoint(
                    label=None,
                    order=None,
                    unit=None,
                    value=None,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                net_income_loss=DataPoint(
                    label="Net Income/Loss",
                    order=3200,
                    unit="USD",
                    value=93736000000.0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                net_income_loss_attributable_to_noncontrolling_interest=DataPoint(
                    label="Net Income/Loss Attributable To Noncontrolling Interest",
                    order=3300,
                    unit="USD",
                    value=0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                net_income_loss_attributable_to_nonredeemable_noncontrolling_interest=DataPoint(
                    label=None,
                    order=None,
                    unit=None,
                    value=None,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                net_income_loss_attributable_to_parent=DataPoint(
                    label="Net Income/Loss Attributable To Parent",
                    order=3500,
                    unit="USD",
                    value=93736000000.0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                net_income_loss_attributable_to_redeemable_noncontrolling_interest=DataPoint(
                    label=None,
                    order=None,
                    unit=None,
                    value=None,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                net_income_loss_available_to_common_stockholders_basic=DataPoint(
                    label="Net Income/Loss Available To Common Stockholders, Basic",
                    order=3700,
                    unit="USD",
                    value=93736000000.0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                participating_securities_distributed_and_undistributed_earnings_loss_basic=DataPoint(
                    label="Participating Securities, Distributed And Undistributed Earnings/Loss, Basic",
                    order=3800,
                    unit="USD",
                    value=0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                undistributed_earnings_loss_allocated_to_participating_securities_basic=DataPoint(
                    label=None,
                    order=None,
                    unit=None,
                    value=None,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                preferred_stock_dividends_and_other_adjustments=DataPoint(
                    label="Preferred Stock Dividends And Other Adjustments",
                    order=3900,
                    unit="USD",
                    value=0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                basic_earnings_per_share=DataPoint(
                    label="Basic Earnings Per Share",
                    order=4200,
                    unit="USD / shares",
                    value=6.11,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                diluted_earnings_per_share=DataPoint(
                    label="Diluted Earnings Per Share",
                    order=4300,
                    unit="USD / shares",
                    value=6.08,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                basic_average_shares=DataPoint(
                    label="Basic Average Shares",
                    order=4400,
                    unit="shares",
                    value=15343783000.0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                diluted_average_shares=DataPoint(
                    label="Diluted Average Shares",
                    order=4500,
                    unit="shares",
                    value=15408095000.0,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
                common_stock_dividends=DataPoint(
                    label=None,
                    order=None,
                    unit=None,
                    value=None,
                    derived_from=None,
                    formula=None,
                    source=None,
                    xpath=None,
                ),
            ),
        ),
        fiscal_period="TTM",
        fiscal_year="2024",
        source_filing_file_url="http://api.polygon.io/v1/reference/sec/filings/0000320193-24-000123/files/aapl-20240928_htm.xml",
        source_filing_url="https://api.polygon.io/v1/reference/sec/filings/0000320193-24-000123",
        start_date="2023-10-01",
    )
]

Copy link

@penelopus penelopus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants