@funnest/charts 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/NOTICE +4 -0
- package/README.md +28 -2
- package/dist/chart.d.ts +300 -0
- package/dist/datafeed/combine.d.ts +7 -0
- package/dist/datafeed/latency.d.ts +5 -0
- package/dist/datafeed/socket.d.ts +60 -0
- package/dist/events.d.ts +7 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.js +3749 -0
- package/dist/indicators/definitions.d.ts +74 -0
- package/dist/indicators/manager.d.ts +26 -0
- package/dist/indicators/math.d.ts +21 -0
- package/dist/interaction.d.ts +81 -0
- package/dist/model/bar-store.d.ts +36 -0
- package/dist/model/price-scale.d.ts +35 -0
- package/dist/model/time-format.d.ts +50 -0
- package/dist/model/time-scale.d.ts +42 -0
- package/dist/objects/drawings.d.ts +52 -0
- package/dist/objects/magnet.d.ts +6 -0
- package/dist/objects/trading-sync.d.ts +72 -0
- package/dist/objects/trading.d.ts +76 -0
- package/dist/objects/types.d.ts +42 -0
- package/dist/price.d.ts +17 -0
- package/dist/realtime.d.ts +39 -0
- package/dist/render/canvas-layer.d.ts +13 -0
- package/dist/render/color-resolver.d.ts +14 -0
- package/dist/render/painter.d.ts +38 -0
- package/dist/render/renderer.d.ts +100 -0
- package/dist/resolution.d.ts +8 -0
- package/dist/session.d.ts +12 -0
- package/dist/settings.d.ts +40 -0
- package/dist/theme.d.ts +24 -0
- package/dist/types.d.ts +106 -0
- package/package.json +47 -3
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Bar, Resolution } from './types';
|
|
2
|
+
/** UTC offset (ms) of `timeZone` at instant `time`. Positive east of UTC (Asia/Seoul = +9h). */
|
|
3
|
+
export declare function timeZoneOffset(time: number, timeZone: string): number;
|
|
4
|
+
/**
|
|
5
|
+
* Start time of the bar that contains `time`.
|
|
6
|
+
* Intraday buckets align to the local clock; D/W/M align to local midnight
|
|
7
|
+
* (weeks start Monday). Pass the exchange's candle timezone — e.g. 'UTC' for
|
|
8
|
+
* Upbit/Binance daily candles, 'Asia/Seoul' for KRX.
|
|
9
|
+
*/
|
|
10
|
+
export declare function bucketStart(time: number, resolution: Resolution, timeZone?: string): number;
|
|
11
|
+
export interface Tick {
|
|
12
|
+
/** Trade time, UTC ms. */
|
|
13
|
+
time: number;
|
|
14
|
+
price: number;
|
|
15
|
+
/** Traded quantity, added to the bar's volume. */
|
|
16
|
+
volume?: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Builds OHLCV bars from a trade/tick stream (e.g. Upbit `trade`, Binance `@trade`).
|
|
20
|
+
*
|
|
21
|
+
* ```ts
|
|
22
|
+
* const agg = new TickAggregator('1', 'UTC');
|
|
23
|
+
* agg.seed(lastHistoricalBar); // continue the still-forming bar
|
|
24
|
+
* socket.onmessage = (m) => {
|
|
25
|
+
* const bar = agg.push({ time: m.ts, price: m.price, volume: m.qty });
|
|
26
|
+
* if (bar) onBar(bar);
|
|
27
|
+
* };
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare class TickAggregator {
|
|
31
|
+
readonly resolution: Resolution;
|
|
32
|
+
readonly timeZone: string;
|
|
33
|
+
private current;
|
|
34
|
+
constructor(resolution: Resolution, timeZone?: string);
|
|
35
|
+
/** Start from the latest historical bar so the first tick updates it instead of opening a new one. */
|
|
36
|
+
seed(bar: Bar | undefined): void;
|
|
37
|
+
/** Returns the updated bar, or null for a tick belonging to an already-closed bar. */
|
|
38
|
+
push(tick: Tick): Bar | null;
|
|
39
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** A full-size canvas whose backing store tracks devicePixelRatio. Drawing uses CSS-pixel coordinates. */
|
|
2
|
+
export declare class CanvasLayer {
|
|
3
|
+
readonly canvas: HTMLCanvasElement;
|
|
4
|
+
readonly ctx: CanvasRenderingContext2D;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
dpr: number;
|
|
8
|
+
constructor(parent: HTMLElement);
|
|
9
|
+
resize(width: number, height: number, dpr: number): void;
|
|
10
|
+
/** Resets the transform to CSS pixels and clears. */
|
|
11
|
+
begin(): CanvasRenderingContext2D;
|
|
12
|
+
destroy(): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canvas can't read CSS variables, so `var(--x)` theme values are resolved through
|
|
3
|
+
* a hidden probe element living inside the chart (inheriting the host page's variables).
|
|
4
|
+
* Plain colors pass through untouched.
|
|
5
|
+
*/
|
|
6
|
+
export declare class ColorResolver {
|
|
7
|
+
private readonly probe;
|
|
8
|
+
private readonly cache;
|
|
9
|
+
constructor(probe: HTMLElement);
|
|
10
|
+
color(value: string): string;
|
|
11
|
+
fontFamily(value: string): string;
|
|
12
|
+
clear(): void;
|
|
13
|
+
private lookup;
|
|
14
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pixel-aligned drawing helpers. Lines are drawn as filled rects snapped to the
|
|
3
|
+
* device-pixel grid so they stay crisp at any devicePixelRatio.
|
|
4
|
+
*/
|
|
5
|
+
export declare class Painter {
|
|
6
|
+
readonly ctx: CanvasRenderingContext2D;
|
|
7
|
+
readonly dpr: number;
|
|
8
|
+
constructor(ctx: CanvasRenderingContext2D, dpr: number);
|
|
9
|
+
/** Thickness of a "1px" hairline: one whole device pixel (or more on high-DPR screens). */
|
|
10
|
+
get hairline(): number;
|
|
11
|
+
snap(v: number): number;
|
|
12
|
+
hLine(y: number, x1: number, x2: number, color: string, dash?: readonly [number, number]): void;
|
|
13
|
+
vLine(x: number, y1: number, y2: number, color: string, dash?: readonly [number, number]): void;
|
|
14
|
+
text(str: string, x: number, y: number, color: string, align?: CanvasTextAlign, baseline?: CanvasTextBaseline): void;
|
|
15
|
+
roundRect(x: number, y: number, w: number, h: number, r: number, color: string): void;
|
|
16
|
+
measure(str: string): number;
|
|
17
|
+
/** Anti-aliased line for arbitrary angles (trendlines). */
|
|
18
|
+
line(x1: number, y1: number, x2: number, y2: number, color: string, width?: number, dash?: readonly number[]): void;
|
|
19
|
+
circle(x: number, y: number, r: number, fill: string, stroke?: string, strokeWidth?: number): void;
|
|
20
|
+
/**
|
|
21
|
+
* A row of joined label segments ("pill") centered vertically on `y`.
|
|
22
|
+
* Returns each segment's rect for hit testing (e.g. an order's cancel button).
|
|
23
|
+
*/
|
|
24
|
+
pill(segments: readonly PillSegment[], x: number, y: number, height?: number, radius?: number): Rect[];
|
|
25
|
+
}
|
|
26
|
+
export interface Rect {
|
|
27
|
+
x: number;
|
|
28
|
+
y: number;
|
|
29
|
+
w: number;
|
|
30
|
+
h: number;
|
|
31
|
+
}
|
|
32
|
+
export interface PillSegment {
|
|
33
|
+
text: string;
|
|
34
|
+
bg: string;
|
|
35
|
+
fg: string;
|
|
36
|
+
padding?: number;
|
|
37
|
+
}
|
|
38
|
+
export declare const inRect: (r: Rect, x: number, y: number, pad?: number) => boolean;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type { PriceScale } from '../model/price-scale';
|
|
2
|
+
import type { TimeTick } from '../model/time-format';
|
|
3
|
+
import type { IndexRange, TimeScale } from '../model/time-scale';
|
|
4
|
+
import type { Bar } from '../types';
|
|
5
|
+
import type { CanvasLayer } from './canvas-layer';
|
|
6
|
+
import type { DrawingManager } from '../objects/drawings';
|
|
7
|
+
import type { TradingLabels, TradingLayer } from '../objects/trading';
|
|
8
|
+
import type { PaneCoords } from '../objects/types';
|
|
9
|
+
import type { IndicatorOutput } from '../indicators/definitions';
|
|
10
|
+
import type { ChartSettings } from '../settings';
|
|
11
|
+
export type ChartType = 'candles' | 'line' | 'area';
|
|
12
|
+
/** 'main', 'volume', or an indicator id for indicator panes. */
|
|
13
|
+
export type PaneId = string;
|
|
14
|
+
export interface PaneFrame {
|
|
15
|
+
id: PaneId;
|
|
16
|
+
kind: 'main' | 'volume' | 'indicator';
|
|
17
|
+
top: number;
|
|
18
|
+
height: number;
|
|
19
|
+
scale: PriceScale;
|
|
20
|
+
/** Values for grid lines and axis labels. */
|
|
21
|
+
ticks: number[];
|
|
22
|
+
/** Crosshair/value label format. */
|
|
23
|
+
format(value: number): string;
|
|
24
|
+
/** Axis tick label format (defaults to `format`). */
|
|
25
|
+
tickFormat?: (value: number) => string;
|
|
26
|
+
indicator?: IndicatorOutput;
|
|
27
|
+
}
|
|
28
|
+
export interface Palette {
|
|
29
|
+
background: string;
|
|
30
|
+
text: string;
|
|
31
|
+
textSecondary: string;
|
|
32
|
+
grid: string;
|
|
33
|
+
border: string;
|
|
34
|
+
crosshair: string;
|
|
35
|
+
up: string;
|
|
36
|
+
down: string;
|
|
37
|
+
accent: string;
|
|
38
|
+
}
|
|
39
|
+
/** Everything computed once per full frame; shared by the main and overlay passes. */
|
|
40
|
+
export interface Frame {
|
|
41
|
+
width: number;
|
|
42
|
+
height: number;
|
|
43
|
+
plotWidth: number;
|
|
44
|
+
panesHeight: number;
|
|
45
|
+
timeAxisHeight: number;
|
|
46
|
+
panes: PaneFrame[];
|
|
47
|
+
range: IndexRange;
|
|
48
|
+
priceTicks: number[];
|
|
49
|
+
timeTicks: TimeTick[];
|
|
50
|
+
highLow: {
|
|
51
|
+
highIndex: number;
|
|
52
|
+
lowIndex: number;
|
|
53
|
+
} | null;
|
|
54
|
+
settings: ChartSettings;
|
|
55
|
+
/** Indicators drawn over the candles. */
|
|
56
|
+
overlays: IndicatorOutput[];
|
|
57
|
+
palette: Palette;
|
|
58
|
+
font: string;
|
|
59
|
+
radius: number;
|
|
60
|
+
}
|
|
61
|
+
export interface CrosshairInfo {
|
|
62
|
+
index: number;
|
|
63
|
+
time: number;
|
|
64
|
+
bar: Bar;
|
|
65
|
+
/** Price (main pane) or volume (volume pane) under the crosshair. */
|
|
66
|
+
value: number;
|
|
67
|
+
pane: PaneId;
|
|
68
|
+
x: number;
|
|
69
|
+
y: number;
|
|
70
|
+
source: 'mouse' | 'touch';
|
|
71
|
+
}
|
|
72
|
+
/** Fill details shown next to an execution marker. */
|
|
73
|
+
export interface Tooltip {
|
|
74
|
+
x: number;
|
|
75
|
+
y: number;
|
|
76
|
+
side: 'buy' | 'sell';
|
|
77
|
+
lines: string[];
|
|
78
|
+
}
|
|
79
|
+
export interface RenderModel {
|
|
80
|
+
frame: Frame;
|
|
81
|
+
bars: readonly Bar[];
|
|
82
|
+
timeScale: TimeScale;
|
|
83
|
+
formatPrice(price: number): string;
|
|
84
|
+
formatVolume(volume: number): string;
|
|
85
|
+
formatCrosshairTime(time: number): string;
|
|
86
|
+
labels: {
|
|
87
|
+
high: string;
|
|
88
|
+
low: string;
|
|
89
|
+
};
|
|
90
|
+
chartType: ChartType;
|
|
91
|
+
objects: {
|
|
92
|
+
coords: PaneCoords;
|
|
93
|
+
drawings: DrawingManager;
|
|
94
|
+
trading: TradingLayer;
|
|
95
|
+
tradingLabels: TradingLabels;
|
|
96
|
+
barIndexAt(time: number): number;
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
export declare function drawMain(layer: CanvasLayer, m: RenderModel): void;
|
|
100
|
+
export declare function drawOverlay(layer: CanvasLayer, m: RenderModel, ch: CrosshairInfo | null, tooltip?: Tooltip | null): void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Resolution } from './types';
|
|
2
|
+
export declare const DAY_MS = 86400000;
|
|
3
|
+
/**
|
|
4
|
+
* Approximate duration of a resolution string.
|
|
5
|
+
* Bare numbers are minutes ('1', '15', '240'); suffixes: S (seconds), D, W, M (months ≈ 30d).
|
|
6
|
+
*/
|
|
7
|
+
export declare function resolutionToMs(resolution: Resolution): number;
|
|
8
|
+
export declare function isIntradayResolution(resolution: Resolution): boolean;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface SessionStatus {
|
|
2
|
+
/** Trading right now. Always true for '24x7'. */
|
|
3
|
+
open: boolean;
|
|
4
|
+
/** Next open/close transition (UTC ms); null for 24x7 markets. */
|
|
5
|
+
nextChange: number | null;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Parses sessions like '0900-1530' (weekdays, exchange-local time) or '24x7'.
|
|
9
|
+
* An optional day list may follow a colon using ISO weekdays: '0900-1530:12345'.
|
|
10
|
+
* Holidays aren't known here — feed them via a calendar adapter later (see ROADMAP).
|
|
11
|
+
*/
|
|
12
|
+
export declare function sessionStatus(session: string, timeZone: string, now?: number): SessionStatus;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Drawing } from './objects/drawings';
|
|
2
|
+
import type { IndicatorConfig } from './indicators/manager';
|
|
3
|
+
import type { ChartType } from './render/renderer';
|
|
4
|
+
import type { Resolution } from './types';
|
|
5
|
+
/** User-facing chart preferences (the "차트 설정" dialog). */
|
|
6
|
+
export interface ChartSettings {
|
|
7
|
+
/** "최고/최저" labels at the visible price extremes. */
|
|
8
|
+
highLowMarkers: boolean;
|
|
9
|
+
/** Dotted line and axis badge at the last price. */
|
|
10
|
+
lastPriceLine: boolean;
|
|
11
|
+
gridHorizontal: boolean;
|
|
12
|
+
gridVertical: boolean;
|
|
13
|
+
/** Volume pane under the price pane. */
|
|
14
|
+
volume: boolean;
|
|
15
|
+
/** Up/down candle colors; null follows the theme. */
|
|
16
|
+
upColor: string | null;
|
|
17
|
+
downColor: string | null;
|
|
18
|
+
}
|
|
19
|
+
export declare const DEFAULT_CHART_SETTINGS: ChartSettings;
|
|
20
|
+
/**
|
|
21
|
+
* Everything needed to restore a chart layout: symbol, interval, chart type, settings,
|
|
22
|
+
* indicators, drawings (per symbol) and the visible window. Plain JSON — store it anywhere
|
|
23
|
+
* (localStorage, your server) and pass it back to `load()`.
|
|
24
|
+
*/
|
|
25
|
+
export interface ChartState {
|
|
26
|
+
version: 1;
|
|
27
|
+
symbol: string | null;
|
|
28
|
+
resolution: Resolution | null;
|
|
29
|
+
chartType: ChartType;
|
|
30
|
+
settings: ChartSettings;
|
|
31
|
+
indicators: IndicatorConfig[];
|
|
32
|
+
/** Drawings keyed by symbol ('' when the chart has no symbol, e.g. manual data). */
|
|
33
|
+
drawings: Record<string, Drawing[]>;
|
|
34
|
+
view: {
|
|
35
|
+
barSpacing: number;
|
|
36
|
+
rightOffset: number;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/** Validates untrusted JSON (e.g. from storage) into a ChartState; throws on an incompatible shape. */
|
|
40
|
+
export declare function parseChartState(input: unknown): ChartState;
|
package/dist/theme.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Design tokens shared by the canvas engine and the DOM UI.
|
|
3
|
+
* Values may be any CSS color, including `var(--my-token)`; the engine
|
|
4
|
+
* resolves CSS variables against the chart container before painting.
|
|
5
|
+
*/
|
|
6
|
+
export interface ThemeTokens {
|
|
7
|
+
background: string;
|
|
8
|
+
surface: string;
|
|
9
|
+
text: string;
|
|
10
|
+
textSecondary: string;
|
|
11
|
+
grid: string;
|
|
12
|
+
border: string;
|
|
13
|
+
crosshair: string;
|
|
14
|
+
up: string;
|
|
15
|
+
down: string;
|
|
16
|
+
accent: string;
|
|
17
|
+
fontFamily: string;
|
|
18
|
+
fontSize: number;
|
|
19
|
+
radius: number;
|
|
20
|
+
}
|
|
21
|
+
export type DirectionPreset = 'kr' | 'global';
|
|
22
|
+
export declare const lightTheme: ThemeTokens;
|
|
23
|
+
export declare const darkTheme: ThemeTokens;
|
|
24
|
+
export declare function createTheme(base: ThemeTokens, overrides?: Partial<ThemeTokens>, direction?: DirectionPreset): ThemeTokens;
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/** A single OHLCV bar. `time` is the bar's open time in UTC milliseconds. */
|
|
2
|
+
export interface Bar {
|
|
3
|
+
time: number;
|
|
4
|
+
open: number;
|
|
5
|
+
high: number;
|
|
6
|
+
low: number;
|
|
7
|
+
close: number;
|
|
8
|
+
volume?: number;
|
|
9
|
+
}
|
|
10
|
+
/** Bar interval, e.g. '1', '5', '60' (minutes), '1D', '1W', '1M'. */
|
|
11
|
+
export type Resolution = string;
|
|
12
|
+
/** Minimum price increment. Either fixed, or price-dependent (e.g. KRX). */
|
|
13
|
+
export type TickSize = number | ((price: number) => number);
|
|
14
|
+
export interface SymbolInfo {
|
|
15
|
+
symbol: string;
|
|
16
|
+
name: string;
|
|
17
|
+
exchange: string;
|
|
18
|
+
/** IANA timezone, e.g. 'Asia/Seoul'. */
|
|
19
|
+
timezone: string;
|
|
20
|
+
/** Trading session, e.g. '0900-1530' or '24x7'. */
|
|
21
|
+
session: string;
|
|
22
|
+
/** Number of decimals to display. */
|
|
23
|
+
pricePrecision: number;
|
|
24
|
+
tickSize: TickSize;
|
|
25
|
+
volumePrecision?: number;
|
|
26
|
+
/** Optional logo shown next to the name in @funnest/charts-ui (falls back to an initial avatar). */
|
|
27
|
+
logoUrl?: string;
|
|
28
|
+
/** Instrument kind; drives search categories and which market stats make sense. */
|
|
29
|
+
type?: SymbolType;
|
|
30
|
+
/** ISO 3166 country of the listing ('KR', 'US'…), e.g. to split 국내/해외 stocks. */
|
|
31
|
+
country?: string;
|
|
32
|
+
/** Resolutions this symbol's feed can serve. Others are shown disabled in the UI. */
|
|
33
|
+
supportedResolutions?: Resolution[];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* A search hit. Market fields are optional: return them when cheap (e.g. from a batch ticker)
|
|
37
|
+
* and the search list shows price, change and a sparkline next to each symbol.
|
|
38
|
+
*/
|
|
39
|
+
export interface SymbolSearchResult extends SymbolInfo {
|
|
40
|
+
price?: number;
|
|
41
|
+
changePercent?: number;
|
|
42
|
+
/** Recent closes, oldest first (~20–60 points) for the row sparkline. */
|
|
43
|
+
sparkline?: number[];
|
|
44
|
+
}
|
|
45
|
+
export type SymbolType = 'stock' | 'etf' | 'index' | 'crypto' | 'futures' | 'forex';
|
|
46
|
+
/**
|
|
47
|
+
* Live market statistics for the market bar. Every field is optional: show what your
|
|
48
|
+
* venue has (spot has no open interest/funding, stocks have no 24h window…).
|
|
49
|
+
*/
|
|
50
|
+
export interface Quote {
|
|
51
|
+
price?: number;
|
|
52
|
+
/** Absolute change vs the reference (previous close / 24h ago). */
|
|
53
|
+
change?: number;
|
|
54
|
+
/** Change in percent, e.g. -1.23. */
|
|
55
|
+
changePercent?: number;
|
|
56
|
+
high24h?: number;
|
|
57
|
+
low24h?: number;
|
|
58
|
+
/** Traded quantity over 24h (or today for stocks). */
|
|
59
|
+
volume24h?: number;
|
|
60
|
+
/** Traded value in the quote currency (KRW, USDT…). */
|
|
61
|
+
turnover24h?: number;
|
|
62
|
+
/** Futures: open interest in contracts/base units. */
|
|
63
|
+
openInterest?: number;
|
|
64
|
+
/** Futures: current funding rate as a fraction (0.0001 = 0.01%). */
|
|
65
|
+
fundingRate?: number;
|
|
66
|
+
/** Futures: next funding time, UTC ms. */
|
|
67
|
+
nextFundingTime?: number;
|
|
68
|
+
}
|
|
69
|
+
export interface ConnectionState {
|
|
70
|
+
status: 'connecting' | 'connected' | 'reconnecting' | 'disconnected';
|
|
71
|
+
/** Round-trip latency estimate in ms, when the feed can measure it. */
|
|
72
|
+
latency?: number;
|
|
73
|
+
}
|
|
74
|
+
export interface BarsRequest {
|
|
75
|
+
from: number;
|
|
76
|
+
to: number;
|
|
77
|
+
/** Preferred number of bars ending at `to`; takes priority over `from` when set. */
|
|
78
|
+
countBack?: number;
|
|
79
|
+
}
|
|
80
|
+
export interface BarsResult {
|
|
81
|
+
bars: Bar[];
|
|
82
|
+
/** True when there is no older history to load. */
|
|
83
|
+
noMoreData: boolean;
|
|
84
|
+
}
|
|
85
|
+
export type Unsubscribe = () => void;
|
|
86
|
+
/**
|
|
87
|
+
* Data source adapter. Implement this once per exchange/broker.
|
|
88
|
+
* Bars passed to `onBar` with the same `time` as the last bar update it;
|
|
89
|
+
* a greater `time` appends a new bar.
|
|
90
|
+
*/
|
|
91
|
+
export interface Datafeed {
|
|
92
|
+
resolveSymbol(symbol: string): Promise<SymbolInfo>;
|
|
93
|
+
getBars(symbol: SymbolInfo, resolution: Resolution, request: BarsRequest): Promise<BarsResult>;
|
|
94
|
+
/**
|
|
95
|
+
* Realtime updates. Call `onBar` with the current (forming) bar on every tick — the chart
|
|
96
|
+
* batches redraws per frame, so high message rates are fine. After a WebSocket reconnect,
|
|
97
|
+
* call `onResetCache` and the chart re-fetches the recent window via `getBars` to fill the gap.
|
|
98
|
+
*/
|
|
99
|
+
subscribeBars(symbol: SymbolInfo, resolution: Resolution, onBar: (bar: Bar) => void, onResetCache?: () => void,
|
|
100
|
+
/** Report the realtime connection's state/latency (shown in the status bar). */
|
|
101
|
+
onConnection?: (state: ConnectionState) => void): Unsubscribe;
|
|
102
|
+
/** Optional: powers the symbol search dialog in @funnest/charts-ui. */
|
|
103
|
+
searchSymbols?(query: string): Promise<SymbolSearchResult[]>;
|
|
104
|
+
/** Optional: live market statistics for the market bar. */
|
|
105
|
+
subscribeQuotes?(symbol: SymbolInfo, onQuote: (quote: Quote) => void): Unsubscribe;
|
|
106
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,50 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@funnest/charts",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Canvas charting engine for financial charts",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"chart",
|
|
7
|
+
"candlestick",
|
|
8
|
+
"trading",
|
|
9
|
+
"financial",
|
|
10
|
+
"canvas",
|
|
11
|
+
"krx",
|
|
12
|
+
"crypto",
|
|
13
|
+
"indicators"
|
|
14
|
+
],
|
|
15
|
+
"license": "Apache-2.0",
|
|
16
|
+
"author": "Funnest",
|
|
17
|
+
"homepage": "https://charts.funnest.xyz",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/funnest-xyz/funnest-charts.git",
|
|
21
|
+
"directory": "packages/core"
|
|
22
|
+
},
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/funnest-xyz/funnest-charts/issues"
|
|
25
|
+
},
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
},
|
|
29
|
+
"type": "module",
|
|
30
|
+
"sideEffects": false,
|
|
31
|
+
"main": "./dist/index.js",
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"exports": {
|
|
34
|
+
".": {
|
|
35
|
+
"funnest-source": "./src/index.ts",
|
|
36
|
+
"types": "./dist/index.d.ts",
|
|
37
|
+
"import": "./dist/index.js"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"files": [
|
|
41
|
+
"dist",
|
|
42
|
+
"README.md",
|
|
43
|
+
"LICENSE",
|
|
44
|
+
"NOTICE"
|
|
45
|
+
],
|
|
46
|
+
"scripts": {
|
|
47
|
+
"build": "tsup src/index.ts --format esm --clean && tsc -p tsconfig.build.json",
|
|
48
|
+
"typecheck": "tsc -p tsconfig.json"
|
|
49
|
+
}
|
|
6
50
|
}
|