UNPKG

@4ex/indicators

Version:

Technical indicators for ohlc charts written in TypeScript

42 lines (41 loc) 1.56 kB
import { VWAP as VWAPIndicator } from 'technicalindicators'; import { OHLC } from '../types'; import { Indicator, IndicatorInput } from './base-indicator'; export declare type VolumeWeightedAveragePriceInput = IndicatorInput; /** * The volume weighted average price (VWAP) is a trading benchmark used by * traders that gives the average price a security has traded at throughout * the day, based on both volume and price. It is important because it provides * traders with insight into both the trend and value of a security. */ export declare class VWAP implements Indicator { indicator: VWAPIndicator; /** * @param {OHLC[]} series candle series */ constructor(series: OHLC[]); /** * Retrieve VWAP values for instance * @return {number[]} values for instance data */ getResults(): number[]; /** * Calculate VWAP to next tick * @param {OHLC} candle new candle to add to series * @return {number | undefined} next adl value or undefined if period is * greater than actual series length */ next(candle: OHLC): number | undefined; /** * Create instance from data * @param {VolumeWeightedAveragePriceInput} input input data * @return {VWAP} adl instance */ static generator({ series, }: VolumeWeightedAveragePriceInput): VWAP; /** * Get adl values from input * @param {VolumeWeightedAveragePriceInput} input input data * @return {number[]} adl values */ static calculate({ series, }: VolumeWeightedAveragePriceInput): number[]; }