Technical indicators (TALib) written in typescript for deno.

Overview
description cover coverY
Technical Analysis written in Typescript for Deno
.gitbook/assets/dylan-calluy-JpflvzEl5cg-unsplash.jpeg
0

🦕 deno-talib

https://deno.land/x/talib

Installation

deno install https://deno.land/x/talib/index.ts

# or force to upgrade
deno install -f https://deno.land/x/talib/index.ts

# or specific version
deno install -f https://deno.land/x/[email protected]/index.ts

Basic Usage

import { RSI } from 'https://deno.land/x/talib/index.ts';
# or specific version 
# import { RSI } from 'https://deno.land/x/[email protected]/index.ts';

const inputRSI = {
  values : [127.75,129.02,132.75,145.40,148.98,137.52,147.38,139.05,137.23,149.30,162.45,178.95,200.35,221.90,243.23,243.52,286.42,280.27,277.35,269.02,263.23,214.90],
  period : 14
};
const expectedResult = [
    86.41,86.43,89.65,86.50,84.96,80.54,77.56,58.06
];

RSI.calculate(inputRSI)

There are three ways you can use to get the indicator results.

1. calculate

Every indicator has a static method calculate which can be used to calculate the indicator without creating an object.

import { SMA } from 'https://deno.land/x/talib/index.ts';

let prices = [1,2,3,4,5,6,7,8,9,10,12,13,15];
let period = 10;

sma({period : period, values : prices})
import { SMA } from 'https://deno.land/x/talib/index.ts';

let prices = [1,2,3,4,5,6,7,8,9,10,12,13,15];
let period = 10;

SMA.calculate({period : period, values : prices})

2. nextValue

nextValue method is used to get the next indicator value.

let sma = new SMA({period : period, values : []});
let results = [];

prices.forEach(price => {
  let result = sma.nextValue(price);
  if(result)
    results.push(result)
});

3. getResult

This a merge of calculate and nextValue. The usual use case would be

  • Initialize indicator with available price value
  • Get results for initialized values
  • Use nextValue to get next indicator values for further tick.
let sma = new SMA({period : period, values : prices});

sma.getResult(); // [5.5, 6.6, 7.7, 8.9]
sma.nextValue(16); // 10.1

Note: Calling nextValue will not update getResult() value.

Precision

This uses regular javascript numbers, so there can be rounding errors which are negligible for a technical indicators, you can set precision by using the below config. By default there is no precision set.

import talib from 'https://deno.land/x/talib/index.ts';

talib.setConfig('precision', 10);

Bullish or Bearish Indicator

Search for all bullish or bearish using

import { bullish } from 'https://deno.land/x/talib/index.ts';

const twoDayBullishInput = {
  open: [23.25,15.36],
  high: [25.10,30.87],
  close: [21.44,27.89],
  low: [20.82,14.93],
}

bullish(twoDayBullishInput) // true

Available Indicators

  • Accumulation Distribution Line (ADL)
  • Average Directional Index (ADX)
  • Average True Range (ATR)
  • Awesome Oscillator (AO)
  • Bollinger Bands (BB)
  • Commodity Channel Index (CCI)
  • Force Index (FI)
  • Know Sure Thing (KST)
  • Money Flow Index (MFI)
  • Moving Average Convergence Divergence (MACD)
  • On Balance Volume (OBV)
  • Parabolic Stop and Reverse (PSAR)
  • Rate of Change (ROC)
  • Relative Strength Index (RSI)
  • Simple Moving Average (SMA)
  • Stochastic Oscillator (KD)
  • Stochastic RSI (StochRSI)
  • Triple Exponentially Smoothed Average (TRIX)
  • Typical Price
  • Volume Weighted Average Price (VWAP)
  • Volume Profile (VP)
  • Exponential Moving Average (EMA)
  • Weighted Moving Average (WMA)
  • Wilder’s Smoothing (Smoothed Moving Average, WEMA)
  • WilliamsR (W%R)
  • Ichimoku Cloud

Other Utils

  • Average Gain
  • Average Loss
  • Cross Up
  • Cross Down
  • Cross Over
  • Highest
  • Lowest
  • Standard Deviation
  • Sum

Chart Types

  • Renko
  • Heikin-Ashi (HA)

CandleStick Pattern

  • Abandoned Baby
  • Bearish Engulfing Pattern
  • Bullish Engulfing Pattern
  • Dark Cloud Cover
  • Downside Tasuki Gap
  • Doji
  • DragonFly Doji
  • GraveStone Doji
  • Bullish Harami
  • Bearish Harami
  • Bearish Harami Cross
  • Bullish Marubozu
  • Bearish Marubozu
  • Evening Doji Star
  • Evening Star
  • Piercing Line
  • Bullish Spinning Top
  • Bearish Spinning Top
  • Morning Doji Star
  • Morning Star
  • Three Black Crows
  • Three White Soldiers
  • Bullish Hammer
  • Bearish Hammer
  • Bullish Inverted Hammer
  • Bearish Inverted Hammer
  • Hammer Pattern
  • Hammer Pattern (Unconfirmed)
  • Hanging Man
  • Hanging Man (Unconfirmed)
  • Shooting Star
  • Shooting Star (Unconfirmed)
  • Tweezer Top
  • Tweezer Bottom

Reference

Deno Url

{% embed url="https://deno.land/x/talib" %} https://deno.land/x/talib {% endembed %}

Documentation

{% embed url="https://nenjo-tsu.gitbook.io/deno-talib" %} API Documentation {% endembed %}

Contribute

Create issues about anything you want to report, change of API's, or request for adding new indicators. You can also create pull request with new indicators.

Thanks

Original node package is from anandanand84. Thanks to https://github.com/anandanand84/technicalindicators

You might also like...

Frontend of thisisbac blog. Technical stack: Next.js, ReduxToolkit, TailwindCss,...

Introduction ThisisBac frontend services are responsible for all interface actions related to ThisisBac Blog with technical stack Next.js, Redux Toolk

May 15, 2022

Frontend of ecert. Technical stack: Next.js, ReduxToolkit, TailwindCss,...

Introduction ThisisBac frontend services are responsible for all interface actions related to ThisisBac Blog with technical stack Next.js, Redux Toolk

May 15, 2022

📈 This project was developed for the XP Inc front-end technical challenge

📈 This project was developed for the XP Inc front-end technical challenge

Desafio técnico PSel - Turma XP 🚀 Esse projeto tem como objetivo desenvolver um aplicativo de investimento em ações, com algumas funcionalidades de c

Aug 11, 2022

An interactive Bitcoin tutorial for orange-pilled beginners. Illustrates technical Bitcoin concepts using JavaScript and some Bitcoin Core RPC commands. Programming experience is helpful, but not required.

An interactive Bitcoin tutorial for orange-pilled beginners. Illustrates technical Bitcoin concepts using JavaScript and some Bitcoin Core RPC commands. Programming experience is helpful, but not required.

Try Bitcoin Try Bitcoin is an interactive Bitcoin tutorial inspired by and forked from Try Regex, which is inspired by Try Ruby and Try Haskell. It il

Nov 25, 2022

This is a simple boilerplate for a Deno website, deployed with Deno Deploy.

Simple Deno Website Boilerplate This is a simple website boilerplate built using Deno and deployed using Deno Deploy. Demo at simple-deno-website-boil

Dec 3, 2022

TypeSafe MongoDB Atlas Data API SDK for Deno & Deno Deploy

Atlas SDK atlas_sdk is a TypeSafe MongoDB Atlas Data API SDK for Deno & Deno Deploy Links Docs Import Replace LATEST_VERSION with current latest versi

Dec 26, 2022

Deno bindings for yoga, using Deno FFI.

deno_yoga Deno bindings for yoga, using Deno FFI. Usage flags: --allow-ffi: Requires ffi access to "yogacore.dll", "libyogacore.so", "libyogacore.dyli

Feb 11, 2022

🛣️ A tiny and fast http request router designed for use with deno and deno deploy

Rutt Rutt is a tiny http router designed for use with deno and deno deploy. It is written in about 200 lines of code and is pretty fast, using an exte

Dec 10, 2022

A small, but powerful HTTP library for Deno & Deno Deploy, built for convenience and simplicity

A small, but powerful HTTP library for Deno & Deno Deploy, built for convenience and simplicity

Wren Wren is a small, but powerful HTTP library for Deno & Deno Deploy, built for convenience and simplicity. convenient aliases for HTTP responses au

Dec 12, 2022
Releases(0.0.10)
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
Check the strength of your password simply and quickly, and with optional UI indicators

Check the strength of your password simply and quickly, and with optional UI indicators. Lock Steel is lightweight, has no dependencies and is connected with the UI elements. Just pure CSS and VanillaJS.

Keenlabi 1 Sep 15, 2022
Fnon is a client-side JavaScript library for models, loading indicators, notifications, and alerts which makes your web projects much better.

???????? Fnon is the name of my late mother, It's an Arabic word which means Art, I created this library in honor of her name. Fnon is a client-side J

Adel N Al-Awdy 5 Sep 11, 2022
A Roblox OpenCloud API wrapper for Deno (and NodeJS) written in TypeScript.

Active Development This module is currently in active development. Nothing is going to stay consistent as it reaches a stable release. Dynablox Docs |

null 12 Oct 28, 2022
Grm is an improved Deno port of GramJS, written in TypeScript

Grm is an improved Deno port of GramJS, written in TypeScript. GramJS is a popular MTProto API Telegram client library written in JavaScript for Node.js and browsers, with its core being based on Telethon.

Dunkan 26 Dec 31, 2022
A collection of (mostly) technical things every software developer should know about

Join our community for professional Software Developers and get more control over your life and career! Every Programmer Should Know ?? A collection o

MTDV 66.6k Jan 4, 2023
A Technical Blogging Website that utilizes Notion as a CMS for ease of modification with the help of the notion-API & whose content has been rendered with next-js and react-notion-x

GDSC MCE Blogs This repo is what GDSC MCE uses to power their blogging website gdsc-mce-blogs. It uses Notion as a CMS, fetching content from Notion a

null 7 Dec 16, 2022