@hoox-sh/pynets 0.4.0 → 0.6.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/CHANGELOG.md +34 -0
- package/README.md +9 -5
- package/dist/browser.js +68 -68
- package/dist/index.js +2196 -206
- package/package.json +1 -1
- package/src/cli/rich.ts +1 -1
- package/src/generated/PinescriptLexerBase.ts +22 -4
- package/src/parser/LexerBase.ts +22 -4
- package/src/runtime/compile/draw.ts +26 -2
- package/src/runtime/compile/emit.ts +17 -0
- package/src/runtime/compile/emit_call.ts +378 -7
- package/src/runtime/compile/helpers.ts +2 -1
- package/src/runtime/compile/runtime.ts +71 -6
- package/src/runtime/compile/strategy.ts +5 -2
- package/src/runtime/footprint.ts +272 -0
- package/src/runtime/interpret.ts +621 -36
- package/src/runtime/request.ts +19 -4
- package/src/runtime/str.ts +3 -2
- package/src/runtime/strategy.ts +164 -12
- package/src/runtime/ta.ts +1090 -149
- package/src/runtime/time.ts +12 -0
package/src/runtime/time.ts
CHANGED
|
@@ -19,6 +19,18 @@ export interface UtcParts {
|
|
|
19
19
|
const MIN_T = -62_167_219_200; // ~year 0001
|
|
20
20
|
const MAX_T = 253_402_300_799; // ~year 9999
|
|
21
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Unix seconds (< 1e11) become milliseconds; millisecond stamps pass through.
|
|
24
|
+
* Python `utility._timestamp_to_ms` SoT. Chart hosts often store bar opens
|
|
25
|
+
* in seconds — `hour(time)` divides by 1000, so a seconds stamp collapses
|
|
26
|
+
* a multi-day chart into one clock hour. `null`/`na` stays `null`.
|
|
27
|
+
*/
|
|
28
|
+
export function timestampToMs(ts: number | null | undefined): number | null {
|
|
29
|
+
if (ts == null || !Number.isFinite(ts)) return null;
|
|
30
|
+
if (Math.abs(ts) < 1.0e11) return ts * 1000.0;
|
|
31
|
+
return ts;
|
|
32
|
+
}
|
|
33
|
+
|
|
22
34
|
/** Unix-ms → UTC parts. Matches Python `utc_parts_from_ms`. */
|
|
23
35
|
export function utcPartsFromMs(ms: number): UtcParts {
|
|
24
36
|
let t = Number.isFinite(ms) ? Math.trunc(ms / 1000) : 0;
|