npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

tulind

v0.8.20

Published

Tulip Indicators Wrapper Providing Over 100 Technical Analysis Functions

Downloads

8,788

Readme

Build Status Build Status npm

Tulip Node

Tulip Node is the official node.js wrapper for Tulip Indicators. It provides 100+ technical analysis indicator functions, such as: simple moving average, Bollinger Bands, MACD, Parabolic SAR, Stochastic Oscillator, and many more.

Installation

Installation should just be:

npm install tulind

It should work on Windows, Os X, and Linux. Node version 10, 11, 12, 13, 14 (LTS), 15 and 16 are tested and supported on each platform.

Note that pre-compiled binaries are available for Windows. For other platforms you will need a C++ build environment installed. On Linux based distributions this can be achieved by installing build-essential package.

You can force building from source with:

npm install tulind --build-from-source

If you run into problems, let me know. I want this to be easy for everyone to use.

Usage

Tulip Node is very easy to use.

var tulind = require('tulind');
console.log("Tulip Indicators version is:");
console.log(tulind.version);

In these examples, we assume you already have price data loaded such as:

//Examples assume you have some price data like this:
//Data order is from oldest to newset (index 0 is the oldest)
var open  = [4,5,5,5,4,4,4,6,6,6];
var high  = [9,7,8,7,8,8,7,7,8,7];
var low   = [1,2,3,3,2,1,2,2,2,3];
var close = [4,5,6,6,6,5,5,5,6,4];
var volume = [123,232,212,232,111,232,212,321,232,321];

Calculating a simple moving average is as easy as:

//Do a simple moving average on close prices with period of 3.
tulind.indicators.sma.indicator([close], [3], function(err, results) {
  console.log("Result of sma is:");
  console.log(results[0]);
});

Example of calculating the Stochastic Oscillator:

//Functions that take multiple inputs, options, or outputs use arrays.
//Call Stochastic Oscillator, taking 3 inputs, 3 options, and 2 outputs.
tulind.indicators.stoch.indicator([high, low, close], [5, 3, 3], function(err, results) {
  console.log("Result of stochastic oscillator is:");
  console.log(results[0]);
  console.log(results[1]);
});

It's also easy to discover argument types at run-time:

//Discover argument types at run-time:
console.log(tulind.indicators.stoch);

//Produces:
{ name: 'stoch',
  full_name: 'Stochastic Oscillator',
  type: 'indicator',
  inputs: 3,
  options: 3,
  outputs: 2,
  input_names: [ 'high', 'low', 'close' ],
  option_names: [ '%k period', '%k slowing period', '%d period' ],
  output_names: [ 'stoch_k', 'stoch_d' ],
  indicator: [Function],
  start: [Function] }

Many (most) indicators return an output array length smaller than the input length. You can get the difference like this:

console.log("Given these options, the output arrays will be this much shorter than the input arrays:");
console.log(tulind.indicators.stoch.start([5,3,3]));

Hopefully it's obvious, but you can see all the available indicators by doing:

console.log(tulind.indicators);

You can also see a full list of the available indicators on the Tulip Indicators website here.