@tidal-ts/core 0.1.2 → 0.2.1
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/derive.d.ts +5 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/sessions.d.ts +25 -0
- package/dist/sessions.js +37 -0
- package/package.json +7 -7
package/dist/derive.d.ts
CHANGED
|
@@ -390,9 +390,11 @@ export declare function specUnit(spec: DeriveSpec, unitOf: (column: string) => s
|
|
|
390
390
|
* spec's id carries the `p1?:` prefix — see {@link isBrokenId}). `code` is
|
|
391
391
|
* the engine's per-class literal (`'UnknownColumnError'` = the column isn't
|
|
392
392
|
* in this feed, could fold elsewhere → a dimmed-removable chip;
|
|
393
|
-
* `'ParamError'` = the spec itself is garbage → a broken chip
|
|
394
|
-
*
|
|
395
|
-
*
|
|
393
|
+
* `'ParamError'` = the spec itself is garbage → a broken chip;
|
|
394
|
+
* `'ArityError'` (process 0.70.0) = the wrong number of inputs, or none →
|
|
395
|
+
* also a broken chip); ABSENT code means the throw came from op code, not
|
|
396
|
+
* the plan layer. Compare the string literal, never `err.name` — bundlers
|
|
397
|
+
* rename classes. */
|
|
396
398
|
export interface DeriveSkip {
|
|
397
399
|
id: string;
|
|
398
400
|
code?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export { applyDerived, applyDerivedReport, COMPARE_PREFIX, deriveId, deriveLinea
|
|
|
6
6
|
export { joinUnderPrefix } from './join.js';
|
|
7
7
|
export { columnExtent } from './extent.js';
|
|
8
8
|
export { snapshotToTimeSeries, appendToRows, type PondSnapshot, type PondAppend, type PondValue, type WireColumnSpec, } from './columnar.js';
|
|
9
|
-
export { exactSessionSegments, inferBarMs, sessionOpenLine, sessionSegments, shiftKeys, type Segment, type SessionSegmentOptions, } from './sessions.js';
|
|
9
|
+
export { exactSessionSegments, inferBarMs, sessionOpenLine, sessionSegments, shiftKeys, sliceBySegments, type Segment, type SessionSegmentOptions, } from './sessions.js';
|
|
10
10
|
export { monthlyExpirations, thirdFriday } from './expirations.js';
|
|
11
11
|
export { holdVolAcrossGrid } from './regrid.js';
|
|
12
12
|
export { ADOPTED_STUDIES, adoptable, isBandShape, outputMark, studyNeedsColumns, } from './studyCatalog.js';
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ export { applyDerived, applyDerivedReport, COMPARE_PREFIX, deriveId, deriveLinea
|
|
|
6
6
|
export { joinUnderPrefix } from './join.js';
|
|
7
7
|
export { columnExtent } from './extent.js';
|
|
8
8
|
export { snapshotToTimeSeries, appendToRows, } from './columnar.js';
|
|
9
|
-
export { exactSessionSegments, inferBarMs, sessionOpenLine, sessionSegments, shiftKeys, } from './sessions.js';
|
|
9
|
+
export { exactSessionSegments, inferBarMs, sessionOpenLine, sessionSegments, shiftKeys, sliceBySegments, } from './sessions.js';
|
|
10
10
|
export { monthlyExpirations, thirdFriday } from './expirations.js';
|
|
11
11
|
export { holdVolAcrossGrid } from './regrid.js';
|
|
12
12
|
// The corpus adoption (TDL-STUDYCAT). `ADOPTED_STUDIES` is exported so the
|
package/dist/sessions.d.ts
CHANGED
|
@@ -113,6 +113,31 @@ export declare function inferBarMs(times: readonly number[]): number | undefined
|
|
|
113
113
|
* belongs behind a per-fetch memo, never in a render path.
|
|
114
114
|
*/
|
|
115
115
|
export declare function shiftKeys(series: TimeSeries<SeriesSchema>, ms: number): TimeSeries<SeriesSchema>;
|
|
116
|
+
/**
|
|
117
|
+
* The series cut into one sub-series per live segment — `[start, end)` on the
|
|
118
|
+
* time key, empty segments dropped.
|
|
119
|
+
*
|
|
120
|
+
* For the layer pond gives no `sessionBreaks` of its own — `<AreaChart>`
|
|
121
|
+
* (`<LineChart>` has always had it; `<BandChart>` gained it in charts 0.70.0,
|
|
122
|
+
* which retired this function's other caller). A fill drawn across a
|
|
123
|
+
* collapsed overnight gap bridges seventeen hours of closed market in one
|
|
124
|
+
* confident sweep and contradicts the line drawn over it; one layer per segment
|
|
125
|
+
* ends the fill at the close and restarts it at the open, which is what that
|
|
126
|
+
* line already does. The cost is `segments.length` layers instead of one, so a
|
|
127
|
+
* caller asks only when the axis actually collapses.
|
|
128
|
+
*
|
|
129
|
+
* Pond does the cutting — `bisect` finds each edge in O(log n) on the packed key
|
|
130
|
+
* buffer and `slice` is positional and half-open — so nothing here is
|
|
131
|
+
* materialised or rebuilt. Segments must be ascending and non-overlapping, which
|
|
132
|
+
* is what `sessionSegments` / `exactSessionSegments` produce; no segments means
|
|
133
|
+
* nothing is known to be closed, and the series comes back whole.
|
|
134
|
+
*
|
|
135
|
+
* **Cut before you shift.** A series whose keys were moved to the bar's END
|
|
136
|
+
* (`shiftKeys`) puts every session's last point exactly ON its segment's end,
|
|
137
|
+
* which the half-open bound excludes — one close lost per session, at the seam,
|
|
138
|
+
* where it shows. Slice the raw series and shift each slice.
|
|
139
|
+
*/
|
|
140
|
+
export declare function sliceBySegments(series: TimeSeries<SeriesSchema>, segments: readonly Segment[]): TimeSeries<SeriesSchema>[];
|
|
116
141
|
/**
|
|
117
142
|
* The price path a session actually traced: its **open**, then every close.
|
|
118
143
|
*
|
package/dist/sessions.js
CHANGED
|
@@ -178,6 +178,43 @@ export function shiftKeys(series, ms) {
|
|
|
178
178
|
columns: { ...out.columns, [key]: shifted },
|
|
179
179
|
});
|
|
180
180
|
}
|
|
181
|
+
/**
|
|
182
|
+
* The series cut into one sub-series per live segment — `[start, end)` on the
|
|
183
|
+
* time key, empty segments dropped.
|
|
184
|
+
*
|
|
185
|
+
* For the layer pond gives no `sessionBreaks` of its own — `<AreaChart>`
|
|
186
|
+
* (`<LineChart>` has always had it; `<BandChart>` gained it in charts 0.70.0,
|
|
187
|
+
* which retired this function's other caller). A fill drawn across a
|
|
188
|
+
* collapsed overnight gap bridges seventeen hours of closed market in one
|
|
189
|
+
* confident sweep and contradicts the line drawn over it; one layer per segment
|
|
190
|
+
* ends the fill at the close and restarts it at the open, which is what that
|
|
191
|
+
* line already does. The cost is `segments.length` layers instead of one, so a
|
|
192
|
+
* caller asks only when the axis actually collapses.
|
|
193
|
+
*
|
|
194
|
+
* Pond does the cutting — `bisect` finds each edge in O(log n) on the packed key
|
|
195
|
+
* buffer and `slice` is positional and half-open — so nothing here is
|
|
196
|
+
* materialised or rebuilt. Segments must be ascending and non-overlapping, which
|
|
197
|
+
* is what `sessionSegments` / `exactSessionSegments` produce; no segments means
|
|
198
|
+
* nothing is known to be closed, and the series comes back whole.
|
|
199
|
+
*
|
|
200
|
+
* **Cut before you shift.** A series whose keys were moved to the bar's END
|
|
201
|
+
* (`shiftKeys`) puts every session's last point exactly ON its segment's end,
|
|
202
|
+
* which the half-open bound excludes — one close lost per session, at the seam,
|
|
203
|
+
* where it shows. Slice the raw series and shift each slice.
|
|
204
|
+
*/
|
|
205
|
+
export function sliceBySegments(series, segments) {
|
|
206
|
+
if (segments.length === 0)
|
|
207
|
+
return [series];
|
|
208
|
+
const s = series;
|
|
209
|
+
const out = [];
|
|
210
|
+
for (const [start, end] of segments) {
|
|
211
|
+
const lo = s.bisect(start);
|
|
212
|
+
const hi = s.bisect(end);
|
|
213
|
+
if (hi > lo)
|
|
214
|
+
out.push(s.slice(lo, hi));
|
|
215
|
+
}
|
|
216
|
+
return out;
|
|
217
|
+
}
|
|
181
218
|
/**
|
|
182
219
|
* The price path a session actually traced: its **open**, then every close.
|
|
183
220
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tidal-ts/core",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Financial time-series vocabulary on pond-ts: the study/derive seam, the vol schema, bar windows, the columnar adapter and session helpers.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -31,14 +31,14 @@
|
|
|
31
31
|
"access": "public"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@pond-ts/financial": "^0.
|
|
35
|
-
"@pond-ts/process": "0.
|
|
36
|
-
"pond-ts": "^0.
|
|
34
|
+
"@pond-ts/financial": "^0.70.0",
|
|
35
|
+
"@pond-ts/process": "0.70.0",
|
|
36
|
+
"pond-ts": "^0.70.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@pond-ts/financial": "^0.
|
|
40
|
-
"@pond-ts/process": "0.
|
|
41
|
-
"pond-ts": "^0.
|
|
39
|
+
"@pond-ts/financial": "^0.70.0",
|
|
40
|
+
"@pond-ts/process": "0.70.0",
|
|
41
|
+
"pond-ts": "^0.70.0",
|
|
42
42
|
"typescript": "^5.7.2",
|
|
43
43
|
"vitest": "^2.1.8"
|
|
44
44
|
},
|