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

algierex

v1.1.0

Published

TypeScript SDK for the Algierex market data API (the Algerian exchange)

Readme

algierex (TypeScript)

TypeScript SDK for the Algierex market data API: the Algerian exchange's daily prices back to 1999, sessions, the Dzair index, the OAT yield curve, exchange rates, company events and news.

No dependencies. Uses fetch, so it runs on Node 18 or newer, Deno, Bun, and edge runtimes. Full types for every response.

Install

npm install algierex

Get a key

Create a key and choose a plan at developers.algierex.com/dashboard. Then set ALGIEREX_API_KEY, or pass apiKey.

Example

import { Algierex, PaymentRequiredError } from "algierex";

const client = new Algierex(); // reads ALGIEREX_API_KEY

try {
  await client.listTickers();
} catch (err) {
  // No active plan: choose one at developers.algierex.com/dashboard.
  if (err instanceof PaymentRequiredError) throw new Error(err.message);
  throw err;
}

// Every daily close of Saidal since 2025.
const prices = await client.getPrices("SAI", { from: "2025-01-01" });
console.log(prices.at(-1)?.close);

// The OAT yield curve on a past date.
const curve = await client.getYieldCurve({ date: "2026-09-30" });
console.log(curve.asOf, curve.fit?.rSquared ?? "not enough trades");

// Upcoming company events, in French.
for (const event of await client.getCalendar({ from: "2026-11-01", locale: "fr" })) {
  console.log(event.date, event.ticker, event.label);
}

Methods

| Method | Route | |---|---| | listTickers() | GET /tickers | | getPrices(ticker, { from, to }) | GET /prices/{ticker} | | listSessions({ market, from, to }) | GET /sessions | | getDzairIndex({ from, to }) | GET /index/dzair | | getYieldCurve({ date }) | GET /yield-curve | | listFx() | GET /fx | | getFxHistory(code, { source, from, to }) | GET /fx/{code} | | getCalendar({ from, to, ticker, locale }) | GET /calendar | | listNews({ ticker, source, from, to, locale, includeRoutine }) | GET /news | | getOrderBook({ ticker }) | GET /order-book |

Paging

Paging is automatic: list methods resolve to every row. For long histories, the iter* twin is an async iterator that yields rows as pages arrive:

for await (const day of client.iterPrices("SAI")) {
  // ...
}

pageSize (1 to 1000, default 1000) sets rows per request; the default keeps calls against your plan's limits low.

Errors

Every error is an AlgierexError with status and code:

| Class | When | |---|---| | BadRequestError | 400: a parameter is not valid | | AuthenticationError | 401: the key is missing, wrong, or revoked | | PaymentRequiredError | 402: no active plan, or the last payment failed | | PlanRequiredError | 403: the plan does not include this route (news and the order book need Business) | | NotFoundError | 404: no such security, currency, or date | | RateLimitError | 429: the plan's limit is used up; retryAfter in seconds |

On a 429 the client waits Retry-After and retries, up to maxRetries (default 3) and only for waits up to maxRetryWait seconds (default 60). new Algierex({ maxRetries: 0 }) throws at once. Server errors (5xx), timeouts (timeout: 30 seconds) and network failures throw AlgierexError and are not retried.

Webhooks

On the Business and Redistribution plans, add a webhook URL on the dashboard and we POST to it the minute a session or a pre-fixing book is published. Check each call with verifyWebhook. Pass the raw body, before any JSON parsing:

import { verifyWebhook, WebhookSignatureError } from "algierex";

// Express example: express.text({ type: "application/json" }) keeps the raw body
app.post("/hooks/algierex", express.text({ type: "application/json" }), async (req, res) => {
  try {
    const event = await verifyWebhook(req.body, req.get("Algierex-Signature") ?? "", WEBHOOK_SECRET);
    if (event.type === "session.published") {
      // fetch the new prices
    }
    res.sendStatus(200);
  } catch (err) {
    res.sendStatus(err instanceof WebhookSignatureError ? 400 : 500);
  }
});

Calls older than 5 minutes are refused (toleranceSeconds: 300).

Regenerating

This SDK is generated from the API's OpenAPI spec. From the repository root, after npm install: npm run sdk.