fintech-algorithms
Using a coding agent? Give it the skill: npx skills add IslamBaraka90/Fintech-Algorithms-Library What it does →

Earnings and Share Foundations

4 algorithms in Earnings and Per-Share Analytics · 2 with asserted arithmetic.

In this family#

  1. Stock-Split/Consolidation EPS Restatement contract

    Restates EPS for splits and consolidations across every period presented. Accounting standards require retrospective restatement — comparatives must be restated too, and a table where only the current period was adjusted is wrong in a way that looks like growth.

    restateEpsForCapitalEvents(input)
  2. Bonus-Issue EPS Restatement verified

    Restates weighted-average ordinary shares and basic EPS for bonus issues, multiplying each period by the (existing + bonus) / existing factor of every event effective after that period's basis date. All arithmetic runs in 50-significant-digit decimal with half-even rounding and the money figures come back as exact decimal strings. A contract failure is rethrown as an Error whose message begins EPS calculation failed: .

    bonusIssueEpsRestatement(input)
  3. Rights-Issue Bonus-Factor Adjustment verified

    Extracts the bonus element of a rights issue by computing the theoretical ex-rights price and the market-to-TERP adjustment factor, then restates prior-period weighted-average shares and basic EPS with it. All arithmetic runs in 50-significant-digit decimal with half-even rounding and the figures come back as exact decimal strings. A contract failure is rethrown as an Error whose message begins EPS calculation failed: .

    rightsIssueBonusFactorAdjustment(input)
  4. Basic EPS contract

    Basic earnings per share: profit attributable to ordinary shareholders over the weighted average shares outstanding. Both halves are subtler than they look — the numerator is after preference dividends, and the denominator is time-weighted, not a period-end count.

    calculateBasicEps(input)

What they share#

Every topic here is a record-transform, so once you have called one the rest follow the same shape. Import paths differ only in the final segment:

ts
import { restateEpsForCapitalEvents } from "fintech-algorithms/earnings-and-per-share-analytics/earnings-and-share-foundations/stock-split-consolidation-eps-restatement";
import { bonusIssueEpsRestatement } from "fintech-algorithms/earnings-and-per-share-analytics/earnings-and-share-foundations/bonus-issue-eps-restatement";

Read them in the order above — the sequence is pedagogical, not alphabetical.

Where this sits#

Earnings and Per-Share Analytics collects 8 algorithms across 2 families. For the concept behind this family rather than the call signatures, see the concept guides.