anandanand84 / technicalindicators

A javascript technical indicators written in typescript with pattern recognition right in the browser
MIT License
2.14k stars 557 forks source link

Observable and indicators #185

Open Bretto opened 5 years ago

Bretto commented 5 years ago

How do you plug those indicators with observable? Examples ?

tistaharahap commented 5 years ago

Don't have to do much.

import { RSI } from 'technicalindicators'

// RxJs 5.x
const obs = getCandlesticks()
  .map((candlesticks) => {
    // ... codes

    const opts = {
      values: candlesticks.map(x => x.close) // Change to whatever the candle structure is
    }
    const rsis = RSI.calculate(opts)

    // ... code
  })