Skip to content

AlphaQuantJS/alphaquant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

24 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

@alphaquant/core

@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.


πŸš€ Mission

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.


🧭 What Can You Do with @alphaquant/core?

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.


πŸ” Why @alphaquant/core?

@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.


πŸ“Š Benchmark Results (vs competitors)

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.


πŸ“¦ Package Structure

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

🧠 API Highlights

Construction

import { AQDataFrame } from '@alphaquant/core';

const df = new AQDataFrame({
  date: ['2023-01-01', '2023-01-02'],
  price: [100, 105],
  volume: [1000, 1500],
});

Preprocessing

df.setIndex('date').normalize('price').rollingMean('price', 2).dropNaN();

Statistics

const stats = df.describe();
const corr = df.corrMatrix();

Grouping

const grouped = df.groupByAgg(['sector'], {
  price: 'mean',
  volume: 'sum',
});

Reshaping

df.pivot('date', 'symbol', 'price');
df.melt(['date'], ['price', 'volume']);

More in examples/


πŸ§ͺ Testing

We use Vitest for blazing-fast unit testing with full TypeScript + ESM support.

To run tests:

npm run test
npm run test:watch

πŸ§ͺ Development Workflow

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.


πŸ’Ό Roadmap

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/)

🀝 Contributing

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


πŸ“œ License

MIT Β© AlphaQuantJS

TinyFrame is used under MIT license β€” see LICENSE


πŸ§‘β€πŸ’» Developer

Made with ❀️ by @a3ka


🌟 Support the Project

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.


πŸ“œ License

MIT Β© AlphaQuant Authors β€” use freely, build boldly.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •