oakscriptjs 0.14.1 → 0.15.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/cjs/callsite/index.d.ts +22 -3
- package/dist/cjs/callsite/index.d.ts.map +1 -1
- package/dist/cjs/callsite/index.js +32 -0
- package/dist/cjs/callsite/index.js.map +2 -2
- package/dist/cjs/color/index.d.ts.map +1 -1
- package/dist/cjs/color/index.js +1 -1
- package/dist/cjs/color/index.js.map +2 -2
- package/dist/cjs/drawing/registry.d.ts +2 -2
- package/dist/cjs/drawing/registry.d.ts.map +1 -1
- package/dist/cjs/drawing/registry.js +17 -8
- package/dist/cjs/drawing/registry.js.map +2 -2
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +2 -1
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/math/index.d.ts +2 -6
- package/dist/cjs/math/index.d.ts.map +1 -1
- package/dist/cjs/math/index.js.map +2 -2
- package/dist/cjs/script/index.d.ts.map +1 -1
- package/dist/cjs/script/index.js +1 -1
- package/dist/cjs/script/index.js.map +2 -2
- package/dist/cjs/security/other.d.ts +8 -1
- package/dist/cjs/security/other.d.ts.map +1 -1
- package/dist/cjs/security/other.js +8 -1
- package/dist/cjs/security/other.js.map +2 -2
- package/dist/cjs/ta/index.d.ts +9 -11
- package/dist/cjs/ta/index.d.ts.map +1 -1
- package/dist/cjs/ta/index.js.map +2 -2
- package/dist/cjs/ta/running-sum.d.ts +13 -19
- package/dist/cjs/ta/running-sum.d.ts.map +1 -1
- package/dist/cjs/ta/running-sum.js +62 -74
- package/dist/cjs/ta/running-sum.js.map +2 -2
- package/dist/cjs/table/index.d.ts.map +1 -1
- package/dist/cjs/table/index.js +4 -1
- package/dist/cjs/table/index.js.map +2 -2
- package/dist/cjs/utils/index.js +3 -3
- package/dist/cjs/utils/index.js.map +2 -2
- package/dist/esm/callsite/index.d.ts +22 -3
- package/dist/esm/callsite/index.d.ts.map +1 -1
- package/dist/esm/callsite/index.js +55 -3
- package/dist/esm/callsite/index.js.map +1 -1
- package/dist/esm/color/index.d.ts.map +1 -1
- package/dist/esm/color/index.js +3 -2
- package/dist/esm/color/index.js.map +1 -1
- package/dist/esm/drawing/registry.d.ts +2 -2
- package/dist/esm/drawing/registry.d.ts.map +1 -1
- package/dist/esm/drawing/registry.js +28 -12
- package/dist/esm/drawing/registry.js.map +1 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/math/index.d.ts +2 -6
- package/dist/esm/math/index.d.ts.map +1 -1
- package/dist/esm/math/index.js +1 -1
- package/dist/esm/math/index.js.map +1 -1
- package/dist/esm/script/index.d.ts.map +1 -1
- package/dist/esm/script/index.js +1 -1
- package/dist/esm/script/index.js.map +1 -1
- package/dist/esm/security/other.d.ts +8 -1
- package/dist/esm/security/other.d.ts.map +1 -1
- package/dist/esm/security/other.js +13 -1
- package/dist/esm/security/other.js.map +1 -1
- package/dist/esm/ta/index.d.ts +9 -11
- package/dist/esm/ta/index.d.ts.map +1 -1
- package/dist/esm/ta/index.js +13 -15
- package/dist/esm/ta/index.js.map +1 -1
- package/dist/esm/ta/running-sum.d.ts +13 -19
- package/dist/esm/ta/running-sum.d.ts.map +1 -1
- package/dist/esm/ta/running-sum.js +88 -103
- package/dist/esm/ta/running-sum.js.map +1 -1
- package/dist/esm/table/index.d.ts.map +1 -1
- package/dist/esm/table/index.js +5 -1
- package/dist/esm/table/index.js.map +1 -1
- package/dist/esm/utils/index.js +3 -3
- package/dist/esm/utils/index.js.map +1 -1
- package/package.json +1 -1
- package/skills/oakscript/reference/pine-differences.md +3 -1
- package/src/callsite/index.ts +58 -3
- package/src/color/index.ts +3 -2
- package/src/drawing/registry.ts +29 -11
- package/src/index.ts +2 -1
- package/src/math/index.ts +3 -7
- package/src/script/index.ts +1 -1
- package/src/security/other.ts +14 -2
- package/src/ta/index.ts +13 -15
- package/src/ta/running-sum.ts +82 -99
- package/src/table/index.ts +5 -1
- package/src/utils/index.ts +3 -3
|
@@ -75,12 +75,19 @@ export declare function securityOther(chartBars: ReadonlyArray<{
|
|
|
75
75
|
* `otherBars` (a lower timeframe, the chart symbol or another one) that it contains: the bars whose close time is
|
|
76
76
|
* after the open of the chart bar and at or before its close (a 13:00 hourly bar of a 24x7 symbol is in a 13:30 stock
|
|
77
77
|
* day, which closes at 20:00). An empty range for a chart bar without such bars.
|
|
78
|
+
*
|
|
79
|
+
* As PineScript, at most the last {@link MAX_INTRABARS} (100,000) lower-timeframe bars are given out
|
|
80
|
+
* (`options.maxIntrabars` changes it): the older chart bars get an empty range (#192).
|
|
78
81
|
*/
|
|
79
82
|
export declare function securityLowerTf(chartBars: ReadonlyArray<{
|
|
80
83
|
time: number;
|
|
81
84
|
}>, otherBars: ReadonlyArray<{
|
|
82
85
|
time: number;
|
|
83
|
-
}>, tf: string, chart: OtherSymbolChart, options?: Pick<OtherSymbolOptions, 'other'>
|
|
86
|
+
}>, tf: string, chart: OtherSymbolChart, options?: Pick<OtherSymbolOptions, 'other'> & {
|
|
87
|
+
maxIntrabars?: number;
|
|
88
|
+
}): Array<[number, number]>;
|
|
89
|
+
/** Lower-timeframe bars `request.security_lower_tf` gives out at most, as PineScript (the last ones). */
|
|
90
|
+
export declare const MAX_INTRABARS = 100000;
|
|
84
91
|
/**
|
|
85
92
|
* {@link securityOther} with the values of an expression: `values` has one value per bar of the other symbol; the
|
|
86
93
|
* result has one value per chart bar, NaN for na.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"other.d.ts","sourceRoot":"","sources":["../../../src/security/other.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAI1D,2FAA2F;AAC3F,MAAM,WAAW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;CAAE,CAAC,EAC1C,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,EACzB,KAAK,EAAE,gBAAgB,EACvB,OAAO,GAAE,kBAAuB,GAC/B,MAAM,EAAE,CAEV"}
|
|
@@ -28,6 +28,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var other_exports = {};
|
|
30
30
|
__export(other_exports, {
|
|
31
|
+
MAX_INTRABARS: () => MAX_INTRABARS,
|
|
31
32
|
securityLowerTf: () => securityLowerTf,
|
|
32
33
|
securityOther: () => securityOther,
|
|
33
34
|
securityOtherValues: () => securityOtherValues
|
|
@@ -156,8 +157,14 @@ function securityLowerTf(chartBars, otherBars, tf, chart, options = {}) {
|
|
|
156
157
|
const oc = closeTimes(ot, otherTf, otherZone);
|
|
157
158
|
const from = latestAtOrBefore(oc, ct);
|
|
158
159
|
const to = latestAtOrBefore(oc, closeTimes(ct, chartTf, chartZone));
|
|
159
|
-
|
|
160
|
+
const ranges = ct.map((_, i) => [from[i] + 1, Math.max(from[i] + 1, to[i] + 1)]);
|
|
161
|
+
const max = options.maxIntrabars ?? MAX_INTRABARS;
|
|
162
|
+
const end = ranges.reduce((m, [, t]) => Math.max(m, t), 0);
|
|
163
|
+
const first = end - max;
|
|
164
|
+
if (first <= 0) return ranges;
|
|
165
|
+
return ranges.map(([f, t]) => t <= first ? [f, f] : [Math.max(f, first), t]);
|
|
160
166
|
}
|
|
167
|
+
const MAX_INTRABARS = 1e5;
|
|
161
168
|
function securityOtherValues(chartBars, otherBars, tf, values, chart, options = {}) {
|
|
162
169
|
return securityOther(chartBars, otherBars, tf, chart, options).map((j) => j < 0 ? NaN : values[j] ?? NaN);
|
|
163
170
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/security/other.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * PineScript `request.security(symbol, timeframe, expression, gaps, lookahead)` of another symbol: which bar of the\n * other symbol each chart bar shows (#179). The bars of the other symbol are given by the caller, already on the\n * requested timeframe; the expression is computed on them and its values are mapped to the chart bars with the index\n * given here. The script API does this with the `bars` accessor of its chart context.\n *\n * PineScript rules (measured on stocks, crypto and an exchange whose trading day starts on the previous UTC day; the\n * chart timeframe, D, W and M on intraday and daily charts; the four gaps / lookahead combinations):\n * - lookahead off: the last bar of the other symbol whose close time is at or before the close time of the chart bar\n * (a daily stock bar closes at the session end, a crypto daily bar at 00:00 UTC: a stock chart shows the crypto\n * bar of the day before, a crypto chart the stock bar of the same day)\n * - lookahead on, intraday chart or intraday request: the last bar of the other symbol that opened at or before the\n * open of the chart bar\n * - lookahead on, D / W / M chart and request: the last bar of the other symbol whose period starts at or before the trading day\n * of the chart bar: the trading day of a D bar, the Monday of a W bar, the first day of the month of an M bar, each\n * in the exchange time zone of its symbol (a week that opens on a Tuesday after a holiday still starts on Monday)\n * - before the first bar of the other symbol: na; on chart bars where the other symbol has no bar (weekends,\n * holidays, closed hours), gaps off repeats the last value\n * - gaps on: a value only on the chart bar where the shown bar changes (and on the first chart bar), na on the others\n * - the last bar while it is open (`lastBarConfirmed` false) with gaps off: the realtime update shows the bar given by\n * lookahead on (the open bar of a higher timeframe), with lookahead off as well; a lower timeframe keeps the rules\n * above (the last lower bar so far with lookahead off, the first one of the chart bar with lookahead on)\n *\n * Close times, trading days and time zones come from the exchange calendars of the chart and of the other symbol\n * (time zone and session, read by the session functions). Without them:\n * - a symbol that trades every day (bars on Saturdays or Sundays; W bars at Monday 00:00 UTC; M bars on the first day\n * at 00:00 UTC) is on the \"24x7\" UTC calendar\n * - another symbol whose bars open where the chart calendar starts its periods is on the calendar of the chart\n * - else the UTC rule: an intraday bar closes one bar interval after its open (or at the next bar), a D / W / M bar at\n * the end of the last weekday (UTC) of its day / week / month; the trading day is the UTC date of the bar\n * The fallback is exact between symbols of the same calendar and with 24x7 symbols; between a stock and a 24x7 symbol,\n * or an exchange whose trading day starts on the previous UTC day, it needs the session of the stock.\n *\n * @module security/other\n */\n\nimport * as timeframe from '../timeframe/index.js';\nimport { chartSessions, periodClose, periodTime, tradingDayTime, type SessionContext } from '../session/context.js';\nimport type { SessionSpec } from '../session/calendar.js';\n\nconst DAY = 86_400_000;\n\n/** Exchange calendar of a symbol: time zone and session (hours, corrections, holidays). */\nexport interface SymbolCalendar {\n timezone?: string;\n session?: SessionSpec | string;\n}\n\n/** Options of {@link securityOther}. */\nexport interface OtherSymbolOptions {\n /** PineScript `barmerge.lookahead_on`; default false */\n lookahead?: boolean;\n /** PineScript `barmerge.gaps_on`; default false */\n gaps?: boolean;\n /** Calendar of the other symbol; see the module notes for the fallback */\n other?: SymbolCalendar;\n}\n\n/** The chart: its timeframe, calendar, time unit and whether its last bar is closed. */\nexport interface OtherSymbolChart extends SymbolCalendar {\n /** Chart timeframe (\"60\", \"1D\"...) */\n timeframe: string;\n /** Unit of the bar times: 's' (default) or 'ms' */\n timeUnit?: 's' | 'ms';\n /** false: the last chart bar is still open (realtime rule) */\n lastBarConfirmed?: boolean;\n}\n\ninterface Zone {\n timezone: string;\n session: SessionSpec | string;\n}\n\nconst calendars = new Map<string, SessionContext | null>();\n\n/** The session context of a zone and a timeframe (bar times in ms); null when the session cannot be read. */\nfunction calendarOf(zone: Zone | null, tf: string): SessionContext | null {\n if (!zone) return null;\n const key = `${zone.timezone}|${typeof zone.session === 'string' ? zone.session : JSON.stringify(zone.session)}|${tf}`;\n let context = calendars.get(key);\n if (context === undefined) {\n context = { timeframe: tf, timezone: zone.timezone, session: zone.session, timeUnit: 'ms' };\n try {\n chartSessions(context);\n } catch {\n context = null;\n }\n if (calendars.size > 64) calendars.clear();\n calendars.set(key, context);\n }\n return context;\n}\n\nconst UTC_24X7: Zone = { timezone: 'Etc/UTC', session: '24x7' };\n\n/** True when bars of timeframe `tf` opening at `times` (ms) are those of a symbol that trades every day in UTC. */\nfunction tradesEveryDay(times: number[], tf: string): boolean {\n if (times.length === 0) return false;\n const info = timeframe.info(tf);\n if (info.isweekly) return times.every((t) => t % DAY === 0 && new Date(t).getUTCDay() === 1);\n if (info.ismonthly) return times.every((t) => t % DAY === 0 && new Date(t).getUTCDate() === 1);\n return times.some((t) => {\n const wd = new Date(t).getUTCDay();\n return wd === 0 || wd === 6;\n });\n}\n\n/** True when most of the last bars open at the start of a period of `tf` on the calendar `zone`. */\nfunction onCalendar(times: number[], tf: string, zone: Zone | null): boolean {\n const calendar = calendarOf(zone, tf);\n if (!calendar || times.length === 0) return false;\n const last = times.slice(-50);\n return last.filter((t) => periodTime(t, tf, calendar) === t).length >= 0.9 * last.length;\n}\n\nconst utcDay = (t: number): number => Math.floor(t / DAY) * DAY;\n/** Monday 00:00 UTC of the week of the day `day` (00:00 UTC, ms). */\nconst weekStart = (day: number): number => day - ((new Date(day).getUTCDay() + 6) % 7) * DAY;\nconst monthStart = (day: number): number => {\n const d = new Date(day);\n return Date.UTC(d.getUTCFullYear(), d.getUTCMonth(), 1);\n};\n\n/** 00:00 UTC after the last weekday before `end` (00:00 UTC, ms): the end of a period of a Monday-to-Friday symbol. */\nfunction afterLastWeekday(end: number): number {\n let day = end - DAY;\n while (new Date(day).getUTCDay() % 6 === 0) day -= DAY;\n return day + DAY;\n}\n\n/** Close time (ms) of each bar of timeframe `tf` opening at `times` (ms). */\nfunction closeTimes(times: number[], tf: string, zone: Zone | null): number[] {\n const calendar = calendarOf(zone, tf);\n const info = timeframe.info(tf);\n const len = timeframe.in_seconds(tf) * 1000;\n return times.map((t, i) => {\n if (calendar) {\n const c = periodClose(t, tf, calendar);\n if (!Number.isNaN(c)) return c;\n }\n if (info.isintraday) return i + 1 < times.length ? Math.min(t + len, times[i + 1]!) : t + len;\n const day = utcDay(t);\n if (info.isweekly) return afterLastWeekday(weekStart(day) + 7 * DAY * info.multiplier);\n if (info.ismonthly) {\n const d = new Date(day);\n return afterLastWeekday(Date.UTC(d.getUTCFullYear(), d.getUTCMonth() + info.multiplier, 1));\n }\n return day + DAY * info.multiplier;\n });\n}\n\n/** Trading day (00:00 UTC, ms) of each bar opening at `times` (ms): its date in the exchange time zone. */\nfunction tradingDays(times: number[], zone: Zone | null): number[] {\n const calendar = calendarOf(zone, '1D');\n return times.map((t) => {\n const d = calendar ? tradingDayTime(t, calendar) : NaN;\n return Number.isNaN(d) ? utcDay(t) : d;\n });\n}\n\n/** For each element of `at` (non-decreasing), the index of the last element of `keys` (non-decreasing) <= it; -1: none. */\nfunction latestAtOrBefore(keys: number[], at: number[]): number[] {\n let j = -1;\n return at.map((x) => {\n while (j + 1 < keys.length && keys[j + 1]! <= x) j++;\n return j;\n });\n}\n\nconst zoneOf = (c: SymbolCalendar | undefined): Zone | null =>\n c?.timezone && c.session ? { timezone: c.timezone, session: c.session } : null;\n\n/** Timeframes and exchange calendars of a merge: given, 24x7, the chart's, else the UTC rule. */\nfunction setup(\n ct: number[],\n ot: number[],\n tf: string,\n chart: OtherSymbolChart,\n options: OtherSymbolOptions\n): { chartTf: string; otherTf: string; chartZone: Zone | null; otherZone: Zone | null } {\n const chartTf = timeframe.info(chart.timeframe).period;\n const otherTf = tf.trim() === '' ? chartTf : timeframe.info(tf).period;\n if (timeframe.info(otherTf).isticks) throw new RangeError(`request.security: tick timeframe \"${tf}\" is not supported.`);\n const chartZone = zoneOf(chart) ?? (tradesEveryDay(ct, chartTf) ? UTC_24X7 : null);\n const otherZone =\n zoneOf(options.other) ??\n (tradesEveryDay(ot, otherTf) ? UTC_24X7 : chartZone && onCalendar(ot, otherTf, chartZone) ? chartZone : null);\n return { chartTf, otherTf, chartZone, otherZone };\n}\n\n/**\n * PineScript `request.security` of another symbol: the index in `otherBars` of the bar shown on each chart bar, -1\n * for na (#179). `otherBars` are the bars of the other symbol on `tf` (\"\" for the chart timeframe, or a higher\n * or a lower one), with times in the unit of the chart bars. Rules in the module notes; the same rules hold for a\n * lower timeframe (#181): lookahead off shows the last lower bar that closes by the close of the chart bar, lookahead\n * on the last one that opened by its open. It also serves the chart symbol on a lower timeframe.\n * @throws RangeError for a tick timeframe\n */\nexport function securityOther(\n chartBars: ReadonlyArray<{ time: number }>,\n otherBars: ReadonlyArray<{ time: number }>,\n tf: string,\n chart: OtherSymbolChart,\n options: OtherSymbolOptions = {}\n): number[] {\n const n = chartBars.length;\n if (n === 0) return [];\n const unit = chart.timeUnit === 'ms' ? 1 : 1000;\n const ct = chartBars.map((b) => b.time * unit);\n const ot = otherBars.map((b) => b.time * unit);\n const { chartTf, otherTf, chartZone, otherZone } = setup(ct, ot, tf, chart, options);\n if (ot.length === 0) return new Array<number>(n).fill(-1);\n\n // by trading day when both timeframes are D / W / M; by open time with an intraday side (#181)\n const daily = timeframe.info(chartTf).isdwm && timeframe.info(otherTf).isdwm;\n // a lower timeframe keeps its rule on the open last bar: the last lower bar so far, not the first one (#184)\n const realtime =\n chart.lastBarConfirmed === false && !options.gaps && timeframe.in_seconds(otherTf) >= timeframe.in_seconds(chartTf);\n let on: number[] = [];\n if (options.lookahead || realtime) {\n if (daily) {\n const info = timeframe.info(otherTf);\n const starts = tradingDays(ot, otherZone).map((d) => (info.isweekly ? weekStart(d) : info.ismonthly ? monthStart(d) : d));\n on = latestAtOrBefore(starts, tradingDays(ct, chartZone));\n } else {\n on = latestAtOrBefore(ot, ct);\n }\n }\n const index = options.lookahead ? on : latestAtOrBefore(closeTimes(ot, otherTf, otherZone), closeTimes(ct, chartTf, chartZone));\n // realtime updates of the open last bar: lookahead off shows the bar of lookahead on\n if (realtime) index[n - 1] = on[n - 1]!;\n if (!options.gaps) return index;\n return index.map((j, i) => (i === 0 || j !== index[i - 1] ? j : -1));\n}\n\n/**\n * PineScript `request.security_lower_tf` (#181): for each chart bar, the range `[from, to)` of the bars of\n * `otherBars` (a lower timeframe, the chart symbol or another one) that it contains: the bars whose close time is\n * after the open of the chart bar and at or before its close (a 13:00 hourly bar of a 24x7 symbol is in a 13:30 stock\n * day, which closes at 20:00). An empty range for a chart bar without such bars.\n */\nexport function securityLowerTf(\n chartBars: ReadonlyArray<{ time: number }>,\n otherBars: ReadonlyArray<{ time: number }>,\n tf: string,\n chart: OtherSymbolChart,\n options: Pick<OtherSymbolOptions, 'other'> = {}\n): Array<[number, number]> {\n const unit = chart.timeUnit === 'ms' ? 1 : 1000;\n const ct = chartBars.map((b) => b.time * unit);\n const ot = otherBars.map((b) => b.time * unit);\n const { chartTf, otherTf, chartZone, otherZone } = setup(ct, ot, tf, chart, options);\n const oc = closeTimes(ot, otherTf, otherZone);\n const from = latestAtOrBefore(oc, ct);\n const to = latestAtOrBefore(oc, closeTimes(ct, chartTf, chartZone));\n return ct.map((_, i) => [from[i]! + 1, Math.max(from[i]! + 1, to[i]! + 1)]);\n}\n\n/**\n * {@link securityOther} with the values of an expression: `values` has one value per bar of the other symbol; the\n * result has one value per chart bar, NaN for na.\n */\nexport function securityOtherValues(\n chartBars: ReadonlyArray<{ time: number }>,\n otherBars: ReadonlyArray<{ time: number }>,\n tf: string,\n values: ArrayLike<number>,\n chart: OtherSymbolChart,\n options: OtherSymbolOptions = {}\n): number[] {\n return securityOther(chartBars, otherBars, tf, chart, options).map((j) => (j < 0 ? NaN : (values[j] ?? NaN)));\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoCA,gBAA2B;AAC3B,qBAA4F;AAG5F,MAAM,MAAM;AAiCZ,MAAM,YAAY,oBAAI,IAAmC;AAGzD,SAAS,WAAW,MAAmB,IAAmC;AACxE,MAAI,CAAC,KAAM,QAAO;AAClB,QAAM,MAAM,GAAG,KAAK,QAAQ,IAAI,OAAO,KAAK,YAAY,WAAW,KAAK,UAAU,KAAK,UAAU,KAAK,OAAO,CAAC,IAAI,EAAE;AACpH,MAAI,UAAU,UAAU,IAAI,GAAG;AAC/B,MAAI,YAAY,QAAW;AACzB,cA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,UAAU,KAAK,OAAO,EAAE,SAAS,UAAU,KAAK,OAAO,EAAE;AAEvE,QAAM,WACJ,MAAM,qBAAqB,SAAS,CAAC,QAAQ,QAAQ,UAAU,WAAW,OAAO,KAAK,UAAU,WAAW,OAAO;AACpH,MAAI,KAAe,CAAC;AACpB,MAAI,QAAQ,aAAa,UAAU;AACjC,QAAI,OAAO;AACT,YAAM,OAAO,UAAU,KAAK,OAAO;AACnC,YAAM,SAAS,YAAY,IAAI,SAAS,EAAE,IAAI,CAAC,MAAO,KAAK,WAAW,UAAU,CAAC,IAAI,KAAK,YAAY,WAAW,CAAC,IAAI,CAAE;AACxH,WAAK,iBAAiB,QAAQ,YAAY,IAAI,SAAS,CAAC;AAAA,IAC1D,OAAO;AACL,WAAK,iBAAiB,IAAI,EAAE;AAAA,IAC9B;AAAA,EACF;AACA,QAAM,QAAQ,QAAQ,YAAY,KAAK,iBAAiB,WAAW,IAAI,SAAS,SAAS,GAAG,WAAW,IAAI,SAAS,SAAS,CAAC;AAE9H,MAAI,SAAU,OAAM,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;AACrC,MAAI,CAAC,QAAQ,KAAM,QAAO;AAC1B,SAAO,MAAM,IAAI,CAAC,GAAG,MAAO,MAAM,KAAK,MAAM,MAAM,IAAI,CAAC,IAAI,IAAI,EAAG;AACrE;
|
|
4
|
+
"sourcesContent": ["/**\n * PineScript `request.security(symbol, timeframe, expression, gaps, lookahead)` of another symbol: which bar of the\n * other symbol each chart bar shows (#179). The bars of the other symbol are given by the caller, already on the\n * requested timeframe; the expression is computed on them and its values are mapped to the chart bars with the index\n * given here. The script API does this with the `bars` accessor of its chart context.\n *\n * PineScript rules (measured on stocks, crypto and an exchange whose trading day starts on the previous UTC day; the\n * chart timeframe, D, W and M on intraday and daily charts; the four gaps / lookahead combinations):\n * - lookahead off: the last bar of the other symbol whose close time is at or before the close time of the chart bar\n * (a daily stock bar closes at the session end, a crypto daily bar at 00:00 UTC: a stock chart shows the crypto\n * bar of the day before, a crypto chart the stock bar of the same day)\n * - lookahead on, intraday chart or intraday request: the last bar of the other symbol that opened at or before the\n * open of the chart bar\n * - lookahead on, D / W / M chart and request: the last bar of the other symbol whose period starts at or before the trading day\n * of the chart bar: the trading day of a D bar, the Monday of a W bar, the first day of the month of an M bar, each\n * in the exchange time zone of its symbol (a week that opens on a Tuesday after a holiday still starts on Monday)\n * - before the first bar of the other symbol: na; on chart bars where the other symbol has no bar (weekends,\n * holidays, closed hours), gaps off repeats the last value\n * - gaps on: a value only on the chart bar where the shown bar changes (and on the first chart bar), na on the others\n * - the last bar while it is open (`lastBarConfirmed` false) with gaps off: the realtime update shows the bar given by\n * lookahead on (the open bar of a higher timeframe), with lookahead off as well; a lower timeframe keeps the rules\n * above (the last lower bar so far with lookahead off, the first one of the chart bar with lookahead on)\n *\n * Close times, trading days and time zones come from the exchange calendars of the chart and of the other symbol\n * (time zone and session, read by the session functions). Without them:\n * - a symbol that trades every day (bars on Saturdays or Sundays; W bars at Monday 00:00 UTC; M bars on the first day\n * at 00:00 UTC) is on the \"24x7\" UTC calendar\n * - another symbol whose bars open where the chart calendar starts its periods is on the calendar of the chart\n * - else the UTC rule: an intraday bar closes one bar interval after its open (or at the next bar), a D / W / M bar at\n * the end of the last weekday (UTC) of its day / week / month; the trading day is the UTC date of the bar\n * The fallback is exact between symbols of the same calendar and with 24x7 symbols; between a stock and a 24x7 symbol,\n * or an exchange whose trading day starts on the previous UTC day, it needs the session of the stock.\n *\n * @module security/other\n */\n\nimport * as timeframe from '../timeframe/index.js';\nimport { chartSessions, periodClose, periodTime, tradingDayTime, type SessionContext } from '../session/context.js';\nimport type { SessionSpec } from '../session/calendar.js';\n\nconst DAY = 86_400_000;\n\n/** Exchange calendar of a symbol: time zone and session (hours, corrections, holidays). */\nexport interface SymbolCalendar {\n timezone?: string;\n session?: SessionSpec | string;\n}\n\n/** Options of {@link securityOther}. */\nexport interface OtherSymbolOptions {\n /** PineScript `barmerge.lookahead_on`; default false */\n lookahead?: boolean;\n /** PineScript `barmerge.gaps_on`; default false */\n gaps?: boolean;\n /** Calendar of the other symbol; see the module notes for the fallback */\n other?: SymbolCalendar;\n}\n\n/** The chart: its timeframe, calendar, time unit and whether its last bar is closed. */\nexport interface OtherSymbolChart extends SymbolCalendar {\n /** Chart timeframe (\"60\", \"1D\"...) */\n timeframe: string;\n /** Unit of the bar times: 's' (default) or 'ms' */\n timeUnit?: 's' | 'ms';\n /** false: the last chart bar is still open (realtime rule) */\n lastBarConfirmed?: boolean;\n}\n\ninterface Zone {\n timezone: string;\n session: SessionSpec | string;\n}\n\nconst calendars = new Map<string, SessionContext | null>();\n\n/** The session context of a zone and a timeframe (bar times in ms); null when the session cannot be read. */\nfunction calendarOf(zone: Zone | null, tf: string): SessionContext | null {\n if (!zone) return null;\n const key = `${zone.timezone}|${typeof zone.session === 'string' ? zone.session : JSON.stringify(zone.session)}|${tf}`;\n let context = calendars.get(key);\n if (context === undefined) {\n context = { timeframe: tf, timezone: zone.timezone, session: zone.session, timeUnit: 'ms' };\n try {\n chartSessions(context);\n } catch {\n context = null;\n }\n if (calendars.size > 64) calendars.clear();\n calendars.set(key, context);\n }\n return context;\n}\n\nconst UTC_24X7: Zone = { timezone: 'Etc/UTC', session: '24x7' };\n\n/** True when bars of timeframe `tf` opening at `times` (ms) are those of a symbol that trades every day in UTC. */\nfunction tradesEveryDay(times: number[], tf: string): boolean {\n if (times.length === 0) return false;\n const info = timeframe.info(tf);\n if (info.isweekly) return times.every((t) => t % DAY === 0 && new Date(t).getUTCDay() === 1);\n if (info.ismonthly) return times.every((t) => t % DAY === 0 && new Date(t).getUTCDate() === 1);\n return times.some((t) => {\n const wd = new Date(t).getUTCDay();\n return wd === 0 || wd === 6;\n });\n}\n\n/** True when most of the last bars open at the start of a period of `tf` on the calendar `zone`. */\nfunction onCalendar(times: number[], tf: string, zone: Zone | null): boolean {\n const calendar = calendarOf(zone, tf);\n if (!calendar || times.length === 0) return false;\n const last = times.slice(-50);\n return last.filter((t) => periodTime(t, tf, calendar) === t).length >= 0.9 * last.length;\n}\n\nconst utcDay = (t: number): number => Math.floor(t / DAY) * DAY;\n/** Monday 00:00 UTC of the week of the day `day` (00:00 UTC, ms). */\nconst weekStart = (day: number): number => day - ((new Date(day).getUTCDay() + 6) % 7) * DAY;\nconst monthStart = (day: number): number => {\n const d = new Date(day);\n return Date.UTC(d.getUTCFullYear(), d.getUTCMonth(), 1);\n};\n\n/** 00:00 UTC after the last weekday before `end` (00:00 UTC, ms): the end of a period of a Monday-to-Friday symbol. */\nfunction afterLastWeekday(end: number): number {\n let day = end - DAY;\n while (new Date(day).getUTCDay() % 6 === 0) day -= DAY;\n return day + DAY;\n}\n\n/** Close time (ms) of each bar of timeframe `tf` opening at `times` (ms). */\nfunction closeTimes(times: number[], tf: string, zone: Zone | null): number[] {\n const calendar = calendarOf(zone, tf);\n const info = timeframe.info(tf);\n const len = timeframe.in_seconds(tf) * 1000;\n return times.map((t, i) => {\n if (calendar) {\n const c = periodClose(t, tf, calendar);\n if (!Number.isNaN(c)) return c;\n }\n if (info.isintraday) return i + 1 < times.length ? Math.min(t + len, times[i + 1]!) : t + len;\n const day = utcDay(t);\n if (info.isweekly) return afterLastWeekday(weekStart(day) + 7 * DAY * info.multiplier);\n if (info.ismonthly) {\n const d = new Date(day);\n return afterLastWeekday(Date.UTC(d.getUTCFullYear(), d.getUTCMonth() + info.multiplier, 1));\n }\n return day + DAY * info.multiplier;\n });\n}\n\n/** Trading day (00:00 UTC, ms) of each bar opening at `times` (ms): its date in the exchange time zone. */\nfunction tradingDays(times: number[], zone: Zone | null): number[] {\n const calendar = calendarOf(zone, '1D');\n return times.map((t) => {\n const d = calendar ? tradingDayTime(t, calendar) : NaN;\n return Number.isNaN(d) ? utcDay(t) : d;\n });\n}\n\n/** For each element of `at` (non-decreasing), the index of the last element of `keys` (non-decreasing) <= it; -1: none. */\nfunction latestAtOrBefore(keys: number[], at: number[]): number[] {\n let j = -1;\n return at.map((x) => {\n while (j + 1 < keys.length && keys[j + 1]! <= x) j++;\n return j;\n });\n}\n\nconst zoneOf = (c: SymbolCalendar | undefined): Zone | null =>\n c?.timezone && c.session ? { timezone: c.timezone, session: c.session } : null;\n\n/** Timeframes and exchange calendars of a merge: given, 24x7, the chart's, else the UTC rule. */\nfunction setup(\n ct: number[],\n ot: number[],\n tf: string,\n chart: OtherSymbolChart,\n options: OtherSymbolOptions\n): { chartTf: string; otherTf: string; chartZone: Zone | null; otherZone: Zone | null } {\n const chartTf = timeframe.info(chart.timeframe).period;\n const otherTf = tf.trim() === '' ? chartTf : timeframe.info(tf).period;\n if (timeframe.info(otherTf).isticks) throw new RangeError(`request.security: tick timeframe \"${tf}\" is not supported.`);\n const chartZone = zoneOf(chart) ?? (tradesEveryDay(ct, chartTf) ? UTC_24X7 : null);\n const otherZone =\n zoneOf(options.other) ??\n (tradesEveryDay(ot, otherTf) ? UTC_24X7 : chartZone && onCalendar(ot, otherTf, chartZone) ? chartZone : null);\n return { chartTf, otherTf, chartZone, otherZone };\n}\n\n/**\n * PineScript `request.security` of another symbol: the index in `otherBars` of the bar shown on each chart bar, -1\n * for na (#179). `otherBars` are the bars of the other symbol on `tf` (\"\" for the chart timeframe, or a higher\n * or a lower one), with times in the unit of the chart bars. Rules in the module notes; the same rules hold for a\n * lower timeframe (#181): lookahead off shows the last lower bar that closes by the close of the chart bar, lookahead\n * on the last one that opened by its open. It also serves the chart symbol on a lower timeframe.\n * @throws RangeError for a tick timeframe\n */\nexport function securityOther(\n chartBars: ReadonlyArray<{ time: number }>,\n otherBars: ReadonlyArray<{ time: number }>,\n tf: string,\n chart: OtherSymbolChart,\n options: OtherSymbolOptions = {}\n): number[] {\n const n = chartBars.length;\n if (n === 0) return [];\n const unit = chart.timeUnit === 'ms' ? 1 : 1000;\n const ct = chartBars.map((b) => b.time * unit);\n const ot = otherBars.map((b) => b.time * unit);\n const { chartTf, otherTf, chartZone, otherZone } = setup(ct, ot, tf, chart, options);\n if (ot.length === 0) return new Array<number>(n).fill(-1);\n\n // by trading day when both timeframes are D / W / M; by open time with an intraday side (#181)\n const daily = timeframe.info(chartTf).isdwm && timeframe.info(otherTf).isdwm;\n // a lower timeframe keeps its rule on the open last bar: the last lower bar so far, not the first one (#184)\n const realtime =\n chart.lastBarConfirmed === false && !options.gaps && timeframe.in_seconds(otherTf) >= timeframe.in_seconds(chartTf);\n let on: number[] = [];\n if (options.lookahead || realtime) {\n if (daily) {\n const info = timeframe.info(otherTf);\n const starts = tradingDays(ot, otherZone).map((d) => (info.isweekly ? weekStart(d) : info.ismonthly ? monthStart(d) : d));\n on = latestAtOrBefore(starts, tradingDays(ct, chartZone));\n } else {\n on = latestAtOrBefore(ot, ct);\n }\n }\n const index = options.lookahead ? on : latestAtOrBefore(closeTimes(ot, otherTf, otherZone), closeTimes(ct, chartTf, chartZone));\n // realtime updates of the open last bar: lookahead off shows the bar of lookahead on\n if (realtime) index[n - 1] = on[n - 1]!;\n if (!options.gaps) return index;\n return index.map((j, i) => (i === 0 || j !== index[i - 1] ? j : -1));\n}\n\n/**\n * PineScript `request.security_lower_tf` (#181): for each chart bar, the range `[from, to)` of the bars of\n * `otherBars` (a lower timeframe, the chart symbol or another one) that it contains: the bars whose close time is\n * after the open of the chart bar and at or before its close (a 13:00 hourly bar of a 24x7 symbol is in a 13:30 stock\n * day, which closes at 20:00). An empty range for a chart bar without such bars.\n *\n * As PineScript, at most the last {@link MAX_INTRABARS} (100,000) lower-timeframe bars are given out\n * (`options.maxIntrabars` changes it): the older chart bars get an empty range (#192).\n */\nexport function securityLowerTf(\n chartBars: ReadonlyArray<{ time: number }>,\n otherBars: ReadonlyArray<{ time: number }>,\n tf: string,\n chart: OtherSymbolChart,\n options: Pick<OtherSymbolOptions, 'other'> & { maxIntrabars?: number } = {}\n): Array<[number, number]> {\n const unit = chart.timeUnit === 'ms' ? 1 : 1000;\n const ct = chartBars.map((b) => b.time * unit);\n const ot = otherBars.map((b) => b.time * unit);\n const { chartTf, otherTf, chartZone, otherZone } = setup(ct, ot, tf, chart, options);\n const oc = closeTimes(ot, otherTf, otherZone);\n const from = latestAtOrBefore(oc, ct);\n const to = latestAtOrBefore(oc, closeTimes(ct, chartTf, chartZone));\n const ranges = ct.map((_, i): [number, number] => [from[i]! + 1, Math.max(from[i]! + 1, to[i]! + 1)]);\n // the last `max` intrabars of the chart bars: the ones before are not given\n const max = options.maxIntrabars ?? MAX_INTRABARS;\n const end = ranges.reduce((m, [, t]) => Math.max(m, t), 0);\n const first = end - max;\n if (first <= 0) return ranges;\n return ranges.map(([f, t]) => (t <= first ? [f, f] : [Math.max(f, first), t]));\n}\n\n/** Lower-timeframe bars `request.security_lower_tf` gives out at most, as PineScript (the last ones). */\nexport const MAX_INTRABARS = 100_000;\n\n/**\n * {@link securityOther} with the values of an expression: `values` has one value per bar of the other symbol; the\n * result has one value per chart bar, NaN for na.\n */\nexport function securityOtherValues(\n chartBars: ReadonlyArray<{ time: number }>,\n otherBars: ReadonlyArray<{ time: number }>,\n tf: string,\n values: ArrayLike<number>,\n chart: OtherSymbolChart,\n options: OtherSymbolOptions = {}\n): number[] {\n return securityOther(chartBars, otherBars, tf, chart, options).map((j) => (j < 0 ? NaN : (values[j] ?? NaN)));\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoCA,gBAA2B;AAC3B,qBAA4F;AAG5F,MAAM,MAAM;AAiCZ,MAAM,YAAY,oBAAI,IAAmC;AAGzD,SAAS,WAAW,MAAmB,IAAmC;AACxE,MAAI,CAAC,KAAM,QAAO;AAClB,QAAM,MAAM,GAAG,KAAK,QAAQ,IAAI,OAAO,KAAK,YAAY,WAAW,KAAK,UAAU,KAAK,UAAU,KAAK,OAAO,CAAC,IAAI,EAAE;AACpH,MAAI,UAAU,UAAU,IAAI,GAAG;AAC/B,MAAI,YAAY,QAAW;AACzB,cAAU,EAAE,WAAW,IAAI,UAAU,KA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AS,SAAS,CAAC;AAClE,QAAM,SAAS,GAAG,IAAI,CAAC,GAAG,MAAwB,CAAC,KAAK,CAAC,IAAK,GAAG,KAAK,IAAI,KAAK,CAAC,IAAK,GAAG,GAAG,CAAC,IAAK,CAAC,CAAC,CAAC;AAEpG,QAAM,MAAM,QAAQ,gBAAgB;AACpC,QAAM,MAAM,OAAO,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,MAAM,KAAK,IAAI,GAAG,CAAC,GAAG,CAAC;AACzD,QAAM,QAAQ,MAAM;AACpB,MAAI,SAAS,EAAG,QAAO;AACvB,SAAO,OAAO,IAAI,CAAC,CAAC,GAAG,CAAC,MAAO,KAAK,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,IAAI,GAAG,KAAK,GAAG,CAAC,CAAE;AAC/E;AAGO,MAAM,gBAAgB;AAMtB,SAAS,oBACd,WACA,WACA,IACA,QACA,OACA,UAA8B,CAAC,GACrB;AACV,SAAO,cAAc,WAAW,WAAW,IAAI,OAAO,OAAO,EAAE,IAAI,CAAC,MAAO,IAAI,IAAI,MAAO,OAAO,CAAC,KAAK,GAAK;AAC9G;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/ta/index.d.ts
CHANGED
|
@@ -19,10 +19,9 @@ import type { series_float, series_bool, series_int, Source, simple_int, simple_
|
|
|
19
19
|
* - `na` values (also +/-Infinity) in the source series are ignored: the mean of the last `length` non-`na`
|
|
20
20
|
* values, and a bar with an `na` source keeps the previous result (as in PineScript)
|
|
21
21
|
* - Returns NaN until `length` non-`na` values are available
|
|
22
|
-
* - The
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* (see {@link math.sum}); a bar with an `na` source gives the mean of the last `length` earlier values
|
|
22
|
+
* - The correctly rounded window sum divided by the length, bit for bit with PineScript (#188)
|
|
23
|
+
* - With a series length, the window is the last `length` values of each bar (see {@link math.sum}); a bar with an
|
|
24
|
+
* `na` source gives the mean of the last `length` earlier values
|
|
26
25
|
*
|
|
27
26
|
* @example
|
|
28
27
|
* ```typescript
|
|
@@ -141,7 +140,7 @@ export declare function bb(series: Source, length: simple_int, mult: simple_floa
|
|
|
141
140
|
* As in PineScript: `na` values (also +/-Infinity) are skipped, the window holds the last
|
|
142
141
|
* `length` non-na values, and a bar whose own value is `na` keeps the previous result.
|
|
143
142
|
* The result is the square root of {@link variance} (0 when the variance is not positive), computed from
|
|
144
|
-
*
|
|
143
|
+
* the correctly rounded window sums of the values and of their squares, bit for bit as PineScript (#188).
|
|
145
144
|
*/
|
|
146
145
|
export declare function stdev(source: Source, length: simple_int | ArrayLike<number>, biased?: simple_bool): series_float;
|
|
147
146
|
/**
|
|
@@ -304,7 +303,7 @@ export declare function supertrend(factor: simple_float, atrPeriod: simple_int,
|
|
|
304
303
|
* - Moving average used in RSI calculation
|
|
305
304
|
* - Alpha = 1 / length (different from EMA which uses alpha = 2 / (length + 1))
|
|
306
305
|
* - First value is initialized with SMA, then uses exponential smoothing. As in PineScript, the seed is the
|
|
307
|
-
* `ta.sma` value (
|
|
306
|
+
* `ta.sma` value (the correctly rounded window sum divided by the length)
|
|
308
307
|
* - Formula: `RMA = (source + (length - 1) * RMA[1]) / length`, evaluated in this order as in PineScript
|
|
309
308
|
* (equal to `alpha * source + (1 - alpha) * RMA[1]`, but bit for bit)
|
|
310
309
|
* - `na` values (also +/-Infinity) in the source series are ignored
|
|
@@ -516,8 +515,7 @@ export declare function mom(source: Source, length: simple_int): series_float;
|
|
|
516
515
|
* - Measures average absolute distance from the mean
|
|
517
516
|
* - Less sensitive to outliers than standard deviation
|
|
518
517
|
* - PineScript rule (bit for bit): `sum(abs(source[i] - mean)) / length` for `i = 0 .. length - 1`, added newest
|
|
519
|
-
* first, with `mean = ta.sma(source, length)`
|
|
520
|
-
* non-zero deviation)
|
|
518
|
+
* first, with `mean = ta.sma(source, length)`
|
|
521
519
|
* - The loop reads the last `length` bars: an `na` among them gives `na`
|
|
522
520
|
*
|
|
523
521
|
* @example
|
|
@@ -544,7 +542,7 @@ export declare function dev(source: Source, length: simple_int): series_float;
|
|
|
544
542
|
* - `na` values in the source series are ignored
|
|
545
543
|
* - The function calculates on the `length` quantity of non-`na` values
|
|
546
544
|
* - Relationship: `stdev = sqrt(variance)`
|
|
547
|
-
* - Computed as PineScript, bit for bit, from
|
|
545
|
+
* - Computed as PineScript, bit for bit, from the correctly rounded window sums of the values and of their squares:
|
|
548
546
|
* biased `sumSq / length - mean * mean`, unbiased `sumSq / (length - 1) - mean * sum / (length - 1)`
|
|
549
547
|
*
|
|
550
548
|
* @example
|
|
@@ -664,7 +662,7 @@ export declare function linreg(source: Source, length: simple_int, offset?: simp
|
|
|
664
662
|
* - 0 = no correlation
|
|
665
663
|
* - Measures linear relationship between two series
|
|
666
664
|
* - As PineScript: `cov = sma(x * y) - sma(x) * sma(y)`, `r = cov / sqrt(variance(x) * variance(y))` with the
|
|
667
|
-
*
|
|
665
|
+
* the correctly rounded window sums of `ta.sma` / `ta.variance` (each skips its own `na` values); `|cov| <= 1e-10` gives 0, a
|
|
668
666
|
* zero variance gives `na`
|
|
669
667
|
*
|
|
670
668
|
* @example
|
|
@@ -1195,7 +1193,7 @@ export declare function min(source: Source): series_float;
|
|
|
1195
1193
|
* @remarks
|
|
1196
1194
|
* PineScript rule (bit for bit): `-num / math.sum(source, length)`, with `num` the sum of `source[i] * (i + 1)`
|
|
1197
1195
|
* for `i = 0 .. length - 1`, added newest first.
|
|
1198
|
-
* - The denominator is the
|
|
1196
|
+
* - The denominator is the correctly rounded window sum of `math.sum` (the last `length` non-`na` values)
|
|
1199
1197
|
* - The numerator reads the last `length` bars, so an `na` among them gives `na`
|
|
1200
1198
|
* - A zero denominator gives `na` (PineScript division by zero)
|
|
1201
1199
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ta/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,Y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