@sohail2001/klinecharts-pro
Version:
Use KLineChart like a Pro
78 lines (74 loc) • 2.08 kB
TypeScript
import { DeepPartial, KLineData, Styles } from 'klinecharts';
export interface SymbolInfo {
ticker: string;
name?: string;
shortName?: string;
exchange?: string;
market?: string;
pricePrecision?: number;
volumePrecision?: number;
priceCurrency?: string;
type?: string;
logo?: string;
}
export interface Period {
multiplier: number;
timespan: string;
text: string;
}
export type DatafeedSubscribeCallback = (data: KLineData) => void;
export interface Datafeed {
searchSymbols(search?: string): Promise<SymbolInfo[]>;
getHistoryKLineData(symbol: SymbolInfo, period: Period, from: number, to: number): Promise<KLineData[]>;
subscribe(symbol: SymbolInfo, period: Period, callback: DatafeedSubscribeCallback): void;
unsubscribe(symbol: SymbolInfo, period: Period): void;
}
export interface ChartProOptions {
container: string | HTMLElement;
styles?: DeepPartial<Styles>;
watermark?: string | Node;
theme?: string;
locale?: string;
drawingBarVisible?: boolean;
productListVisible?: boolean;
orderPanelVisible?: boolean;
symbol: SymbolInfo;
period: Period;
periods?: Period[];
timezone?: string;
mainIndicators?: string[];
subIndicators?: string[];
datafeed: Datafeed;
}
export interface ProductListProps {
locale: string;
visible: boolean;
onSymbolSelect: (symbol: SymbolInfo) => void;
onClose: () => void;
}
export interface OrderPanelProps {
locale: string;
visible: boolean;
symbol: SymbolInfo;
onClose: () => void;
onOrderSubmit: (order: any) => void;
}
export interface ChartPro {
setTheme(theme: string): void;
getTheme(): string;
setStyles(styles: DeepPartial<Styles>): void;
getStyles(): Styles;
setLocale(locale: string): void;
getLocale(): string;
setTimezone(timezone: string): void;
getTimezone(): string;
setSymbol(symbol: SymbolInfo): void;
getSymbol(): SymbolInfo;
setPeriod(period: Period): void;
getPeriod(): Period;
}
export type KLineChartPro = ChartPro;
export type DefaultDatafeed = Datafeed;
export declare function loadLocales(key: string, locales: any): void;
export as namespace klinechartspro;
export {};