@tidal-ts/core 0.5.1 → 0.7.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/index.d.ts CHANGED
@@ -9,5 +9,5 @@ export { snapshotToTimeSeries, appendToRows, type PondSnapshot, type PondAppend,
9
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
- export { ADOPTED_STUDIES, adoptable, isBandShape, outputMark, studyNeedsColumns, } from './studyCatalog.js';
12
+ export { ADOPTED_STUDIES, adoptable, isBandShape, outputMark, studyLevels, studyNeedsColumns, } from './studyCatalog.js';
13
13
  export { DATA_TIME_ZONE, LOCAL_ZONE, TIME_ZONE_CHOICES, resolveTimeZone, timeZoneLabel, type TimeZoneChoice, } from './timeZone.js';
package/dist/index.js CHANGED
@@ -11,6 +11,6 @@ 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
13
13
  // count is assertable and a widening of `adoptable` is a visible edit.
14
- export { ADOPTED_STUDIES, adoptable, isBandShape, outputMark, studyNeedsColumns, } from './studyCatalog.js';
14
+ export { ADOPTED_STUDIES, adoptable, isBandShape, outputMark, studyLevels, studyNeedsColumns, } from './studyCatalog.js';
15
15
  // The two zones: what the data IS, and what the axis reads in (TDL-TZAXIS).
16
16
  export { DATA_TIME_ZONE, LOCAL_ZONE, TIME_ZONE_CHOICES, resolveTimeZone, timeZoneLabel, } from './timeZone.js';
@@ -70,6 +70,9 @@ export declare const PRIMARY_SUFFIX = "Value";
70
70
  /** How one declared output should be drawn. `'line'` unless the overlay says
71
71
  * otherwise — see {@link OUTPUT_MARKS}. */
72
72
  export declare function outputMark(op: string, suffix: string): 'line' | 'bar';
73
+ /** The guide levels to draw on a study's own axis — see {@link STUDY_LEVELS}.
74
+ * Empty when the study has none. */
75
+ export declare function studyLevels(op: string): readonly number[];
73
76
  /**
74
77
  * True if the outputs are a band **Tidal's `band` style can actually read**.
75
78
  *
@@ -139,12 +139,86 @@ const OUTPUT_MARKS = {
139
139
  // where the two lines cross — which is the reading most people take off a
140
140
  // MACD, and it is unavailable when the difference is drawn as a third line.
141
141
  macd: { Hist: 'bar' },
142
+ // Single-output histograms: the study IS the bars. Bill Williams' Awesome
143
+ // Oscillator and Market Facilitation Index are defined as histograms, and
144
+ // Chaikin Money Flow is read as bars either side of zero. Their one output has
145
+ // the empty suffix. `elderRay` is NOT here although its Bull/Bear are
146
+ // conventionally bars: drawn as two one-colour bar layers on one axis, the
147
+ // shorter of the pair hides under the longer whenever they share a sign.
148
+ awesomeOscillator: { '': 'bar' },
149
+ chaikinMoneyFlow: { '': 'bar' },
150
+ marketFacilitationIndex: { '': 'bar' },
142
151
  };
143
152
  /** How one declared output should be drawn. `'line'` unless the overlay says
144
153
  * otherwise — see {@link OUTPUT_MARKS}. */
145
154
  export function outputMark(op, suffix) {
146
155
  return OUTPUT_MARKS[op]?.[suffix] ?? 'line';
147
156
  }
157
+ /**
158
+ * An oscillator's conventional GUIDE LEVELS — RSI's 30/70, a stochastic's
159
+ * 20/80, the zero line a MACD crosses — where the catalog cannot say.
160
+ *
161
+ * The descriptor carries `unit`, which places a study on its own axis, but no
162
+ * reference levels, so every consumer re-types them by hand. That is the
163
+ * F-charts-26 addendum (2026-09-26), and this table is the workaround it asks
164
+ * to delete: an optional `levels` on the descriptor would replace it.
165
+ *
166
+ * Each entry was checked against the study's MEASURED range on the fixture
167
+ * series (500 bars, three instruments, 2026-10-02) rather than against the
168
+ * textbook, because a scale is a convention: Williams %R runs −100…0 here, %B
169
+ * 0…1, and a stochastic 0…100, not 0…1. A study whose outputs do not share
170
+ * one scale (`aroon`'s Up/Down against its Osc) is left out rather than given
171
+ * levels that suit half of it.
172
+ */
173
+ const STUDY_LEVELS = {
174
+ // Bounded 0…100, overbought / oversold.
175
+ rsi: [30, 70],
176
+ stochastic: [20, 80],
177
+ stochasticRsi: [20, 80],
178
+ moneyFlowIndex: [20, 80],
179
+ ultimateOscillator: [30, 70],
180
+ intradayMomentumIndex: [30, 70],
181
+ schaffTrendCycle: [25, 75],
182
+ psychologicalLine: [25, 75],
183
+ // Choppy above 61.8, trending below 38.2.
184
+ choppinessIndex: [38.2, 61.8],
185
+ // Other bounded scales.
186
+ williamsR: [-80, -20],
187
+ stochasticMomentumIndex: [-40, 40],
188
+ chandeMomentum: [-50, 50],
189
+ commodityChannelIndex: [-100, 100],
190
+ bollingerPercentB: [0, 1],
191
+ // The reversal bulge: up through 27, back under 26.5.
192
+ massIndex: [26.5, 27],
193
+ vortex: [1],
194
+ zScore: [-2, 0, 2],
195
+ // Centred on zero: the crossing is the reading.
196
+ macd: [0],
197
+ trix: [0],
198
+ coppock: [0],
199
+ kst: [0],
200
+ priceMomentumOscillator: [0],
201
+ momentum: [0],
202
+ percentChange: [0],
203
+ awesomeOscillator: [0],
204
+ fisherTransform: [0],
205
+ prettyGoodOscillator: [0],
206
+ primeNumberOscillator: [0],
207
+ relativeVigorIndex: [0],
208
+ chandeForecastOscillator: [0],
209
+ trueStrengthIndex: [0],
210
+ elderRay: [0],
211
+ chaikinMoneyFlow: [0],
212
+ chaikinOscillator: [0],
213
+ twiggsMoneyFlow: [0],
214
+ forceIndex: [0],
215
+ klinger: [0],
216
+ };
217
+ /** The guide levels to draw on a study's own axis — see {@link STUDY_LEVELS}.
218
+ * Empty when the study has none. */
219
+ export function studyLevels(op) {
220
+ return STUDY_LEVELS[op] ?? [];
221
+ }
148
222
  /** The output suffixes, which is also the order {@link catalogRun} returns them
149
223
  * in — the engine pairs them positionally. */
150
224
  const suffixes = (d) => d.outputs.map((o) => o.id);
package/dist/vol.d.ts CHANGED
@@ -83,11 +83,12 @@ export declare const hvCol: (tenor: number) => string;
83
83
  export declare const rvCol: (tenor: number) => string;
84
84
  export declare const rvCenCol: (tenor: number) => string;
85
85
  /**
86
- * ATM vol **slope** at a tenor — the daily skew measure, from
87
- * `SurfaceFixedTermHist`.
86
+ * ATM vol **slope** at a tenor — the daily skew measure, from the feed's
87
+ * fixed-term surface history.
88
88
  *
89
- * It is `atmVol × (skewU1 − skewD1)`: the fitted curve one grid step above ATM
90
- * minus one step below, in **absolute vol points**, not a ratio.
89
+ * It is the ATM vol times the difference between the fitted curve's relative
90
+ * level one grid step above ATM and one step below, in **absolute vol points**,
91
+ * not a ratio.
91
92
  *
92
93
  * **Negative is normal equity skew** — downside vol above upside — and more
93
94
  * negative is a steeper crash premium. Worth stating because the sign is the whole
package/dist/vol.js CHANGED
@@ -124,11 +124,12 @@ export const hvCol = (tenor) => `hv${tenor}`;
124
124
  export const rvCol = (tenor) => `rvcc${tenor}`;
125
125
  export const rvCenCol = (tenor) => `rvccen${tenor}`;
126
126
  /**
127
- * ATM vol **slope** at a tenor — the daily skew measure, from
128
- * `SurfaceFixedTermHist`.
127
+ * ATM vol **slope** at a tenor — the daily skew measure, from the feed's
128
+ * fixed-term surface history.
129
129
  *
130
- * It is `atmVol × (skewU1 − skewD1)`: the fitted curve one grid step above ATM
131
- * minus one step below, in **absolute vol points**, not a ratio.
130
+ * It is the ATM vol times the difference between the fitted curve's relative
131
+ * level one grid step above ATM and one step below, in **absolute vol points**,
132
+ * not a ratio.
132
133
  *
133
134
  * **Negative is normal equity skew** — downside vol above upside — and more
134
135
  * negative is a steeper crash premium. Worth stating because the sign is the whole
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tidal-ts/core",
3
- "version": "0.5.1",
3
+ "version": "0.7.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",