TypeScript SDK
Node 18 or newer, Deno, Bun and edge runtimes. Uses fetch; full types.
Install
npm install algierexThen set ALGIEREX_API_KEY to a key from the dashboard. On npm.
Example
import { Algierex, PaymentRequiredError } from "algierex";
const client = new Algierex(); // reads ALGIEREX_API_KEY
try {
const prices = await client.getPrices("SAI", { from: "2025-01-01" });
console.log(prices.at(-1)?.close);
} catch (err) {
// No active plan: choose one on the dashboard.
if (err instanceof PaymentRequiredError) console.error(err.message);
else throw err;
}
const curve = await client.getYieldCurve({ date: "2026-09-30" });
console.log(curve.asOf, curve.fit?.rSquared ?? "not enough trades");Methods
| Method | Returns |
|---|---|
| listTickers() | List securitiesGET /tickers |
| getPrices(ticker, { from, to }) | Daily prices for one securityGET /prices/{ticker} (all pages) |
| listSessions({ market, from, to }) | Market sessionsGET /sessions (all pages) |
| getDzairIndex({ from, to }) | Dzair indexGET /index/dzair (all pages) |
| getYieldCurve({ date }) | OAT yield curveGET /yield-curve |
| listFx() | Latest exchange ratesGET /fx |
| getFxHistory(code, { source, from, to }) | Exchange rate historyGET /fx/{code} (all pages) |
| getCalendar({ from, to, ticker, locale }) | Company events calendarGET /calendar (all pages) |
| listNews({ ticker, source, from, to, locale, includeRoutine }) | NewsGET /news (all pages) |
Paged methods resolve to every row. Each has an iter twin (iterPrices, iterNews, ...), an async iterator that yields rows as pages arrive.
Errors and retries
Errors are AlgierexError subclasses: BadRequestError (400), AuthenticationError (401), PaymentRequiredError (402), NotFoundError (404) and RateLimitError (429, with retryAfter).
After a 429 the client waits the Retry-After time and tries again, up to 3 times. Server errors, timeouts and network failures are not retried. Field meanings for every response are in the docs.