@alphaquant/core is a high-performance JavaScript/TypeScript package for working with tabular financial data, powered by a custom in-memory data structure inspired by Pandas but optimized for the JavaScript ecosystem.
It is built on top of TinyFrame, a lightweight, zero-dependency data engine using TypedArray
for efficient memory layout and numerical operations.
AlphaQuant's mission is to bring scalable quantitative finance tools to the JavaScript ecosystem, enabling seamless analysis, modeling, and algorithmic research in environments ranging from browsers to Node.js.
We address the lack of fast, memory-efficient tabular computation in JS, enabling developers to perform financial analytics, statistical preprocessing, and time-series transformations without switching to Python or R.
With @alphaquant/core
, you can:
- Load and preprocess financial datasets with millions of rows
- Compute rolling indicators (e.g. moving average, z-score)
- Run advanced transformations: pivoting, melting, groupBy-aggregations
- Perform statistical analysis: describe, correlation matrix, normalization
- Structure your data via chaining with a Pandas-like experience in JavaScript
- Build reusable utilities for cross-platform data pipelines (Node.js, browser)
This module is ideal for quant researchers, trading system developers, data engineers, and product teams building frontend or backend analytics tools.
We address the lack of fast, memory-efficient tabular computation in JS, enabling developers to perform financial analytics, statistical preprocessing, and time-series transformations without switching to Python or R.
@alphaquant/core
is built upon TinyFrame β a low-level, high-performance data engine chosen as the internal data representation layer for its simplicity, speed, and zero dependencies. We selected TinyFrame as the foundational layer for its:
- π₯ It is 100% written in TypeScript
- π§ Operates on
Float64Array
/Int32Array
for vectorized performance - β‘ Outperforms traditional object/array-based processing by 10β100x
- π§Ό Clean modular functions allow tree-shaking and maximum composability
TinyFrame is used under the MIT license. See full license in
LICENSE
.
Operation | @alphaquant/core | Pandas (Python) | Data-Forge (JS) | Notes |
---|---|---|---|---|
rollingMean |
β ~50ms | π’ ~5ms | β ~400ms | JS now on par with Python |
normalize |
β ~35ms | π’ ~6ms | β ~300ms | Memory: 10x more efficient |
corrMatrix |
β ~60ms | π’ ~8ms | β ~500ms | TypedArray wins |
dropNaN |
β ~20ms | π’ ~20ms | β ~100ms | Parity achieved |
All results measured on 100,000 rows Γ 10 columns. See
benchmark_tiny.js
for test script.
alphaquant-core/
βββ src/
β βββ frame/ # TinyFrame structure and primitives
β βββ methods/ # Data operations: groupBy, agg, pivot, etc.
β βββ computation/ # zscore, normalize, mean, std
β βββ AQDataFrame.ts # Chainable functional wrapper (fluent API)
βββ __test__/ # Vitest unit tests
βββ examples/ # Usage examples
βββ benchmarks/ # Benchmark suite for performance testing
βββ dist/ # Compiled output (auto-generated)
βββ package.json # npm manifest
βββ tsconfig.json # TypeScript config
βββ README.md # This file
βββ LICENSE # MIT license
βββ .github/workflows/ci.yml # GitHub Actions workflow
import { AQDataFrame } from '@alphaquant/core';
const df = new AQDataFrame({
date: ['2023-01-01', '2023-01-02'],
price: [100, 105],
volume: [1000, 1500],
});
df.setIndex('date').normalize('price').rollingMean('price', 2).dropNaN();
const stats = df.describe();
const corr = df.corrMatrix();
const grouped = df.groupByAgg(['sector'], {
price: 'mean',
volume: 'sum',
});
df.pivot('date', 'symbol', 'price');
df.melt(['date'], ['price', 'volume']);
More in examples/
We use Vitest for blazing-fast unit testing with full TypeScript + ESM support.
To run tests:
npm run test
npm run test:watch
npm run lint # Lint code with ESLint
npm run build # Build TypeScript
npm run test # Run unit tests
npm run benchmark # Run performance suite
CI/CD is automated via GitHub Actions + Changesets. See ci.yml
.
Our roadmap is focused on making @alphaquant/core
the most efficient and intuitive tool for tabular and financial computation in JavaScript:
- Full integration with TinyFrame (TypedArray backend)
- Implementation of core statistical and preprocessing functions (
src/computation
) - Fluent
AQDataFrame
API for one-liner workflows (src/AQDataFrame.ts
) - Benchmark comparisons vs Python/Pandas and JS/DataForge (
benchmarks/
) - Expand supported operations: aggregation, filtering, windowing (
src/methods
) - Optimize for 1M+ rows: memory use, GC pressure, time complexity (
benchmark_tiny.js
) - Enhance API usability: auto-chaining, defaults, type inference
- Developer ergonomics: better errors, input validation (
test/
) - Improve documentation with live-coded examples (
examples/
)
We welcome contributors of all levels π
- Fork β Branch β Code β Pull Request
- Follow Conventional Commits
- Linting, testing and CI will run on PR automatically
See CONTRIBUTING.md
for details
MIT Β© AlphaQuantJS
TinyFrame is used under MIT license β see LICENSE
Made with β€οΈ by @a3ka
If you like what we're building, please consider:
- βοΈ Starring this repository
- π¦ Sharing on Twitter / Reddit
- π¨βπ» Submitting a PR
- π¬ Giving feedback in Discussions
Together we can bring quant tools to the web.
MIT Β© AlphaQuant Authors β use freely, build boldly.