UNPKG

lwc-plugin-elliott-waves

Version:

195 lines (191 loc) 6.22 kB
// Generated by dts-bundle-generator v8.1.2 import { Coordinate, DataChangedScope, IChartApi, ISeriesApi, ISeriesPrimitive, ISeriesPrimitivePaneView, Logical, PrimitiveHoveredItem, SeriesAttachedParameter, SeriesOptionsMap, SeriesType, Time } from 'lightweight-charts'; export declare const enum PivotType { HIGH = 1, LOW = -1 } export declare const enum Wave { _1 = 1, _2 = 2, _3 = 3, _4 = 4, _5 = 5, _A = 6, _B = 7, _C = 8, _D = 9, _E = 10 } export declare const enum Degree { MINISCULE = 1, SUBMICRO = 2, MICRO = 3, SUBMINUETTE = 4, MINUETTE = 5, MINUTE = 6, MINOR = 7, INTERMEDIATE = 8, PRIMARY = 9, CYCLE = 10, SUPERCYCLE = 11, GRANDSUPERCYCLE = 12, SUBMILLENNIUM = 13, MILLENNIUM = 14, SUPERMILLENNIUM = 15 } export type Pivot = { time: Time; price: number; }; export type Interval = "1" | "5" | "10" | "30" | "60" | "240" | "D" | "W" | "M"; export type WavePivot = Pivot & { wave: Wave; degree: Degree; type: PivotType; interval: Interval; children?: WavePivot[]; visible: boolean; subTimes: { month: Time | null; week: Time | null; day: Time | null; }; }; export interface PivotChangeInfo { time: Time; price: number; } export interface SubCountInfo { pivotFrom: WavePivot; pivotTo?: WavePivot; } export interface ISeriesPrimitivePaneViewWithHover extends ISeriesPrimitivePaneView { [x: string]: any; isHover(x: number, y: number): WavePivot | null; } export interface ElliottWavesOptions { interval: Interval; fillColor: string; labelColor: string; labelTextColor: string; showLabels: boolean; priceLabelFormatter: (price: number) => string; timeLabelFormatter: (time: Time) => string; } export type Callback<T1 = void> = (param1: T1) => void; export interface ISubscription<T1 = void> { subscribe(callback: Callback<T1>, linkedObject?: unknown, singleshot?: boolean): void; unsubscribe(callback: Callback<T1>): void; unsubscribeAll(linkedObject: unknown): void; } declare class Delegate<T1 = void> implements ISubscription<T1> { private _listeners; subscribe(callback: Callback<T1>, linkedObject?: unknown, singleshot?: boolean): void; unsubscribe(callback: Callback<T1>): void; unsubscribeAll(linkedObject: unknown): void; fire(param1: T1): void; hasListeners(): boolean; destroy(): void; } export interface MousePosition { x: Coordinate; x2: Coordinate; logical: Logical; y: Coordinate; xPositionRelativeToPriceScale: Coordinate; overPriceScale: boolean; overTimeScale: boolean; } export type UnSubscriber = () => void; declare class MouseHandlers { _chart: IChartApi | undefined; _series: ISeriesApi<SeriesType> | undefined; _unSubscribers: UnSubscriber[]; private _clicked; private _down; private _up; private _mouseMoved; attached(chart: IChartApi, series: ISeriesApi<SeriesType>): void; detached(): void; clicked(): ISubscription<MousePosition | null>; mouseMoved(): ISubscription<MousePosition | null>; dragStarted(): ISubscription<MousePosition | null>; dragging(): ISubscription<MousePosition | null>; dragEnded(): ISubscription<MousePosition | null>; _addMouseEventListener(target: HTMLDivElement, eventType: "mouseleave" | "mousemove" | "click" | "mousedown" | "mouseup", handler: (event: MouseEvent) => void): void; _mouseLeave(): void; _mouseMove(event: MouseEvent): void; _mouseClick(event: MouseEvent): void; _mouseDown(event: MouseEvent): void; _mouseUp(event: MouseEvent): void; _determineMousePosition(event: MouseEvent): MousePosition | null; } export interface ElliottWavesDataSource { chart: IChartApi; series: ISeriesApi<keyof SeriesOptionsMap>; options: ElliottWavesOptions; mousePosition: MousePosition; isSelectingPivot: boolean; pivots: WavePivot[]; interval: Interval; } declare abstract class PluginBase implements ISeriesPrimitive<Time> { private _chart; private _series; protected dataUpdated?(scope: DataChangedScope): void; protected requestUpdate(): void; private _requestUpdate?; attached({ chart, series, requestUpdate }: SeriesAttachedParameter<Time>): void; detached(): void; get chart(): IChartApi; get series(): ISeriesApi<keyof SeriesOptionsMap>; private _fireDataUpdated; } export declare class ElliottWaves extends PluginBase implements ElliottWavesDataSource { _options: ElliottWavesOptions; _paneViews: ISeriesPrimitivePaneViewWithHover[]; _mouseHandlers: MouseHandlers; _mousePosition: MousePosition; _isSelectingPivot: boolean; _pivots: WavePivot[]; _selectedPivot: PivotChangeInfo | null; _pivotChanged: Delegate<PivotChangeInfo>; _pivotSubCountClicked: Delegate<SubCountInfo>; _hoverPivot: WavePivot | null; _interval: Interval; constructor(options?: Partial<ElliottWavesOptions>); pivotChanged(): Delegate<PivotChangeInfo>; pivotSubCountClicked(): Delegate<SubCountInfo>; /** * Hit test method which will be called by the library when the cursor is moved. * Use this to register object ids being hovered for use within the crosshairMoved * and click events emitted by the chart. Additionally, the hit test result can * specify a preferred cursor type to display for the main chart pane. This method * should return the top most hit for this primitive if more than one object is * being intersected. * * @param x - x Coordinate of mouse event * @param y - y Coordinate of mouse event */ hitTest(x: number, y: number): PrimitiveHoveredItem | null; updateIsSelectingPivot(isSelectingPivot: boolean): void; updateInterval(interval: Interval): void; _flattenPivotsRecursive(pivot: WavePivot): WavePivot[]; updatePivots(pivots: WavePivot[]): void; attached(param: SeriesAttachedParameter<Time>): void; isSamePivot(p1: WavePivot, p2: WavePivot): boolean; isNextPivot(p1: WavePivot, p2: WavePivot): boolean; findNextPivot(pivot: WavePivot): WavePivot | null; detached(): void; updateAllViews(): void; paneViews(): ISeriesPrimitivePaneViewWithHover[]; _timeCurrentlyVisible(time: Time, startTimePoint: Logical, endTimePoint: Logical): boolean; get options(): ElliottWavesOptions; applyOptions(options: Partial<ElliottWavesOptions>): void; get mousePosition(): MousePosition; get isSelectingPivot(): boolean; get pivots(): WavePivot[]; get interval(): Interval; _setCrosshairMode(): void; } export {};