@tidal-ts/core 0.29.0 → 0.31.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/derive.d.ts CHANGED
@@ -114,6 +114,13 @@ export declare function underPrefix(input: DeriveInput, prefix: string): DeriveI
114
114
  export declare function readsColumn(spec: DeriveSpec, test: (column: string) => boolean): boolean;
115
115
  /** Whether any raw column `spec` reads, at any depth, starts with `prefix`. */
116
116
  export declare const readsPrefix: (spec: DeriveSpec, prefix: string) => boolean;
117
+ /**
118
+ * The locked symbols an input reads, in first-read order: `['SPY']` for a raw
119
+ * `cmp_@SPY_volume` column, or a spec with one as a leaf at any depth. A host fetches each one's series
120
+ * before folding — a compare with a leg PINNED to a ticker reads its columns
121
+ * whether or not any data source is locked to it.
122
+ */
123
+ export declare function pinnedSymbolsOf(input: DeriveInput): string[];
117
124
  /** The two-input (pair) subset of {@link DeriveOp}. */
118
125
  export type PairOp = 'diff' | 'ratio' | 'logRatio';
119
126
  /** True if `op` takes a second input. */
package/dist/derive.js CHANGED
@@ -159,6 +159,27 @@ export function readsColumn(spec, test) {
159
159
  }
160
160
  /** Whether any raw column `spec` reads, at any depth, starts with `prefix`. */
161
161
  export const readsPrefix = (spec, prefix) => readsColumn(spec, (column) => column.startsWith(prefix));
162
+ /**
163
+ * The locked symbols an input reads, in first-read order: `['SPY']` for a raw
164
+ * `cmp_@SPY_volume` column, or a spec with one as a leaf at any depth. A host fetches each one's series
165
+ * before folding — a compare with a leg PINNED to a ticker reads its columns
166
+ * whether or not any data source is locked to it.
167
+ */
168
+ export function pinnedSymbolsOf(input) {
169
+ const out = [];
170
+ const spec = typeof input === 'string' || isPickedInput(input) ? { op: 'pinned', inputs: [input] } : input;
171
+ readsColumn(spec, (column) => {
172
+ const prefix = otherPrefixOf(column);
173
+ const symbol = prefix ? parseOtherPrefix(prefix)?.symbol : undefined;
174
+ if (symbol && symbol !== COMPARE_PREFIX) {
175
+ const name = symbol.slice(COMPARE_PREFIX.length + 1, -1);
176
+ if (!out.includes(name))
177
+ out.push(name);
178
+ }
179
+ return false;
180
+ });
181
+ return out;
182
+ }
162
183
  /** True if `op` takes a second input. */
163
184
  export const isPairOp = (op) => op === 'diff' || op === 'ratio' || op === 'logRatio';
164
185
  /** True if an input picks one output of a nested spec. Total over persisted
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ export { BAR_INTERVAL_MS, type Instrument, type InstrumentKind, type BarInterval
2
2
  export { generatePriceSeries, buildPriceSeries, DEMO_INSTRUMENTS, PRICE_SCHEMA, type PriceSeriesOptions, type PriceSeries, type PriceRow, } from './fixture.js';
3
3
  export { generateVolSeries, buildVolSeries, VOL_SCHEMA, VOL_TENORS, DEFAULT_VOL_TENOR, impliedCol, hvCol, rvCol, rvCenCol, skewCol, type VolSeries, type VolColumns, type VolTenor, type VolSeriesOptions, } from './vol.js';
4
4
  export { aggregateColumn, floorToWindow, liveWindowMs, ohlcWindow, sessionGrid, WINDOW_MS, WINDOW_LADDER, MIN_BAR_PX, autoBarWindow, type BarReducer, type SeriesWindow, } from './aggregate.js';
5
- export { applyDerived, applyDerivedReport, COMPARE_PREFIX, pinnedPrefix, isPinnableSymbol, underPrefix, readsPrefix, readsColumn, stripOtherSymbol, sourcePrefix, isSourceKey, parseOtherPrefix, otherPrefixOf, deriveId, deriveLineage, inputNames, substituteInput, hasPairOp, isBrokenId, isPairOp, isValidSpec, opHasPeriod, PERIOD_BOUNDS, readNumericColumn, partStudyLabel, readPart, readPairParts, specUnit, studyCatalog, TIDAL_OPS, BAND_OUTPUTS, opParams, isStudyOp, studyTag, opIsBand, opInputs, opIsMulti, opOutputs, primaryOutput, studyInputOf, studyPick, fanPick, withFanOutput, withStudyOutput, studyColumn, BAR_PRICE_COLUMNS, withStudyColumn, type StudyPick, isPickedInput, opNeedsColumns, TARGET_ROLES, opSharesSourceAxis, type OpParam, usesCompare, type DeriveSkip, type DeriveNodeTiming, type PairPart, type PartStudy, type StudyOption, type NumericColumnReader, DEFAULT_PERIOD, type DeriveInput, type PickedDeriveOutput, type DeriveSpec, type DeriveOp, type TidalOp, type PairOp, } from './derive.js';
5
+ export { applyDerived, applyDerivedReport, COMPARE_PREFIX, pinnedPrefix, isPinnableSymbol, underPrefix, readsPrefix, pinnedSymbolsOf, readsColumn, stripOtherSymbol, sourcePrefix, isSourceKey, parseOtherPrefix, otherPrefixOf, deriveId, deriveLineage, inputNames, substituteInput, hasPairOp, isBrokenId, isPairOp, isValidSpec, opHasPeriod, PERIOD_BOUNDS, readNumericColumn, partStudyLabel, readPart, readPairParts, specUnit, studyCatalog, TIDAL_OPS, BAND_OUTPUTS, opParams, isStudyOp, studyTag, opIsBand, opInputs, opIsMulti, opOutputs, primaryOutput, studyInputOf, studyPick, fanPick, withFanOutput, withStudyOutput, studyColumn, BAR_PRICE_COLUMNS, withStudyColumn, type StudyPick, isPickedInput, opNeedsColumns, TARGET_ROLES, opSharesSourceAxis, type OpParam, usesCompare, type DeriveSkip, type DeriveNodeTiming, type PairPart, type PartStudy, type StudyOption, type NumericColumnReader, DEFAULT_PERIOD, type DeriveInput, type PickedDeriveOutput, type DeriveSpec, type DeriveOp, type TidalOp, type PairOp, } from './derive.js';
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';
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ export { BAR_INTERVAL_MS, } from './types.js';
2
2
  export { generatePriceSeries, buildPriceSeries, DEMO_INSTRUMENTS, PRICE_SCHEMA, } from './fixture.js';
3
3
  export { generateVolSeries, buildVolSeries, VOL_SCHEMA, VOL_TENORS, DEFAULT_VOL_TENOR, impliedCol, hvCol, rvCol, rvCenCol, skewCol, } from './vol.js';
4
4
  export { aggregateColumn, floorToWindow, liveWindowMs, ohlcWindow, sessionGrid, WINDOW_MS, WINDOW_LADDER, MIN_BAR_PX, autoBarWindow, } from './aggregate.js';
5
- export { applyDerived, applyDerivedReport, COMPARE_PREFIX, pinnedPrefix, isPinnableSymbol, underPrefix, readsPrefix, readsColumn, stripOtherSymbol, sourcePrefix, isSourceKey, parseOtherPrefix, otherPrefixOf, deriveId, deriveLineage, inputNames, substituteInput, hasPairOp, isBrokenId, isPairOp, isValidSpec, opHasPeriod, PERIOD_BOUNDS, readNumericColumn, partStudyLabel, readPart, readPairParts, specUnit, studyCatalog, TIDAL_OPS, BAND_OUTPUTS, opParams, isStudyOp, studyTag, opIsBand, opInputs, opIsMulti, opOutputs, primaryOutput, studyInputOf, studyPick, fanPick, withFanOutput, withStudyOutput, studyColumn, BAR_PRICE_COLUMNS, withStudyColumn, isPickedInput, opNeedsColumns, TARGET_ROLES, opSharesSourceAxis, usesCompare, DEFAULT_PERIOD, } from './derive.js';
5
+ export { applyDerived, applyDerivedReport, COMPARE_PREFIX, pinnedPrefix, isPinnableSymbol, underPrefix, readsPrefix, pinnedSymbolsOf, readsColumn, stripOtherSymbol, sourcePrefix, isSourceKey, parseOtherPrefix, otherPrefixOf, deriveId, deriveLineage, inputNames, substituteInput, hasPairOp, isBrokenId, isPairOp, isValidSpec, opHasPeriod, PERIOD_BOUNDS, readNumericColumn, partStudyLabel, readPart, readPairParts, specUnit, studyCatalog, TIDAL_OPS, BAND_OUTPUTS, opParams, isStudyOp, studyTag, opIsBand, opInputs, opIsMulti, opOutputs, primaryOutput, studyInputOf, studyPick, fanPick, withFanOutput, withStudyOutput, studyColumn, BAR_PRICE_COLUMNS, withStudyColumn, isPickedInput, opNeedsColumns, TARGET_ROLES, opSharesSourceAxis, usesCompare, DEFAULT_PERIOD, } from './derive.js';
6
6
  export { joinUnderPrefix } from './join.js';
7
7
  export { columnExtent } from './extent.js';
8
8
  export { snapshotToTimeSeries, appendToRows, } from './columnar.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tidal-ts/core",
3
- "version": "0.29.0",
3
+ "version": "0.31.0",
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",