MarketData SDK

Earning
in package
uses FormatsForDisplay

Class Earning

Represents earnings data for a stock, including fiscal information, report details, and EPS data.

Table of Contents

Properties

$currency  : string|null
$date  : Carbon
$estimated_eps  : float|null
$fiscal_quarter  : int
$fiscal_year  : int
$report_date  : Carbon
$report_time  : string
$reported_eps  : float|null
$surprise_eps  : float|null
$surprise_eps_pct  : float|null
$symbol  : string
$updated  : Carbon

Methods

__construct()  : mixed
Constructs a new Earning object with detailed earnings information.
__toString()  : string
Returns a string representation of the earnings data.
formatChange()  : string
Format a change value with sign and currency (e.g., "+$1.25" or "-$0.50").
formatCurrency()  : string
Format a float as currency (e.g., "$150.25").
formatDate()  : string
Format a Carbon date without time (e.g., "Jan 24, 2026").
formatDateTime()  : string
Format a Carbon date with time (e.g., "Jan 24, 2026 3:45 PM").
formatGreek()  : string
Format a Greek value (4 decimal places, e.g., "0.4520").
formatNumber()  : string
Format a number with commas (e.g., "15,234").
formatPercent()  : string
Format a percentage with sign (e.g., "+3.25%" or "-1.50%").
formatPercentRaw()  : string
Format a percentage that is already in percent form (e.g., "32.50%").
formatVolume()  : string
Format volume with K/M/B suffixes (e.g., "54.9M", "12.3K").

Properties

$currency

public string|null $currency

$estimated_eps

public float|null $estimated_eps

$fiscal_quarter

public int $fiscal_quarter

$fiscal_year

public int $fiscal_year

$report_date

public Carbon $report_date

$report_time

public string $report_time

$reported_eps

public float|null $reported_eps

$surprise_eps

public float|null $surprise_eps

$surprise_eps_pct

public float|null $surprise_eps_pct

Methods

__construct()

Constructs a new Earning object with detailed earnings information.

public __construct(string $symbol, int $fiscal_year, int $fiscal_quarter, Carbon $date, Carbon $report_date, string $report_time, string|null $currency, float|null $reported_eps, float|null $estimated_eps, float|null $surprise_eps, float|null $surprise_eps_pct, Carbon $updated) : mixed
Parameters
$symbol : string

The symbol of the stock.

$fiscal_year : int

The fiscal year of the earnings report. This may not always align with the calendar year.

$fiscal_quarter : int

The fiscal quarter of the earnings report. This may not always align with the calendar quarter.

$date : Carbon

The last calendar day that corresponds to this earnings report.

$report_date : Carbon

The date the earnings report was released or is projected to be released.

$report_time : string

The value will be either before market open, after market close, or during market hours.

$currency : string|null

The currency of the earnings report. May be null for future/estimated earnings reports.

$reported_eps : float|null

The earnings per share reported by the company. Earnings reported are typically non-GAAP unless the company does not report non-GAAP earnings.

$estimated_eps : float|null

The average consensus estimate by Wall Street analysts.

$surprise_eps : float|null

The difference (in earnings per share) between the estimated earnings per share and the reported earnings per share.

$surprise_eps_pct : float|null

The difference in percentage terms between the estimated EPS and the reported EPS.

$updated : Carbon

The date/time the earnings data for this ticker was last updated.

__toString()

Returns a string representation of the earnings data.

public __toString() : string
Return values
string

Human-readable earnings summary.

formatChange()

Format a change value with sign and currency (e.g., "+$1.25" or "-$0.50").

protected formatChange(float|null $value) : string
Parameters
$value : float|null

The change value to format.

Return values
string

Formatted change string or "N/A" if null.

formatCurrency()

Format a float as currency (e.g., "$150.25").

protected formatCurrency(float|null $value) : string
Parameters
$value : float|null

The value to format.

Return values
string

Formatted currency string or "N/A" if null.

formatDate()

Format a Carbon date without time (e.g., "Jan 24, 2026").

protected formatDate(Carbon|null $date) : string
Parameters
$date : Carbon|null

The date to format.

Return values
string

Formatted date string or "N/A" if null.

formatDateTime()

Format a Carbon date with time (e.g., "Jan 24, 2026 3:45 PM").

protected formatDateTime(Carbon|null $date) : string
Parameters
$date : Carbon|null

The date to format.

Return values
string

Formatted date string or "N/A" if null.

formatGreek()

Format a Greek value (4 decimal places, e.g., "0.4520").

protected formatGreek(float|null $value) : string
Parameters
$value : float|null

The Greek value to format.

Return values
string

Formatted Greek string or "N/A" if null.

formatNumber()

Format a number with commas (e.g., "15,234").

protected formatNumber(int|null $value) : string
Parameters
$value : int|null

The number to format.

Return values
string

Formatted number string or "N/A" if null.

formatPercent()

Format a percentage with sign (e.g., "+3.25%" or "-1.50%").

protected formatPercent(float|null $value) : string

Assumes input is a decimal (0.30 = 30%).

Parameters
$value : float|null

The decimal value to format as percentage.

Return values
string

Formatted percentage string or "N/A" if null.

formatPercentRaw()

Format a percentage that is already in percent form (e.g., "32.50%").

protected formatPercentRaw(float|null $value) : string

Use this for values like implied volatility that are already percentages.

Parameters
$value : float|null

The percentage value to format.

Return values
string

Formatted percentage string or "N/A" if null.

formatVolume()

Format volume with K/M/B suffixes (e.g., "54.9M", "12.3K").

protected formatVolume(int|null $value) : string
Parameters
$value : int|null

The volume to format.

Return values
string

Formatted volume string or "N/A" if null.


        
On this page

Search results