Fundamental

The Fundamentals class provides methods to interact with various endpoints of the Alphavantage API related to fundamental financial data. Each method fetches specific financial information about a given symbol or other relevant parameters.

Methods

1. Overview

Fetches the company overview for a given symbol.

Signature:

public function overview(string $symbol): array

Parameters:

  • symbol (string): The stock symbol to fetch the overview for.

Returns:

  • array: An array containing the company overview data.

Exceptions:

  • ApiVolumeReached

  • ConnectionException

2. Income Statement

Fetches the income statement for a given symbol.

Signature:

public function incomeState(string $symbol): array

Parameters:

  • symbol (string): The stock symbol to fetch the income statement for.

Returns:

  • array: An array containing the income statement data.

Exceptions:

  • ApiVolumeReached

  • ConnectionException

3. Balance Sheet

Fetches the balance sheet for a given symbol.

Signature:

public function balanceSheet(string $symbol): array

Parameters:

  • symbol (string): The stock symbol to fetch the balance sheet for.

Returns:

  • array: An array containing the balance sheet data.

Exceptions:

  • ApiVolumeReached

  • ConnectionException

4. Cash Flow

Fetches the cash flow statement for a given symbol.

Signature:

public function cashFlow(string $symbol): array

Parameters:

  • symbol (string): The stock symbol to fetch the cash flow statement for.

Returns:

  • array: An array containing the cash flow data.

Exceptions:

  • ApiVolumeReached

  • ConnectionException

5. Earnings

Fetches the earnings report for a given symbol.

Signature:

public function earnings(string $symbol): array

Parameters:

  • symbol (string): The stock symbol to fetch the earnings report for.

Returns:

  • array: An array containing the earnings data.

Exceptions:

  • ApiVolumeReached

  • ConnectionException

6. Listing Status

Fetches the listing status of companies, either active or delisted, optionally filtered by date.

Signature:

public function listingStatus(?Carbon $date = null, string $state = 'active'): array

Parameters:

  • date (Carbon|null): Optional date to filter the listing status.

  • state (string): The listing state, either 'active' or 'delisted'.

Returns:

  • array: An array containing the listing status data.

Exceptions:

  • ApiVolumeReached

  • ConnectionException

  • InvalidArgumentException: Thrown if the state is not 'active' or 'delisted'.

7. Earnings Calendar

Fetches the earnings calendar for a given symbol over a specified number of months.

Signature:

public function earningsCalendar(?string $symbol, int $months = 3): array

Parameters:

  • symbol (string|null): The stock symbol to fetch the earnings calendar for.

  • months (int): The number of months to look ahead. Default is 3.

Returns:

  • array: An array containing the earnings calendar data.

Exceptions:

  • ApiVolumeReached

  • ConnectionException

8. IPO Calendar

Fetches the IPO calendar data.

Signature:

public function ipoCalendar(): array

Parameters:

  • None

Returns:

  • array: An array containing the IPO calendar data.

Exceptions:

  • ApiVolumeReached

  • ConnectionException


Each method in the Fundamentals class is designed to interact with a specific endpoint of the Alphavantage API, ensuring easy and efficient retrieval of financial data. Be sure to handle the possible exceptions when using these methods to ensure robust error handling in your application.

Last updated