provide trading technical indicator values based on market data of almost crypto currency exchanges https://www.npmjs.com/package/trading-indicator
Node.js version 10 or later is required
npm install --save trading-indicator
- Parameter:
- Exchange name
- Symbol
- IsFuture exchange
let ticker = await indicators.ticker("binance", symbol, true)
The structure of a ticker is as follows:
{
'symbol': string symbol of the market ('BTC/USD', 'ETH/BTC', ...)
'info': { the original non-modified unparsed reply from exchange API },
'timestamp': int (64-bit Unix Timestamp in milliseconds since Epoch 1 Jan 1970)
'datetime': ISO8601 datetime string with milliseconds
'high': float, // highest price
'low': float, // lowest price
'bid': float, // current best bid (buy) price
'bidVolume': float, // current best bid (buy) amount (may be missing or undefined)
'ask': float, // current best ask (sell) price
'askVolume': float, // current best ask (sell) amount (may be missing or undefined)
'vwap': float, // volume weighed average price
'open': float, // opening price
'close': float, // price of last trade (closing price for current period)
'last': float, // same as `close`, duplicated for convenience
'previousClose': float, // closing price for the previous period
'change': float, // absolute change, `last - open`
'percentage': float, // relative change, `(change/open) * 100`
'average': float, // average price, `(last + open) / 2`
'baseVolume': float, // volume of base currency traded for last 24 hours
'quoteVolume': float, // volume of quote currency traded for last 24 hours
}
ADX, ATR, Bollinger bands , EMA, IchimokuCloud, MACD, MFI, OBV, RSI, SMA, Stochastic RSI, WMA
Golden cross / Death cross , RSI in overBought/overSold , Price crosses SMA/EMA
-
https://github.com/ccxt/ccxt#certified-cryptocurrency-exchanges
-
https://github.com/ccxt/ccxt#supported-cryptocurrency-exchange-markets
- 1m : 1 minute
- 5m: 5 minutes
- 15m: 15 minutes
- 30m: 30 minutes
- 45m: 45 minutes
- 1h : 1 hour
- 2h : 2 hours
- 4h : 4 hours
- 1d : 1 day
- 1w : 1 week
- 1M : 1 month
- Parameters:
- Period: integer
- Input source: "open" | "high" | "low" | "close"
- Exchange
- Ticker
- Interval
- IsFuture exchange : true if future exchange (default is false, means that spot exchange)
const atr = require('trading-indicator').atr
let atrData = await atr(14, "close", "binance", "BTC/USDT", "15m", true)
console.log(atrData[atrData.length - 1])
- Parameters:
- Period: integer
- Input source: "open" | "high" | "low" | "close"
- Exchange
- Ticker
- Interval
- IsFuture exchange : true if future exchange (default is false, means that spot exchange)
const adx = require('trading-indicator').adx
let adxData = await atr(14, "close", "binance", "BTC/USDT", "15m", true)
console.log(adxData[adxData.length - 1])
- Parameters:
- Bollinger bands period: integer
- stdDev : integer
- Input source: "open" | "high" | "low" | "close"
- Exchange
- Ticker
- Interval
- IsFuture exchange : true if future exchange (default is false, means that spot exchange)
const bb = require('trading-indicator').bb
let bbData = await bb(50, 2, "close", "binance", "BTC/USDT", "15m", true)
console.log(bbData[bbData.length - 2])
- Parameters:
- MA period: integer
- Input source: "open" | "high" | "low" | "close"
- Exchange
- Ticker
- Interval
- IsFuture exchange : true if future exchange (default is false, means that spot exchange)
const ema = require('trading-indicator').ema
let emaData = await ema(8, "close", "binance", "BTC/USDT", "15m", true)
console.log(emaData[emaData.length - 1])
- Parameters:
- conversionPeriod: integer
- basePeriod: integer
- spanPeriod: integer
- displacement: integer
- Exchange
- Ticker
- Interval
- IsFuture exchange : true if future exchange (default is false, means that spot exchange)
const ichimokuCloud = require('trading-indicator').ichimokuCloud
console.log(await ichimokuCloud(9, 26, 52, 26, 'binance', 'BTC/USDT', '1h', false))
- Parameters:
- Fast period: integer
- Slow period: integer
- Signal period: integer
- Input source: "open" | "high" | "low" | "close"
- Exchange
- Ticker
- Interval
- IsFuture exchange : true if future exchange (default is false, means that spot exchange)
const macd = require('trading-indicator').macd
console.log(await macd(12, 26, 9, "close", "binance", "BTC/USDT", "15m", true))
- Parameters:
- MFI period: integer
- Exchange
- Ticker
- Interval
- IsFuture exchange : true if future exchange (default is false, means that spot exchange)
const mfi = require('trading-indicator').mfi
console.log(await mfi(14, "binance", "BTC/USDT", "15m", true))
- Parameters:
- Exchange
- Ticker
- Interval
- IsFuture exchange : true if future exchange (default is false, means that spot exchange)
const obv = require('trading-indicator').obv
console.log(await obv("binance", "BTC/USDT", "15m", true))
- Parameters:
- RSI period: integer
- Input source: "open" | "high" | "low" | "close"
- Exchange
- Ticker
- Interval
- IsFuture exchange : true if future exchange (default is false, means that spot exchange)
const rsi = require('trading-indicator').rsi
console.log(await rsi(14, "close", "binance", "BTC/USDT", "15m", true))
- Parameters:
- MA period: integer
- Input source: "open" | "high" | "low" | "close"
- Exchange
- Ticker
- Interval
- IsFuture exchange : true if future exchange (default is false, means that spot exchange)
const sma = require('trading-indicator').sma
let smaData = await sma(8, "close", "binance", "BTC/USDT", "15m", true)
console.log(smaData[smaData.length - 1])
- Parameters:
- kPeriod: integer
- dPeriod: integer
- rsiPeriod: integer
- stochasticPeriod: integer
- Input source: "open" | "high" | "low" | "close"
- Exchange
- Ticker
- Interval
- IsFuture exchange : true if future exchange (default is false, means that spot exchange)
const stochasticRSI = require('trading-indicator').stochasticRSI
console.log(await stochasticRSI(3, 3, 14, 14, "close", "binance", "BTC/USDT", "15m", true))
- Parameters:
- MA period: integer
- Input source: "open" | "high" | "low" | "close"
- Exchange
- Ticker
- Interval
- IsFuture exchange : true if future exchange (default is false, means that spot exchange)
const wma = require('trading-indicator').wma
let wmaData = await wma(8, "close", "binance", "BTC/USDT", "15m", true)
console.log(wmaData[wmaData.length - 1])
-
Parameter:
- MA_FAST (should be 50)
- MA_SLOW (should be 200)
- Exchange name
- Symbol
- Interval
- IsFuture exchange
Sample code
alerts = require('trading-indicator').alerts await alerts.goldenCross(50, 200, 'binance', 'BTC/USDT', '1h', false) await alerts.deathCross(50, 200, 'binance', 'BTC/USDT', '1h', false) // check both golden/death cross await alerts.maCross(50, 200, 'binance', 'BTC/USDT', '1h', false) // response { goldenCross: false, deathCross: false }
-
Parameter:
- RSI Period
- OverBoughtThreshold (75)
- OverSoldThreshold (25)
- Exchange name
- Symbol
- Interval
- IsFuture exchange
Sample code
alerts = require('trading-indicator').alerts await alerts.rsiCheck(14, 75, 25, 'binance', 'BTC/USDT', '1h', false) // Test RSIcheck // { overBought: false, overSold: false, rsiVal: 27.81 }
-
Parameter:
- MA Period
- Exchange name
- Symbol
- Interval
- IsFuture exchange
Sample code
alerts = require('trading-indicator').alerts await alerts.priceCrossSMA(14, 'binance', 'BTC/USDT', '1h', false) //Test SMA cross // { cross: true, direction: 'up' } await alerts.priceCrossEMA(14, 'binance', 'BTC/USDT', '1h', false) // Test EMA cross // { cross: true, direction: 'down' }