pinets 0.9.9 → 0.9.11
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 +17 -17
- package/dist/pinets.min.browser.es.js.map +1 -1
- package/dist/pinets.min.browser.js +17 -17
- package/dist/pinets.min.browser.js.map +1 -1
- package/dist/pinets.min.cjs +17 -17
- package/dist/pinets.min.cjs.map +1 -1
- package/dist/pinets.min.es.js +17 -17
- package/dist/pinets.min.es.js.map +1 -1
- package/dist/types/PineTS.class.d.ts +28 -0
- package/dist/types/namespaces/Time.d.ts +15 -1
- package/dist/types/namespaces/Timeframe.d.ts +8 -0
- package/dist/types/namespaces/box/BoxHelper.d.ts +5 -0
- package/dist/types/namespaces/label/LabelHelper.d.ts +1 -0
- package/dist/types/namespaces/line/LineHelper.d.ts +1 -0
- package/dist/types/namespaces/polyline/PolylineHelper.d.ts +1 -0
- package/package.json +1 -1
|
@@ -148,6 +148,34 @@ export declare class PineTS {
|
|
|
148
148
|
* @private
|
|
149
149
|
*/
|
|
150
150
|
private _removeLastResult;
|
|
151
|
+
/**
|
|
152
|
+
* Snapshot the var/let/const/params Series state for streaming rollback.
|
|
153
|
+
* Captures the data array length and last value for each variable so we can
|
|
154
|
+
* restore to this exact state before re-executing the last bar.
|
|
155
|
+
*
|
|
156
|
+
* PERF NOTE: This currently snapshots ALL scopes (const, var, let, params).
|
|
157
|
+
* In practice, only `var` variables need snapshot/restore because:
|
|
158
|
+
* - `let` variables are re-initialized every bar via $.init() — they reset naturally
|
|
159
|
+
* - `const` variables are set once and never modified
|
|
160
|
+
* - `params` are function parameters, not modified across bars
|
|
161
|
+
* Only `var` variables persist and get modified in-place by $.set() (e.g. n += 1),
|
|
162
|
+
* which causes drift on streaming re-execution.
|
|
163
|
+
* If this becomes a bottleneck, narrow to `['var']` only.
|
|
164
|
+
*
|
|
165
|
+
* An even lighter alternative: make $.set() on var Series append-only (push
|
|
166
|
+
* instead of in-place modify). Then the existing pop-based _removeLastResult
|
|
167
|
+
* would correctly revert var state without any snapshot. This would require
|
|
168
|
+
* changes to the core Series/set mechanics.
|
|
169
|
+
*
|
|
170
|
+
* @private
|
|
171
|
+
*/
|
|
172
|
+
private _snapshotVarState;
|
|
173
|
+
/**
|
|
174
|
+
* Restore var/let/const/params Series state from a snapshot.
|
|
175
|
+
* Truncates each Series' data array back to the snapshotted length.
|
|
176
|
+
* @private
|
|
177
|
+
*/
|
|
178
|
+
private _restoreVarState;
|
|
151
179
|
/**
|
|
152
180
|
* Initialize a new context for running Pine Script code
|
|
153
181
|
* @private
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalize a Pine Script timeframe string to a canonical form.
|
|
3
|
+
* e.g. "1D" → "D", "60" → "60", "1W" → "W", "" → ""
|
|
4
|
+
*/
|
|
5
|
+
export declare function normalizeTimeframe(tf: string): string;
|
|
6
|
+
/**
|
|
7
|
+
* Compute the opening timestamp of the higher-timeframe bar that contains the given timestamp.
|
|
8
|
+
*
|
|
9
|
+
* For intraday TFs (minutes): floor to the nearest multiple of the TF duration within the day.
|
|
10
|
+
* For daily: floor to UTC day start (00:00 UTC).
|
|
11
|
+
* For weekly: floor to Monday 00:00 UTC.
|
|
12
|
+
* For monthly: floor to 1st of month 00:00 UTC.
|
|
13
|
+
*/
|
|
14
|
+
export declare function alignToTimeframe(timestamp: number, tf: string): number;
|
|
1
15
|
interface DateParts {
|
|
2
16
|
year: number;
|
|
3
17
|
month: number;
|
|
@@ -28,7 +42,7 @@ export declare class TimeHelper {
|
|
|
28
42
|
constructor(context: any, dataField?: string);
|
|
29
43
|
get __value(): any;
|
|
30
44
|
param(source: any, index?: number): any;
|
|
31
|
-
any(...args: any[]):
|
|
45
|
+
any(...args: any[]): number;
|
|
32
46
|
/**
|
|
33
47
|
* Basic session check: parses "HHMM-HHMM" format and tests if
|
|
34
48
|
* the timestamp falls within the session window.
|
|
@@ -17,6 +17,14 @@ export declare class Timeframe {
|
|
|
17
17
|
get isseconds(): boolean;
|
|
18
18
|
get isminutes(): boolean;
|
|
19
19
|
get isintraday(): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Detects changes in the specified timeframe.
|
|
22
|
+
* Returns true on the first bar of a new HTF period, false otherwise.
|
|
23
|
+
*
|
|
24
|
+
* Works by aligning current and previous bar timestamps to the target
|
|
25
|
+
* timeframe and comparing — if they differ, a new period has started.
|
|
26
|
+
*/
|
|
27
|
+
change(timeframe: any): boolean;
|
|
20
28
|
from_seconds(seconds: number): string | number;
|
|
21
29
|
in_seconds(timeframe?: string): number;
|
|
22
30
|
}
|
|
@@ -16,6 +16,11 @@ export declare class BoxHelper {
|
|
|
16
16
|
*/
|
|
17
17
|
private _resolveColor;
|
|
18
18
|
private _createBox;
|
|
19
|
+
/**
|
|
20
|
+
* Enforce max_boxes_count: auto-delete the oldest non-deleted boxes
|
|
21
|
+
* when the active count exceeds the limit (FIFO eviction).
|
|
22
|
+
*/
|
|
23
|
+
private _enforceMaxCount;
|
|
19
24
|
new(...args: any[]): BoxObject;
|
|
20
25
|
any(...args: any[]): BoxObject;
|
|
21
26
|
set_left(id: BoxObject, left: number): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pinets",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.11",
|
|
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",
|