pinets 0.9.2 → 0.9.3
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/pinets.min.browser.es.js +20 -20
- package/dist/pinets.min.browser.es.js.map +1 -1
- package/dist/pinets.min.browser.js +20 -20
- package/dist/pinets.min.browser.js.map +1 -1
- package/dist/pinets.min.cjs +16 -16
- package/dist/pinets.min.cjs.map +1 -1
- package/dist/pinets.min.es.js +21 -21
- package/dist/pinets.min.es.js.map +1 -1
- package/dist/types/Context.class.d.ts +10 -0
- package/dist/types/PineTS.class.d.ts +9 -0
- package/dist/types/namespaces/array/methods/new_box.d.ts +2 -0
- package/dist/types/namespaces/array/methods/new_color.d.ts +2 -0
- package/dist/types/namespaces/array/methods/new_label.d.ts +2 -0
- package/dist/types/namespaces/array/methods/new_line.d.ts +2 -0
- package/dist/types/namespaces/array/methods/new_linefill.d.ts +2 -0
- package/dist/types/namespaces/array/methods/new_table.d.ts +2 -0
- package/dist/types/namespaces/box/BoxHelper.d.ts +12 -0
- package/dist/types/namespaces/box/BoxObject.d.ts +29 -0
- package/dist/types/namespaces/label/LabelHelper.d.ts +5 -0
- package/dist/types/namespaces/label/LabelObject.d.ts +20 -0
- package/dist/types/namespaces/line/LineHelper.d.ts +5 -0
- package/dist/types/namespaces/line/LineObject.d.ts +21 -0
- package/dist/types/namespaces/linefill/LinefillHelper.d.ts +5 -0
- package/dist/types/namespaces/linefill/LinefillObject.d.ts +2 -0
- package/dist/types/namespaces/polyline/PolylineHelper.d.ts +5 -0
- package/dist/types/namespaces/polyline/PolylineObject.d.ts +2 -0
- package/dist/types/namespaces/request/utils/TIMEFRAMES.d.ts +1 -0
- package/dist/types/namespaces/request/utils/findSecContextIdx.d.ts +1 -1
- package/dist/types/types/PineTypes.d.ts +1 -1
- package/package.json +1 -1
|
@@ -12,9 +12,14 @@ export declare class Context {
|
|
|
12
12
|
cache: any;
|
|
13
13
|
taState: any;
|
|
14
14
|
isSecondaryContext: boolean;
|
|
15
|
+
dataVersion: number;
|
|
15
16
|
NA: any;
|
|
16
17
|
lang: any;
|
|
17
18
|
length: number;
|
|
19
|
+
/** References to drawing helpers for streaming rollback */
|
|
20
|
+
_drawingHelpers: {
|
|
21
|
+
rollbackFromBar(barIdx: number): void;
|
|
22
|
+
}[];
|
|
18
23
|
pine: {
|
|
19
24
|
[key: string]: any;
|
|
20
25
|
};
|
|
@@ -48,6 +53,11 @@ export declare class Context {
|
|
|
48
53
|
fullContext?: Context;
|
|
49
54
|
inputs?: Record<string, any>;
|
|
50
55
|
});
|
|
56
|
+
/**
|
|
57
|
+
* Roll back all drawing objects created at or after the given bar index.
|
|
58
|
+
* Called during streaming updates to prevent accumulation when bars are re-processed.
|
|
59
|
+
*/
|
|
60
|
+
rollbackDrawings(fromBarIdx: number): void;
|
|
51
61
|
private bindContextObject;
|
|
52
62
|
/**
|
|
53
63
|
* this function is used to initialize the target variable with the source array
|
|
@@ -108,6 +108,15 @@ export declare class PineTS {
|
|
|
108
108
|
* @private
|
|
109
109
|
*/
|
|
110
110
|
private _appendCandle;
|
|
111
|
+
/**
|
|
112
|
+
* Update the secondary context's tail with fresh market data.
|
|
113
|
+
* Mirrors the streaming update logic in _runPaginated:
|
|
114
|
+
* fetches new/updated candles, rolls back the last result, and re-executes
|
|
115
|
+
* only the affected bars.
|
|
116
|
+
* @param context - The cached secondary context to update
|
|
117
|
+
* @returns true if data was updated, false if no changes
|
|
118
|
+
*/
|
|
119
|
+
updateTail(context: Context): Promise<boolean>;
|
|
111
120
|
/**
|
|
112
121
|
* Remove the last result from context (for updating an open candle)
|
|
113
122
|
* @private
|
|
@@ -9,6 +9,12 @@ export declare class BoxHelper {
|
|
|
9
9
|
private _syncToPlot;
|
|
10
10
|
private _resolvePoint;
|
|
11
11
|
private _resolve;
|
|
12
|
+
/**
|
|
13
|
+
* Resolve a color value, preserving NaN (na) so renderers can detect "no color".
|
|
14
|
+
* The regular `_resolve(val) || fallback` pattern treats NaN as falsy and replaces
|
|
15
|
+
* it with the default, losing the explicit `border_color = na` intent.
|
|
16
|
+
*/
|
|
17
|
+
private _resolveColor;
|
|
12
18
|
private _createBox;
|
|
13
19
|
new(...args: any[]): BoxObject;
|
|
14
20
|
any(...args: any[]): BoxObject;
|
|
@@ -41,4 +47,10 @@ export declare class BoxHelper {
|
|
|
41
47
|
copy(id: BoxObject): BoxObject | undefined;
|
|
42
48
|
delete(id: BoxObject): void;
|
|
43
49
|
get all(): BoxObject[];
|
|
50
|
+
/**
|
|
51
|
+
* Remove all drawing objects created at or after the given bar index,
|
|
52
|
+
* and un-delete objects that were deleted during rolled-back bars.
|
|
53
|
+
* Called during streaming rollback to prevent accumulation.
|
|
54
|
+
*/
|
|
55
|
+
rollbackFromBar(barIdx: number): void;
|
|
44
56
|
}
|
|
@@ -21,7 +21,36 @@ export declare class BoxObject {
|
|
|
21
21
|
text_formatting: string;
|
|
22
22
|
force_overlay: boolean;
|
|
23
23
|
_deleted: boolean;
|
|
24
|
+
_helper: any;
|
|
25
|
+
/** Bar index at which this object was created (for streaming rollback) */
|
|
26
|
+
_createdAtBar: number;
|
|
24
27
|
constructor(left: number, top: number, right: number, bottom: number, xloc?: string, extend?: string, border_color?: string, border_style?: string, border_width?: number, bgcolor?: string, text?: string, text_color?: string, text_size?: string, text_halign?: string, text_valign?: string, text_wrap?: string, text_font_family?: string, text_formatting?: string, force_overlay?: boolean);
|
|
28
|
+
set_left(left: number): void;
|
|
29
|
+
set_right(right: number): void;
|
|
30
|
+
set_top(top: number): void;
|
|
31
|
+
set_bottom(bottom: number): void;
|
|
32
|
+
set_lefttop(left: number, top: number): void;
|
|
33
|
+
set_rightbottom(right: number, bottom: number): void;
|
|
34
|
+
set_top_left_point(point: any): void;
|
|
35
|
+
set_bottom_right_point(point: any): void;
|
|
36
|
+
set_xloc(left: number, right: number, xloc: string): void;
|
|
37
|
+
set_bgcolor(color: string): void;
|
|
38
|
+
set_border_color(color: string): void;
|
|
39
|
+
set_border_width(width: number): void;
|
|
40
|
+
set_border_style(style: string): void;
|
|
41
|
+
set_extend(extend: string): void;
|
|
42
|
+
set_text(text: string): void;
|
|
43
|
+
set_text_color(color: string): void;
|
|
44
|
+
set_text_size(size: string): void;
|
|
45
|
+
set_text_halign(align: string): void;
|
|
46
|
+
set_text_valign(align: string): void;
|
|
47
|
+
set_text_wrap(wrap: string): void;
|
|
48
|
+
set_text_font_family(family: string): void;
|
|
49
|
+
set_text_formatting(formatting: string): void;
|
|
50
|
+
get_left(): number;
|
|
51
|
+
get_right(): number;
|
|
52
|
+
get_top(): number;
|
|
53
|
+
get_bottom(): number;
|
|
25
54
|
delete(): void;
|
|
26
55
|
copy(): BoxObject;
|
|
27
56
|
}
|
|
@@ -36,6 +36,11 @@ export declare class LabelHelper {
|
|
|
36
36
|
copy(id: LabelObject): LabelObject | undefined;
|
|
37
37
|
delete(id: LabelObject): void;
|
|
38
38
|
get all(): LabelObject[];
|
|
39
|
+
/**
|
|
40
|
+
* Remove all drawing objects created at or after the given bar index.
|
|
41
|
+
* Called during streaming rollback to prevent accumulation.
|
|
42
|
+
*/
|
|
43
|
+
rollbackFromBar(barIdx: number): void;
|
|
39
44
|
get style_label_down(): string;
|
|
40
45
|
get style_label_up(): string;
|
|
41
46
|
get style_label_left(): string;
|
|
@@ -15,7 +15,27 @@ export declare class LabelObject {
|
|
|
15
15
|
text_font_family: string;
|
|
16
16
|
force_overlay: boolean;
|
|
17
17
|
_deleted: boolean;
|
|
18
|
+
_helper: any;
|
|
19
|
+
/** Bar index at which this object was created (for streaming rollback) */
|
|
20
|
+
_createdAtBar: number;
|
|
18
21
|
constructor(x: number, y: number, text?: string, xloc?: string, yloc?: string, color?: string, style?: string, textcolor?: string, size?: string, textalign?: string, tooltip?: string, text_font_family?: string, force_overlay?: boolean);
|
|
22
|
+
set_x(x: number): void;
|
|
23
|
+
set_y(y: number): void;
|
|
24
|
+
set_xy(x: number, y: number): void;
|
|
25
|
+
set_text(text: string): void;
|
|
26
|
+
set_color(color: string): void;
|
|
27
|
+
set_textcolor(textcolor: string): void;
|
|
28
|
+
set_size(size: string): void;
|
|
29
|
+
set_style(style: string): void;
|
|
30
|
+
set_textalign(textalign: string): void;
|
|
31
|
+
set_tooltip(tooltip: string): void;
|
|
32
|
+
set_xloc(xloc: string): void;
|
|
33
|
+
set_yloc(yloc: string): void;
|
|
34
|
+
set_point(point: any): void;
|
|
35
|
+
set_text_font_family(family: string): void;
|
|
36
|
+
get_x(): number;
|
|
37
|
+
get_y(): number;
|
|
38
|
+
get_text(): string;
|
|
19
39
|
delete(): void;
|
|
20
40
|
copy(): LabelObject;
|
|
21
41
|
toPlotData(): any;
|
|
@@ -39,6 +39,11 @@ export declare class LineHelper {
|
|
|
39
39
|
copy(id: LineObject): LineObject | undefined;
|
|
40
40
|
delete(id: LineObject): void;
|
|
41
41
|
get all(): LineObject[];
|
|
42
|
+
/**
|
|
43
|
+
* Remove all drawing objects created at or after the given bar index.
|
|
44
|
+
* Called during streaming rollback to prevent accumulation.
|
|
45
|
+
*/
|
|
46
|
+
rollbackFromBar(barIdx: number): void;
|
|
42
47
|
get style_solid(): string;
|
|
43
48
|
get style_dotted(): string;
|
|
44
49
|
get style_dashed(): string;
|
|
@@ -12,7 +12,28 @@ export declare class LineObject {
|
|
|
12
12
|
width: number;
|
|
13
13
|
force_overlay: boolean;
|
|
14
14
|
_deleted: boolean;
|
|
15
|
+
_helper: any;
|
|
16
|
+
/** Bar index at which this object was created (for streaming rollback) */
|
|
17
|
+
_createdAtBar: number;
|
|
15
18
|
constructor(x1: number, y1: number, x2: number, y2: number, xloc?: string, extend?: string, color?: string, style?: string, width?: number, force_overlay?: boolean);
|
|
19
|
+
set_x1(x: number): void;
|
|
20
|
+
set_y1(y: number): void;
|
|
21
|
+
set_x2(x: number): void;
|
|
22
|
+
set_y2(y: number): void;
|
|
23
|
+
set_xy1(x: number, y: number): void;
|
|
24
|
+
set_xy2(x: number, y: number): void;
|
|
25
|
+
set_color(color: string): void;
|
|
26
|
+
set_width(width: number): void;
|
|
27
|
+
set_style(style: string): void;
|
|
28
|
+
set_extend(extend: string): void;
|
|
29
|
+
set_xloc(x1: number, x2: number, xloc: string): void;
|
|
30
|
+
set_first_point(point: any): void;
|
|
31
|
+
set_second_point(point: any): void;
|
|
32
|
+
get_x1(): number;
|
|
33
|
+
get_y1(): number;
|
|
34
|
+
get_x2(): number;
|
|
35
|
+
get_y2(): number;
|
|
36
|
+
get_price(x: number): number;
|
|
16
37
|
delete(): void;
|
|
17
38
|
copy(): LineObject;
|
|
18
39
|
toPlotData(): any;
|
|
@@ -18,4 +18,9 @@ export declare class LinefillHelper {
|
|
|
18
18
|
get_line2(id: LinefillObject): LineObject | undefined;
|
|
19
19
|
delete(id: LinefillObject): void;
|
|
20
20
|
get all(): LinefillObject[];
|
|
21
|
+
/**
|
|
22
|
+
* Remove all drawing objects created at or after the given bar index.
|
|
23
|
+
* Called during streaming rollback to prevent accumulation.
|
|
24
|
+
*/
|
|
25
|
+
rollbackFromBar(barIdx: number): void;
|
|
21
26
|
}
|
|
@@ -6,6 +6,8 @@ export declare class LinefillObject {
|
|
|
6
6
|
line2: LineObject;
|
|
7
7
|
color: string;
|
|
8
8
|
_deleted: boolean;
|
|
9
|
+
/** Bar index at which this object was created (for streaming rollback) */
|
|
10
|
+
_createdAtBar: number;
|
|
9
11
|
constructor(line1: LineObject, line2: LineObject, color: string);
|
|
10
12
|
delete(): void;
|
|
11
13
|
}
|
|
@@ -18,4 +18,9 @@ export declare class PolylineHelper {
|
|
|
18
18
|
any(...args: any[]): PolylineObject;
|
|
19
19
|
delete(id: PolylineObject): void;
|
|
20
20
|
get all(): PolylineObject[];
|
|
21
|
+
/**
|
|
22
|
+
* Remove all drawing objects created at or after the given bar index.
|
|
23
|
+
* Called during streaming rollback to prevent accumulation.
|
|
24
|
+
*/
|
|
25
|
+
rollbackFromBar(barIdx: number): void;
|
|
21
26
|
}
|
|
@@ -12,6 +12,8 @@ export declare class PolylineObject {
|
|
|
12
12
|
line_width: number;
|
|
13
13
|
force_overlay: boolean;
|
|
14
14
|
_deleted: boolean;
|
|
15
|
+
/** Bar index at which this object was created (for streaming rollback) */
|
|
16
|
+
_createdAtBar: number;
|
|
15
17
|
constructor(points: ChartPointObject[], curved?: boolean, closed?: boolean, xloc?: string, line_color?: string, fill_color?: string, line_style?: string, line_width?: number, force_overlay?: boolean);
|
|
16
18
|
delete(): void;
|
|
17
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function findSecContextIdx(myOpenTime: number, myCloseTime: number, openTime: number[], closeTime: number[], lookahead?: boolean): number;
|
|
1
|
+
export declare function findSecContextIdx(myOpenTime: number, myCloseTime: number, openTime: number[], closeTime: number[], lookahead?: boolean, isRealtime?: boolean): number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pinets",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.3",
|
|
4
4
|
"description": "Run Pine Script anywhere. PineTS is an open-source transpiler and runtime that brings Pine Script logic to Node.js and the browser with 1:1 syntax compatibility. Reliably write, port, and run indicators or strategies on your own infrastructure.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Pine Script",
|