Core library for Showr

Usage no npm install needed!

<script type="module">
  import showrCore from 'https://cdn.skypack.dev/@showr/core';



Travis (.org) Coverage Status npm (scoped) GitHub issues npm bundle size

@showr/core is a library built with Typescript that allows you to define efficient trading strategy to gain profits during a live market. You can use and combine hundreds of technical indicators to define your strategy or you can create your own technical indicator.

Its powerful API also allows you to backtest your strategy over a historical data before putting it in action. The strongly typed Classes and API allows you to focus more on your trading strategy and worry less about the technical setup and boilerplate.


  • Use hundreds of in-built technical indicators or create your own.
  • Define trading strategies using combination of indicators, rules and configuration.
  • Backtest your trading strategy over any historical dataset.
  • Test your strategy over a live market. (In progress)


npm i --save @showr/core


yarn add @showr/core


You can import available classes and helpers from the main library.

import { Dataset, Indicator } from '@showr/core';
// or
const { Dataset, Indicator } = require('@showr/core');

See complete API documentation for all the available classes and methods.



Dataset can be created out of any data which should in a form of an array. Dataset allows you to apply indicators over each data point and you can backtest your trading strategy over any Dataset.

import { Dataset } from '@showr/core';

const ds = new Dataset([10, 12.5, 11]);

console.log(ds.value); // [{ close: 10 }, { close: 12.5 }, { close: 11 }]

You can provide an array containing any kind of objects or numbers and that will be converted into a Dataset. Learn more about Dataset in API documentation.


The outstanding advantage of this library is that you can create your own technical indicator and then use it for defining trading strategies.

All you need is to define a calculate function for the indicator you are creating and then you can apply it over your Dataset.

For example, you can create an indicator, let's say goldenR, that multiplies the quote value with golden ratio.

import { Dataset, Indicator } from '@showr/core';

const goldenR = new Indicator('goldenR', (ds: Dataset) => {
    const lastQuote = ds.at(-1);
    return lastQuote.value * 1.61;

Now create a dataset and apply the above indicator to it.

// ...
const ds = new Dataset([10, 20, 30]);

console.log(ds.quotes); // [{ close: 10, indicators: { goldenR: 16.1 }}, ... ]

// Get indicator value for the first quote
console.log(ds.at(0).getIndicator('goldenR')); // 16.1

Learn more about creating Indicators with parameters in API documentation.

Many well known indicators are provided in-built with a stand-alone library @showr/indicators and you can directly import them inside your project.

For example,

import { Dataset } from '@showr/core';
import { SMA } from '@showr/indicators';

const ds = new Dataset([10, 20, 30]);

const sma2 = new SMA('sma2', { period: 2 });

// Get sma2 value for the last quote
console.log(ds.at(-1).getIndicator('sma2')); // 25