@axprism/sdk
v0.2.0
Published
Official JavaScript/TypeScript SDK for the AxPrism API — institutional XBRL data, Shariah compliance screening, SEC/EDGAR, ESEF, Tadawul/Bursa/IDX
Maintainers
Readme
@axprism/sdk
Official JavaScript / TypeScript SDK for the AxPrism API — institutional XBRL data, Shariah compliance screening (AAOIFI, MSCI Islamic, DJIM, FTSE, Saudi CMA), SEC/EDGAR, ESEF, EDINET, and the Tadawul / Bursa Malaysia / IDX exchanges.
Works in Node.js 18+ (native fetch) and all modern browsers. Ships with
full TypeScript types.
Installation
Coming soon to npm.
npm install @axprism/sdkwill work once the package is published. For now, build and install from a local checkout of this repo:
# Build a tarball from this SDK:
cd sdk/javascript
npm install
npm run build
npm pack # → axprism-sdk-0.2.0.tgz
# Then in your project, install that tarball:
npm install /path/to/axprism-sdk-0.2.0.tgzAuthentication
AxPrism authenticates with the X-API-Key header. Get a key at
axprism.com/keys. A public read-only demo key is
available for trying the API: axmd_demo_try_axprism_2024.
import { AxPrism } from "@axprism/sdk";
const client = new AxPrism({ apiKey: "axmd_live_..." });Quick Start
import { AxPrism } from "@axprism/sdk";
const client = new AxPrism({ apiKey: "axmd_demo_try_axprism_2024" });
// Shariah compliance
const result = await client.compliance("AAPL", { standard: "aaoifi" });
console.log(result.verdict); // "halal"
console.log(result.ratios.debt.ratio);
// Normalized financials (values are display strings — use getMetricNumber for numbers)
const fin = await client.financials("AAPL", { statement: "IS", period: "annual" });
console.log(fin.getMetric("Revenue")); // "$416,161,000,000"
console.log(fin.getMetricNumber("Revenue")); // 416161000000
// Portfolio screening
const portfolio = await client.portfolio({
items: [
{ ticker: "AAPL", weight: 35, shares: 120, dividend_per_share: 0.96 },
{ ticker: "MSFT", weight: 25, shares: 80 },
],
});
console.log(portfolio.summary.halal_weight);
console.log(portfolio.purification?.total_usd);
// International exchanges
await client.tadawul.symbols({ limit: 10 });
await client.bursa.shariah();
await client.idx.profile("BBCA");
// Disclosure / text search
await client.disclosures.search("supply chain risk", { ticker: "AAPL", forms: ["10-K"] });
await client.text.search("revenue recognition", { ticker: "MSFT" });Endpoint coverage
Typed methods cover compliance, financials, profile, screener, market data, disclosures/text, international exchanges, filings, webhooks, bulk export, coverage, and account groups. For any other endpoint use the generic escape hatch:
const data = await client.request("GET", "/api/v1/coverage/summary");
const csv = await client.requestText("/api/v1/bulk/financials.csv", { ticker: "AAPL" });Namespaces: client.disclosures, client.text, client.webhooks,
client.keys, client.tadawul, client.bursa, client.idx.
Error handling & retries
The client retries automatically on 429 (honoring Retry-After) and transient
5xx errors with exponential backoff. Configure with maxRetries and
backoffMs.
import { AxPrism, AuthError, TierError, RateLimitError, NotFoundError } from "@axprism/sdk";
const client = new AxPrism({ apiKey: "...", maxRetries: 3, backoffMs: 500 });
try {
await client.compliance("AAPL");
} catch (e) {
if (e instanceof AuthError) console.error("Invalid API key");
else if (e instanceof TierError) console.error(`Upgrade: ${e.upgradeUrl}`);
else if (e instanceof RateLimitError) console.error(`Retry after ${e.retryAfter}s`);
else if (e instanceof NotFoundError) console.error("Not found");
else throw e;
}Build from source
npm install
npm run build # tsc → dist/
npm run typecheck # type-only checkDocumentation
- API Reference: axprism.com/api-reference
- Support: [email protected]
License
MIT — see LICENSE.
