npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

quantgist-js

v0.4.0

Published

Official TypeScript SDK for the QuantGist macro event API

Downloads

22

Readme

quantgist-js

npm version TypeScript License: MIT

Official TypeScript SDK for the QuantGist macro economic event API — zero runtime dependencies, dual ESM + CJS, browser-compatible.

Installation

npm install quantgist-js
# or
pnpm add quantgist-js

30-second quickstart

import { QuantGistClient } from "quantgist-js";

const client = new QuantGistClient({ apiKey: "qg_live_..." });

// Macro events
const { data, meta } = await client.getEvents({ impact: "high" });
for (const event of data) {
  console.log(`${event.release_time} | ${event.country} | ${event.title}`);
}

// Upcoming earnings
const earnings = await client.getEarningsUpcoming(10);
for (const e of earnings.data) {
  console.log(`${e.report_date} | ${e.ticker} | est EPS ${e.eps_estimate}`);
}

// Markets overview
const markets = await client.getMarketsOverview();
for (const q of markets.data) {
  console.log(`${q.symbol}: ${q.close} (${q.change_pct?.toFixed(2)}%)`);
}

// Changelog (no auth required)
const { data: log } = await client.getChangelog();
console.log(log[0].version, log[0].summary);

Get your free API key at quantgist.com/dashboard.

Macro Shortcuts

The /v1/macro/* endpoints provide trader-friendly aliases for common macro events:

const API_KEY = 'your_api_key';
const BASE = 'https://api.quantgist.com/v1';
const headers = { 'X-API-Key': API_KEY };

// Get the latest released NFP value
const nfp = await fetch(`${BASE}/macro/latest?event=NFP`, { headers }).then(r => r.json());
console.log(`NFP: ${nfp.actual} (forecast: ${nfp.forecast})`);

// Get next CPI release
const cpi = await fetch(`${BASE}/macro/upcoming?event=CPI`, { headers }).then(r => r.json());
console.log(`Next CPI: ${cpi.release_time}`);

// Get upcoming macro calendar (14 days)
const calendar = await fetch(`${BASE}/macro/calendar?events=CPI,NFP,FOMC&days=14`, { headers }).then(r => r.json());
calendar.forEach(group => console.log(`${group.event}: ${group.next_release}`));

Supported aliases: NFP, CPI, PCE, FOMC, GDP, UNEMPLOYMENT, RETAIL_SALES, PPI, ISM, ECB, HICP


Browser / Next.js usage

The SDK uses only the native fetch API — no Node.js-specific modules. It works in any modern browser, Next.js App Router client components, and Cloudflare Workers.

In browser environments you must pass apiKey explicitly (there is no process.env in the browser):

// Next.js client component
const client = new QuantGistClient({
  apiKey: process.env.NEXT_PUBLIC_QUANTGIST_API_KEY!,
});

In Node 20+ you can set the QUANTGIST_API_KEY environment variable and omit apiKey from the constructor:

// Node — reads QUANTGIST_API_KEY automatically
const client = new QuantGistClient();

API reference

new QuantGistClient(options?)

| Option | Type | Default | Description | |--------|------|---------|-------------| | apiKey | string | process.env.QUANTGIST_API_KEY | Your QuantGist API key. Required in browser environments. | | baseUrl | string | https://api.quantgist.com/v1 | Override the API base URL (useful for testing). | | timeout | number | 30000 | Request timeout in milliseconds. |

Throws AuthenticationError if no API key is found.


Macro events

| Method | Returns | Description | |--------|---------|-------------| | getEvents(params?) | Promise<EventsResponse> | Filtered, paginated macro event list. | | getEvent(id) | Promise<Event> | Single event by ID. |

getEvents params: from, to, country, currency, impact, symbol, limit, page.


Earnings

| Method | Returns | Description | |--------|---------|-------------| | getEarnings(params?) | Promise<EarningsResponse> | Filtered, cursor-paginated earnings list. | | getEarningsUpcoming(limit?) | Promise<EarningsResponse> | Next N upcoming reports. | | getEarningsForTicker(ticker, params?) | Promise<EarningsResponse> | Earnings history for one ticker. | | getEarningsSummary(ticker) | Promise<EarningsSummary> | Beat/miss/in-line counts. | | getEarningsHistory(ticker, params?) | Promise<EarningsResponse> | Paginated history — Pro+ required. | | getEarningsSurprises(limit?) | Promise<EarningsSurprise[]> | Largest cross-market EPS surprises. | | getEarningsMovers(limit?) | Promise<EarningsMover[]> | Events ranked by price/volume impact. | | getEarningsWeekCalendar() | Promise<EarningsWeekCalendar> | Week-ahead calendar grouped by day. | | getEarningsSeasonSummary() | Promise<EarningsSeasonSummary> | Index-level aggregate for current season. |

getEarnings params: ticker, from, to, sector, beat_miss, cursor, limit.

Key fields on EarningsEvent:

interface EarningsEvent {
  ticker: string;
  company_name: string;
  report_date: string;          // ISO date
  eps_estimate: number | null;
  eps_actual: number | null;
  revenue_estimate: number | null;
  revenue_actual: number | null;
  surprise_pct: number | null;
  beat_miss: "beat" | "miss" | "in-line" | null;
  sec_filing_url: string | null;        // SEC EDGAR 8-K URL
  sec_accession_number: string | null;  // e.g. "0000320193-26-000001"
  sec_filed_at: string | null;          // ISO date filed with SEC
  field_sources: Record<string, string>; // provenance per field
}

Markets

| Method | Returns | Description | |--------|---------|-------------| | getMarketsOverview() | Promise<MarketsOverviewResponse> | Major indices overview (EOD Stooq). | | getMarketsSectors() | Promise<MarketsOverviewResponse> | Sector ETF quotes. | | getMarketsCurrencies() | Promise<MarketsOverviewResponse> | Currency pair quotes. | | getMarketsCommodities() | Promise<MarketsOverviewResponse> | Commodity quotes. | | getMarketQuote(symbol) | Promise<MarketQuote> | Single symbol EOD quote. |


Changelog

| Method | Returns | Description | |--------|---------|-------------| | getChangelog() | Promise<ChangelogResponse> | Public API changelog — no elevated plan required. |

Error handling

All errors extend QuantGistError which carries a statusCode property.

import {
  QuantGistClient,
  AuthenticationError,
  RateLimitError,
  NotFoundError,
  PlanUpgradeRequired,
  QuantGistError,
} from "quantgist-js";

try {
  const { data } = await client.getEvents({ impact: "high" });
} catch (err) {
  if (err instanceof AuthenticationError) {
    // 401 — invalid or missing API key
    console.error("Check your API key");
  } else if (err instanceof RateLimitError) {
    // 429 — slow down requests
    console.error("Rate limit hit, retry later");
  } else if (err instanceof NotFoundError) {
    // 404
    console.error("Event not found");
  } else if (err instanceof PlanUpgradeRequired) {
    // 402 — feature requires a paid plan
    console.error("Upgrade at quantgist.com/pricing");
  } else if (err instanceof QuantGistError) {
    // Other API errors
    console.error(`API error ${err.statusCode}: ${err.message}`);
  }
}

Links

License

MIT — see LICENSE.