quant-zero
Version:
Node-Quant is a powerful Node.js package for developing and testing quantitative trading strategies in cryptocurrency markets, offering tools for backtesting and performance analysis.
28 lines (23 loc) • 750 B
text/typescript
import { parseIntoRows } from '@/utils/parseOHLCV'
import { OHLCV } from 'ccxt'
import { ChartingSystem } from '@/lib'
import ta from 'technicalindicators'
import { RenkoInput } from 'technicalindicators/declarations/chart_types/Renko'
type RenkoOptions = Omit<RenkoInput, 'low' | 'close' | 'high' | 'open'>
export class Renko extends ChartingSystem {
public options: RenkoOptions
constructor(options: RenkoOptions) {
super()
this.options = options
}
public transform(rawData: OHLCV[]): ta.CandleList {
const { opens, highs, lows, closes } = parseIntoRows(rawData)
return ta.renko({
...this.options,
open: opens,
high: highs,
low: lows,
close: closes,
})
}
}