fintech-algorithms
324 pure functions for market and financial calculations. Plain arrays and
objects in, plain values out. Zero runtime dependencies, Node >= 22, ESM.
Non-negotiables
Four rules. Breaking any one produces output that looks right and is wrong.
- Never invent an import path, a function name, or a parameter. Every
subpath mirrors its docs URL exactly, which makes a plausible guess wrong in
a way that reads as correct. Look it up — or the
resolution order below. If the topic does not exist, say so and stop.
- Never guess a returned field name. Return-key casing is not consistent
across the library: returns , rows return
. Read the captured example output for that topic. See
.
- State the verification tier on any numeric claim. (158 topics)
means the arithmetic is replayed and asserted on every build.
(166 topics) means the signature and shape are checked but the numbers are
not attested by an independent published figure.
- Analysis, not advice. These functions compute quantities. An indicator
crossing is an observation about a series — not a prediction, not a signal,
and never a recommendation for a specific person's money. Report what was
computed, on what input, at which tier. If asked what to buy or sell, say
that is a question for a licensed adviser.
The library does not fetch data
There is no HTTP client, no vendor SDK, no API key, no
. If a task
needs prices, the caller supplies them. This is deliberate: vendor APIs get
rewritten every few years and algorithms do not.
When a user wants "live analysis", the shape is always:
their feed → their
adapter → validate → compute → report. Only the middle two steps are this
library. Load
for the adapter pattern and the
canonical
/
shapes.
Resolution order
Stop at the first step that answers the question.
- Installed package — if is a dependency, read
node_modules/fintech-algorithms/docs.json
. Every signature, contract and
worked example, no network. Prefer this. uses it
automatically.
- Domain index —
https://docs.thefintechbuilder.com/{domain-slug}/llms.txt
(3–11 KB each). The map of all thirteen is the block
at the top of ; one root fetch gives a permanent routing table.
- Topic markdown — append to any docs URL. The full contract in
3–11 KB instead of 68–114 KB of HTML.
- Full payload —
https://docs.thefintechbuilder.com/reference/payload.json
(~2.6 MB). For ingestion, not for answering one question.
Turn a docs URL into an import: swap
https://docs.thefintechbuilder.com/
for
and drop the trailing slash.
Check the installed version matches the docs with
https://docs.thefintechbuilder.com/version.json
(under 1 KB).
Workflow
1. Identify the quantity. What is actually being asked for? "Is this
overbought" → RSI. "Smooth this" → which moving average, and why that one.
2. Narrow by archetype before fetching anything. Five input shapes cover all
324 topics, and the archetype is on every index line:
| Archetype | Takes | Returns | Count |
|---|
| + numeric params | same-length array | 37 |
| + config | | 7 |
| rows | one verdict per row | 17 |
| one snapshot + decision time | one verdict | 6 |
| domain-specific | domain-specific | 257 |
is the residual bucket — read that topic's own contract.
Details and executed examples:
.
3. Read the contract. Signature, params, returns, warm-up, errors.
bash
node scripts/lookup.mjs show rsi
4. Shape the data. Map the user's payload into the documented input. Run the
boundary validator first when the input is bars, ticks or quotes.
5. Compute and report. Say what was computed, on what input, at which tier,
and how many leading values are warm-up rather than signal.
Quick start
bash
npm install fintech-algorithms
Algorithms are
subpath-only. The root export carries metadata and lookups
(
,
,
,
,
,
,
) and
re-exports no algorithm. A sibling topic's function is never re-exported from
another subpath — import each from its own.
js
import { calculateSma } from "fintech-algorithms/technical-indicators/trend-smoothing/sma";
calculateSma([44.34, 44.09, 44.15, 43.61, 44.33, 44.83], 5);
// → [null, null, null, null, 44.104, 44.202]
// ^^^^ four warm-up nulls: window - 1
The
condition resolves to the same ES module — there is no separate
CommonJS build, so
needs a runtime supporting
.
The lookup script
sits next to this file. The working directory is the user's
project, not the skill, so always invoke it by absolute path.
These files write for the directory containing this SKILL.md.
In Claude Code that is
, which the harness substitutes for
you. In any other agent, substitute the real path before running the command.
bash
node "${CLAUDE_SKILL_DIR}/scripts/lookup.mjs" search "moving average"
Commands:
| Command | Does |
|---|
| find topics by name, slug, family or entry |
| full contract, warm-up, errors, executed example |
| every topic sharing an input shape, plus its caveat |
| every topic in a domain, grouped by family |
| the thirteen domains with their index URLs |
| the reference version vs the published one |
Reads
node_modules/fintech-algorithms/docs.json
when the package is installed
anywhere above the working directory; otherwise fetches and caches the published
payload for a day. Set
to point it at a specific file.
Accepts a slug (
), a catalog id (
), a full path, or a docs URL.
If
cannot find the topic it says so rather than guessing — that failure is
the correct answer, not an obstacle to route around.
Load a reference when
- — mapping user data into an input shape, or
deciding how much adapter code a task needs.
- — the user has a provider, a CSV, a websocket or
a broker API and asks how to connect it.
- — an end-to-end task: clean a feed, build bars,
compute a multi-indicator report.
- — before finalising any numeric answer. Short,
and every entry is a real failure mode with a real cause.
Coverage
13 domains: Market Data Engineering (31) · Corporate Actions and Security Master
Data (20) · Index and Benchmark Engineering (40) · Market Breadth and Internals
(28) · Price Action and Candlesticks (38) · Technical Indicators (37) ·
Geometric Chart Patterns (27) · Statistical Time Series (29) · Market
Microstructure (29) · Matching Engines and Venue Logic (21) · Execution and
Transaction Cost Analysis (9) · Digital Assets and On-Chain Finance (10) ·
Earnings and Per-Share Analytics (5).
Not a backtester, an execution system, a portfolio manager, or a source of
market data. It computes quantities, places no orders, and holds no state
between calls.