Coder Social home page Coder Social logo

askerkazan / tulipnode Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tulipcharts/tulipnode

0.0 0.0 0.0 88 KB

Tulip Node is the official node.js wrapper for Tulip Indicators. It provides over 100 technical analysis overlay and indicator functions.

Home Page: https://tulipindicators.org

License: GNU Lesser General Public License v3.0

JavaScript 100.00%

tulipnode's Introduction

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.

tulipnode's People

Contributors

codeplea avatar cschanaj avatar evanherve avatar lteacher avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.