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
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
}
https://github.com/ccxt/ccxt#certified-cryptocurrency-exchanges
https://github.com/ccxt/ccxt#supported-cryptocurrency-exchange-markets
Parameters:
const { atr, getDetachSourceFromOHLCV } = require('trading-indicator')
const { input } = await getDetachSourceFromOHLCV('binance', 'BTC/USDT', '1h', false) // true if you want to get future market
let atrData = await atr(14, "close", input)
console.log(atrData[atrData.length - 1])
Parameters:
const { adx, getDetachSourceFromOHLCV } = require('trading-indicator')
const { input } = await getDetachSourceFromOHLCV('binance', 'BTC/USDT', '1h', false) // true if you want to get future market
let adxData = await adx(14, "close", input)
console.log(adxData[adxData.length - 1])
Parameters:
const { bb, getDetachSourceFromOHLCV } = require('trading-indicator')
const { input } = await getDetachSourceFromOHLCV('binance', 'BTC/USDT', '1h', false) // true if you want to get future market
let bbData = await bb(50, 2, "close", input)
console.log(bbData[bbData.length - 2])
const { ema, getDetachSourceFromOHLCV } = require('trading-indicator')
const { input } = await getDetachSourceFromOHLCV('binance', 'BTC/USDT', '1h', false) // true if you want to get future market
let emaData = await ema(8, "close", input)
console.log(emaData[emaData.length - 1])
Parameters:
const { ichimokuCloud, getDetachSourceFromOHLCV } = require('trading-indicator')
const { input } = await getDetachSourceFromOHLCV('binance', 'BTC/USDT', '1h', false) // true if you want to get future market
console.log(await ichimokuCloud(9, 26, 52, 26, input))
Parameters:
const { macd, getDetachSourceFromOHLCV } = require('trading-indicator')
const { input } = await getDetachSourceFromOHLCV('binance', 'BTC/USDT', '1h', false) // true if you want to get future market
console.log(await macd(12, 26, 9, "close", input))
Parameters:
const { mfi, getDetachSourceFromOHLCV } = require('trading-indicator')
const { input } = await getDetachSourceFromOHLCV('binance', 'BTC/USDT', '1h', false) // true if you want to get future market
console.log(await mfi(14, input))
Parameters:
const { cci, getDetachSourceFromOHLCV } = require('trading-indicator')
const { input } = await getDetachSourceFromOHLCV('binance', 'BTC/USDT', '1h', false) // true if you want to get future market
console.log(await cci(14, input))
Parameters:
const { vwap, getDetachSourceFromOHLCV } = require('trading-indicator')
const { input } = await getDetachSourceFromOHLCV('binance', 'BTC/USDT', '1h', false) // true if you want to get future market
console.log(await vwap(input))
Parameters:
const { obv, getDetachSourceFromOHLCV } = require('trading-indicator')
const { input } = await getDetachSourceFromOHLCV('binance', 'BTC/USDT', '1h', false) // true if you want to get future market
console.log(await obv(input))
Parameters:
const { rsi, getDetachSourceFromOHLCV } = require('trading-indicator')
const { input } = await getDetachSourceFromOHLCV('binance', 'BTC/USDT', '1h', false) // true if you want to get future market
console.log(await rsi(14, "close", input))
Parameters:
const { sma, getDetachSourceFromOHLCV } = require('trading-indicator')
const { input } = await getDetachSourceFromOHLCV('binance', 'BTC/USDT', '1h', false) // true if you want to get future market
let smaData = await sma(8, "close", input)
console.log(smaData[smaData.length - 1])
Parameters:
const { stochasticRSI, getDetachSourceFromOHLCV } = require('trading-indicator')
const { input } = await getDetachSourceFromOHLCV('binance', 'BTC/USDT', '1h', false) // true if you want to get future market
console.log(await stochasticRSI(3, 3, 14, 14, "close", input))
Parameters:
const { wma, getDetachSourceFromOHLCV } = require('trading-indicator')
const { input } = await getDetachSourceFromOHLCV('binance', 'BTC/USDT', '1h', false) // true if you want to get future market
let wmaData = await wma(8, "close", input)
console.log(wmaData[wmaData.length - 1])
Parameters:
const { kst, getDetachSourceFromOHLCV } = require('trading-indicator')
const { input } = await getDetachSourceFromOHLCV('binance', 'BTC/USDT', '1h', false) // true if you want to get future market
console.log(await kst(input, 10, 15, 20, 30, 10, 10, 10, 15, 9))
Parameter:
Input : detach from OHLCV
Sample code
const { goldenCross, deathCross, maCross, getDetachSourceFromOHLCV } = require('trading-indicator')
const { input } = await getDetachSourceFromOHLCV('binance', 'BTC/USDT', '1h', false) // true if you want to get future market
await goldenCross(50, 200, input)
await deathCross(50, 200, input)
// check both golden/death cross
await maCross(50, 200, input) // response { goldenCross: false, deathCross: false }
Parameter:
Input : detach from OHLCV
Sample code
const { rsiCheck, getDetachSourceFromOHLCV } = require('trading-indicator')
const { input } = await getDetachSourceFromOHLCV('binance', 'BTC/USDT', '1h', false) // true if you want to get future market
await rsiCheck(14, 75, 25, input)
// Test RSIcheck
// { overBought: false, overSold: false, rsiVal: 27.81 }
Parameter:
Input : detach from OHLCV
Sample code
const { priceCrossSMA, priceCrossEMA, getDetachSourceFromOHLCV } = require('trading-indicator')
const { input } = await getDetachSourceFromOHLCV('binance', 'BTC/USDT', '1h', false) // true if you want to get future market
await priceCrossSMA(14, input)
//Test SMA cross
// { cross: true, direction: 'up' }
await priceCrossEMA(14, input)
// Test EMA cross
// { cross: true, direction: 'down' }
Parameter:
Sample code
const { vwapCrossSMA, vwapCrossEMA, getDetachSourceFromOHLCV } = require('trading-indicator')
const { input } = await getDetachSourceFromOHLCV('binance', 'BTC/USDT', '1h', false) // true if you want to get future market
await vwapCrossSMA(14, input)
//Test SMA cross
// { cross: true, direction: 'up' }
await vwapCrossEMA(14, input)
// Test EMA cross
// { cross: true, direction: 'down' }
Parameter:
SignalLength
Sample code
const { kstCross, getDetachSourceFromOHLCV } = require('trading-indicator')
const { input } = await getDetachSourceFromOHLCV('binance', 'BTC/USDT', '1h', false) // true if you want to get future market
await kstCross(input, 10, 15, 20, 30, 10, 10, 10, 15, 9)
//Test KST cross
// { cross: true, direction: 'up' }