@tradecanvas/commons 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/dist/constants/defaults.d.ts +18 -0
- package/dist/constants/defaults.d.ts.map +1 -0
- package/dist/constants/index.d.ts +3 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/constants/themes.d.ts +4 -0
- package/dist/constants/themes.d.ts.map +1 -0
- package/dist/i18n/en.d.ts +3 -0
- package/dist/i18n/en.d.ts.map +1 -0
- package/dist/i18n/index.d.ts +13 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/types.d.ts +116 -0
- package/dist/i18n/types.d.ts.map +1 -0
- package/dist/i18n/vi.d.ts +3 -0
- package/dist/i18n/vi.d.ts.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +692 -0
- package/dist/index.js.map +1 -0
- package/dist/market/index.d.ts +3 -0
- package/dist/market/index.d.ts.map +1 -0
- package/dist/market/presets.d.ts +18 -0
- package/dist/market/presets.d.ts.map +1 -0
- package/dist/market/types.d.ts +38 -0
- package/dist/market/types.d.ts.map +1 -0
- package/dist/types/axis.d.ts +11 -0
- package/dist/types/axis.d.ts.map +1 -0
- package/dist/types/chart.d.ts +138 -0
- package/dist/types/chart.d.ts.map +1 -0
- package/dist/types/drawing.d.ts +38 -0
- package/dist/types/drawing.d.ts.map +1 -0
- package/dist/types/events.d.ts +30 -0
- package/dist/types/events.d.ts.map +1 -0
- package/dist/types/index.d.ts +12 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/indicator.d.ts +41 -0
- package/dist/types/indicator.d.ts.map +1 -0
- package/dist/types/layout.d.ts +31 -0
- package/dist/types/layout.d.ts.map +1 -0
- package/dist/types/ohlc.d.ts +16 -0
- package/dist/types/ohlc.d.ts.map +1 -0
- package/dist/types/realtime.d.ts +79 -0
- package/dist/types/realtime.d.ts.map +1 -0
- package/dist/types/rendering.d.ts +37 -0
- package/dist/types/rendering.d.ts.map +1 -0
- package/dist/types/theme.d.ts +29 -0
- package/dist/types/theme.d.ts.map +1 -0
- package/dist/types/trading.d.ts +80 -0
- package/dist/types/trading.d.ts.map +1 -0
- package/dist/utils/color.d.ts +3 -0
- package/dist/utils/color.d.ts.map +1 -0
- package/dist/utils/data.d.ts +13 -0
- package/dist/utils/data.d.ts.map +1 -0
- package/dist/utils/index.d.ts +6 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/math.d.ts +7 -0
- package/dist/utils/math.d.ts.map +1 -0
- package/dist/utils/precision.d.ts +4 -0
- package/dist/utils/precision.d.ts.map +1 -0
- package/dist/utils/time.d.ts +5 -0
- package/dist/utils/time.d.ts.map +1 -0
- package/package.json +34 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export interface Point {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
}
|
|
5
|
+
export interface Size {
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
}
|
|
9
|
+
export interface Rect {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
}
|
|
15
|
+
export interface ViewportState {
|
|
16
|
+
visibleRange: {
|
|
17
|
+
from: number;
|
|
18
|
+
to: number;
|
|
19
|
+
};
|
|
20
|
+
priceRange: {
|
|
21
|
+
min: number;
|
|
22
|
+
max: number;
|
|
23
|
+
};
|
|
24
|
+
barWidth: number;
|
|
25
|
+
barSpacing: number;
|
|
26
|
+
offset: number;
|
|
27
|
+
chartRect: Rect;
|
|
28
|
+
logScale?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export declare enum LayerType {
|
|
31
|
+
Background = 0,
|
|
32
|
+
Main = 1,
|
|
33
|
+
Panel = 2,
|
|
34
|
+
Overlay = 3,
|
|
35
|
+
UI = 4
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=rendering.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rendering.d.ts","sourceRoot":"","sources":["../../src/types/rendering.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,KAAK;IACpB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,IAAI;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,IAAI;IACnB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B,YAAY,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3C,UAAU,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,IAAI,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,oBAAY,SAAS;IACnB,UAAU,IAAI;IACd,IAAI,IAAI;IACR,KAAK,IAAI;IACT,OAAO,IAAI;IACX,EAAE,IAAI;CACP"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export type ThemeName = 'dark' | 'light';
|
|
2
|
+
export interface FontConfig {
|
|
3
|
+
family: string;
|
|
4
|
+
sizeSmall: number;
|
|
5
|
+
sizeMedium: number;
|
|
6
|
+
sizeLarge: number;
|
|
7
|
+
}
|
|
8
|
+
export interface Theme {
|
|
9
|
+
name: string;
|
|
10
|
+
background: string;
|
|
11
|
+
text: string;
|
|
12
|
+
textSecondary: string;
|
|
13
|
+
grid: string;
|
|
14
|
+
crosshair: string;
|
|
15
|
+
candleUp: string;
|
|
16
|
+
candleDown: string;
|
|
17
|
+
candleUpWick: string;
|
|
18
|
+
candleDownWick: string;
|
|
19
|
+
lineColor: string;
|
|
20
|
+
areaTopColor: string;
|
|
21
|
+
areaBottomColor: string;
|
|
22
|
+
volumeUp: string;
|
|
23
|
+
volumeDown: string;
|
|
24
|
+
axisLine: string;
|
|
25
|
+
axisLabel: string;
|
|
26
|
+
axisLabelBackground: string;
|
|
27
|
+
font: FontConfig;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/types/theme.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;AAEzC,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,IAAI,EAAE,UAAU,CAAC;CAClB"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
export type OrderSide = 'buy' | 'sell';
|
|
2
|
+
export type OrderType = 'market' | 'limit' | 'stop' | 'stopLimit';
|
|
3
|
+
export type OrderStatus = 'pending' | 'filled' | 'cancelled' | 'rejected';
|
|
4
|
+
export type OrderLabel = 'LIMIT' | 'STOP' | 'SL' | 'TP' | 'STOP LIMIT';
|
|
5
|
+
export interface TradingOrder {
|
|
6
|
+
id: string;
|
|
7
|
+
side: OrderSide;
|
|
8
|
+
type: OrderType;
|
|
9
|
+
price: number;
|
|
10
|
+
stopPrice?: number;
|
|
11
|
+
quantity: number;
|
|
12
|
+
label?: OrderLabel;
|
|
13
|
+
draggable?: boolean;
|
|
14
|
+
meta?: Record<string, unknown>;
|
|
15
|
+
}
|
|
16
|
+
export interface TradingPosition {
|
|
17
|
+
id: string;
|
|
18
|
+
side: OrderSide;
|
|
19
|
+
entryPrice: number;
|
|
20
|
+
quantity: number;
|
|
21
|
+
stopLoss?: number;
|
|
22
|
+
takeProfit?: number;
|
|
23
|
+
meta?: Record<string, unknown>;
|
|
24
|
+
}
|
|
25
|
+
export interface DepthLevel {
|
|
26
|
+
price: number;
|
|
27
|
+
volume: number;
|
|
28
|
+
}
|
|
29
|
+
export interface DepthData {
|
|
30
|
+
bids: DepthLevel[];
|
|
31
|
+
asks: DepthLevel[];
|
|
32
|
+
}
|
|
33
|
+
export interface TradingConfig {
|
|
34
|
+
enabled: boolean;
|
|
35
|
+
orderColors?: {
|
|
36
|
+
buy?: string;
|
|
37
|
+
sell?: string;
|
|
38
|
+
};
|
|
39
|
+
positionColors?: {
|
|
40
|
+
profit?: string;
|
|
41
|
+
loss?: string;
|
|
42
|
+
entry?: string;
|
|
43
|
+
};
|
|
44
|
+
depthOverlay?: {
|
|
45
|
+
enabled?: boolean;
|
|
46
|
+
bidColor?: string;
|
|
47
|
+
askColor?: string;
|
|
48
|
+
maxWidth?: number;
|
|
49
|
+
};
|
|
50
|
+
contextMenu?: {
|
|
51
|
+
enabled?: boolean;
|
|
52
|
+
};
|
|
53
|
+
pricePrecision?: number;
|
|
54
|
+
dragThreshold?: number;
|
|
55
|
+
}
|
|
56
|
+
export interface OrderPlaceIntent {
|
|
57
|
+
side: OrderSide;
|
|
58
|
+
type: OrderType;
|
|
59
|
+
price: number;
|
|
60
|
+
stopPrice?: number;
|
|
61
|
+
quantity?: number;
|
|
62
|
+
}
|
|
63
|
+
export interface OrderModifyIntent {
|
|
64
|
+
orderId: string;
|
|
65
|
+
newPrice: number;
|
|
66
|
+
previousPrice: number;
|
|
67
|
+
}
|
|
68
|
+
export interface OrderCancelIntent {
|
|
69
|
+
orderId: string;
|
|
70
|
+
}
|
|
71
|
+
export interface PositionModifyIntent {
|
|
72
|
+
positionId: string;
|
|
73
|
+
stopLoss?: number;
|
|
74
|
+
takeProfit?: number;
|
|
75
|
+
}
|
|
76
|
+
export interface PositionCloseIntent {
|
|
77
|
+
positionId: string;
|
|
78
|
+
}
|
|
79
|
+
export declare const DEFAULT_TRADING_CONFIG: TradingConfig;
|
|
80
|
+
//# sourceMappingURL=trading.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trading.d.ts","sourceRoot":"","sources":["../../src/types/trading.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../../src/utils/color.ts"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,SAAI,GAAG,MAAM,CAKxD;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAS9D"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { OHLCBar, DataSeries } from '../types/ohlc.js';
|
|
2
|
+
export declare function sliceVisibleData(data: DataSeries, from: number, to: number): DataSeries;
|
|
3
|
+
export declare function findBarIndex(data: DataSeries, timestamp: number): number;
|
|
4
|
+
export declare function computePriceRange(data: DataSeries, from: number, to: number, padding?: number): {
|
|
5
|
+
min: number;
|
|
6
|
+
max: number;
|
|
7
|
+
};
|
|
8
|
+
export declare function mergeBar(existing: OHLCBar, tick: {
|
|
9
|
+
price: number;
|
|
10
|
+
volume?: number;
|
|
11
|
+
time: number;
|
|
12
|
+
}): OHLCBar;
|
|
13
|
+
//# sourceMappingURL=data.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src/utils/data.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE5D,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,GACT,UAAU,CAIZ;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAUxE;AAED,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,OAAO,SAAO,GACb;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAgB9B;AAED,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAS3G"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function clamp(value: number, min: number, max: number): number;
|
|
2
|
+
export declare function lerp(a: number, b: number, t: number): number;
|
|
3
|
+
export declare function inverseLerp(a: number, b: number, value: number): number;
|
|
4
|
+
export declare function roundToStep(value: number, step: number): number;
|
|
5
|
+
export declare function niceNumber(value: number, round: boolean): number;
|
|
6
|
+
export declare function computeTickStep(min: number, max: number, maxTicks: number): number;
|
|
7
|
+
//# sourceMappingURL=math.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"math.d.ts","sourceRoot":"","sources":["../../src/utils/math.ts"],"names":[],"mappings":"AAAA,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAErE;AAED,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAGvE;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,CAgBhE;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAGlF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"precision.d.ts","sourceRoot":"","sources":["../../src/utils/precision.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,SAAI,GAAG,MAAM,CAEhE;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKlD;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAUxD"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { TimeFrame } from '../types/ohlc.js';
|
|
2
|
+
export declare function timeframeToMs(tf: TimeFrame): number;
|
|
3
|
+
export declare function formatTimestamp(timestamp: number, tf: TimeFrame): string;
|
|
4
|
+
export declare function alignToTimeframe(timestamp: number, tf: TimeFrame): number;
|
|
5
|
+
//# sourceMappingURL=time.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../src/utils/time.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AA+BlD,wBAAgB,aAAa,CAAC,EAAE,EAAE,SAAS,GAAG,MAAM,CAEnD;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,GAAG,MAAM,CAUxE;AAED,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,GAAG,MAAM,CAGzE"}
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tradecanvas/commons",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Shared types and utilities for @tradecanvas/chart",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/bonguynvan/chart-lib-pnpm.git",
|
|
10
|
+
"directory": "packages/commons"
|
|
11
|
+
},
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"access": "public"
|
|
14
|
+
},
|
|
15
|
+
"sideEffects": false,
|
|
16
|
+
"keywords": ["trading", "chart", "canvas", "types"],
|
|
17
|
+
"main": "./dist/index.cjs",
|
|
18
|
+
"module": "./dist/index.js",
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"import": "./dist/index.js",
|
|
24
|
+
"require": "./dist/index.cjs"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"files": ["dist"],
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": "vite build",
|
|
30
|
+
"dev": "vite build --watch",
|
|
31
|
+
"clean": "rm -rf dist",
|
|
32
|
+
"prepublishOnly": "pnpm build"
|
|
33
|
+
}
|
|
34
|
+
}
|