Skip to main content

earningspy-glass

The official Python client for the EarningSpy API.

Fetch a company against its peer group and turn the comparison into a chart. The API resolves every financial judgement before it reaches you; this package transmits that judgement without adding to it — it positions the marks and reads the labels, and leaves the finance to the API.

Install

pip install earningspy-glass

Python 3.10 to 3.13.

Try it, no key needed

from earningspy_glass import sample

sample().plot("grade_card").show()                            # a company vs its industry
sample("calendar").plot("bar_pctile", metric="roic_quant").show()
sample("timeline").bars("EPS").show()

The sample ships with the package. Its companies and figures are invented, and every chart says so. Live data needs an API key.

Use

from earningspy_glass import EarningSpy

es = EarningSpy()                 # reads EARNINGSPY_API_KEY from the environment
peers = es.peers("AMBA")          # the bronze view of AMBA vs its industry

peers.describe()                  # what companies and measures can I chart?
peers.plot("scatter", x="pe", y="roic").show()   # value vs quality
peers.plot("grade_card").show()                   # a report card for AMBA

describe() prints the measures you can put on a chart and — if your key is on a lower tier — what a higher tier would add.

The chart kinds

Every chart works on any measures the payload carries; run peers.describe() to see them for the company in hand.

Kind What it answers
scatter Who stands out when you plot two measures against each other
treemap The whole peer group at a glance, sized by company size
bar The peer group ranked on one measure
bar_signed Who is in the black and who is in the red
bar_pctile Every company on a common 0–100 "better" scale
radar One company's strengths and weaknesses as a shape
donut How the group divides up — by size, or by who is making money
grade_card A one-company report card, a letter grade per measure
dumbbell How a company's standing moved before vs after its report
shift_scatter Who actually gained ground on peers after reporting

dumbbell and shift_scatter need the before-and-after view: fetch with frame="delta" and a gold key.

Themes

Every chart takes theme=: "light" (the default) or "dark", or a Theme of your own, which changes every chart kind at once. Start from a built-in one and change a few fields:

from earningspy_glass import LIGHT, Theme

mine = Theme.from_base(LIGHT, name="mine", accent="#0f5753", bar_corner_radius=4)
peers.plot("scatter", x="pe", y="roic", theme=mine)

A theme holds the colours (as #rrggbb), the palettes, the fonts and the bar style. It is checked when you make it, and fonts are names of fonts already on the reader's machine: nothing is downloaded. A theme is a plain value: nothing is registered or shared, and a figure's recipe records only its name.

Dashboards in marimo

pip install "earningspy-glass[marimo]" adds chart components for marimo notebooks. A dashboard is a list of cards; each card draws its chart under a Show controls fold, with controls built from the data in hand and a Chart | Table switch:

from earningspy_glass.ui import Chart, controls_for, grid

cards = [Chart("value", "Value against quality", peers, "scatter", {"x": "pe", "y": "roic"}),
         Chart("grades", "Report card", peers, "grade_card")]
ui = controls_for(cards)     # in one cell: changing a control never fetches again
grid(cards, ui)              # in the next: one card per row

grid(cards, ui, theme=mine) draws the whole dashboard in a theme of your own.

Tiers

Live data needs a key from earningspy.ai. bronze is every company's raw values and changes; silver adds where each company stands in its industry — percentiles, grades, industry distributions and medians (bar_pctile, radar and grade_card need it) — and a live read of each company's quality; gold adds the full forward view and the before-and-after comparison. Pick a tier per call:

es.peers("AMBA")                        # bronze key
es.peers("AMBA", tier="silver")         # silver key
es.peers("AMBA", frame="delta", tier="gold")

Ask for a tier your key does not carry and you get a clear message saying so — nothing silently gives you less. Get a key at earningspy.ai.

Everything the API serves

The charts read three views: es.peers(...) (a company against its group), es.calendar(...) (a window of reports) and es.timeline(...) (a company's own quarters). The rest of the API is one call away:

es.rows("sp500", period="next_week")["data"]                 # a view's rows
es.rows("fundamentals", frame="post", ticker="AAPL")["data"] # one company's history
es.schema()["columns"]                                       # every column
es.catalog("roic")                                           # the field menu

Configuration

  • EARNINGSPY_API_KEY — your key. Or pass EarningSpy(api_key="...").
  • EARNINGSPY_API_BASE — override the API base URL (rarely needed).

Errors

Everything that goes wrong raises a readable exception rather than returning a half-answer. All of them derive from EarningSpyError:

  • AuthError — no key, or one the service does not accept.
  • TierError — the key does not carry the tier you asked for (an AuthError).
  • NotFoundError — no such company.
  • RequestError — a bad parameter or the wrong view.
  • RateLimitError — too many requests, or the quota is used up (a RequestError).
  • ServiceError — the service could not be reached or failed to answer.
  • ContractError — the API returned a shape this version cannot read.
  • ChartError — you asked a chart for something the payload does not, or cannot, provide, or for an option it does not have.

A call the service refused carries status_code and request_id: quote both when you ask for help. A throttled or briefly unavailable service is retried twice for you. A Filter built from invalid values raises Python's own ValueError or TypeError.

Your key travels in a header, only over HTTPS, and is never put in a figure, a message or a saved file.

License

The code is Apache-2.0: see LICENSE. The API's data and the EarningSpy name are not covered by it: see NOTICE. Nothing here is investment advice.

Metadata

Release files for earningspy-glass 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for earningspy-glass 0.2.0
File Size Uploaded Provenance Actions
earningspy_glass-0.2.0.tar.gz 151.1 kB With provenance Details for earningspy_glass-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for earningspy-glass 0.2.0
File Interpreter ABI Platform Actions
earningspy_glass-0.2.0-py3-none-any.whl Python 3 none any Details for earningspy_glass-0.2.0-py3-none-any.whl

Total release size: 313.6 kB

Release files / earningspy_glass-0.2.0.tar.gz

Download URL earningspy_glass-0.2.0.tar.gz
Size 151.1 kB
Tags Source
SHA-256 checksum
How to use checksums
f3fc33a078fbe3a4f3e8a254d61bbe003e829d91d596f8ed2e523a879e21e19c
BLAKE2b-256 checksum
How to use checksums
e75fc2567efbe6f91eeb6f83db642a08f0bf85e78bd8ad090cf333f86a06eb4b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Release files / earningspy_glass-0.2.0-py3-none-any.whl

Download URL earningspy_glass-0.2.0-py3-none-any.whl
Size 162.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
953b12652fcff8f9f04ca3ec5babbbe473160fdb014c23b584ad4d1d6ba82bdc
BLAKE2b-256 checksum
How to use checksums
c0d4472b9434a2c5b8a3cd254ed924410c93f66b9230e84b37d1a13c7e9c953c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Security for earningspy-glass 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for earningspy_glass-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page