JSPM

  • Created
  • Published
  • Downloads 104
  • Score
    100M100P100Q65657F
  • License MIT

API for backtesting trading strategies in JavaScript and TypeScript.

Package Exports

  • grademark

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (grademark) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

grademark

API for backtesting trading strategies in JavaScript and TypeScript.

WORK IN PROGRESS

The API is fairly stable, but there are features yet to be implemented.

This API builds on Data-Forge and is best used from Data-Forge Notebook (making it easy to plot charts and visualize).

TODO: Add link here to live notebook (mean reversion strategy).

To learn more about working with data in JavaScript please read my book Data Wrangling with JavaScript.

Features

  • Define a trading strategy with entry and exit rules.
  • Backtest a trading strategy on a single instrument.
  • Apply custom indicators to your data series.
  • Specify lookback period.
  • Built-in intrabar stop loss and risk calculation.

Coming soon

  • Trailing stop loss.
  • Conditional buy on price level (intrabar).
  • Parameters
  • Optimization based on permutations of parameters.
  • Analysis
  • Charting equity curves and drawdown
  • Monte Carlo simulation
  • Walk-forward backtesting
  • Risk curve

Missing

Due to this being a simple API there is no support (at least not yet) for:

  • Fees
  • Slippage
  • Position sizing
  • Testing multiple instruments / portfolio simulation / ranking instruments.
  • Short selling.

Examples

TODO

Installation

TODO

Loading data

TODO

From REST API

TODO

From CSV file

TODO

From MongoDB

TODO

Running a backtest

TODO

Visualizating the results

TODO