@tradejs/node 2.0.5 → 2.0.7

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/ai.js CHANGED
@@ -229,6 +229,51 @@ var buildMarketBreadthContextFromSignal = (signal) => {
229
229
  dispersion: toFiniteNumber(breadth.dispersion)
230
230
  };
231
231
  };
232
+ var buildMarketBreadthsContextFromSignal = (signal) => {
233
+ const baseContext = toRecord(signal.additionalIndicators?.baseContext);
234
+ const relative = toRecord(baseContext?.relative);
235
+ const breadths = toRecord(relative?.marketBreadths);
236
+ const build = (key) => {
237
+ const breadth = toRecord(breadths?.[key]);
238
+ if (!breadth) {
239
+ return {
240
+ source: null,
241
+ available: false,
242
+ universe: null,
243
+ interval: null,
244
+ stale: null,
245
+ symbolsCount: null,
246
+ advanceDeclineRatio: null,
247
+ pctAboveMa20: null,
248
+ pctAboveMa50: null,
249
+ equalWeightedReturn: null,
250
+ volumeWeightedReturn: null,
251
+ dispersion: null
252
+ };
253
+ }
254
+ return {
255
+ source: String(breadth.source ?? ""),
256
+ available: true,
257
+ universe: String(breadth.universe ?? ""),
258
+ interval: String(breadth.interval ?? ""),
259
+ stale: typeof breadth.stale === "boolean" ? breadth.stale : null,
260
+ symbolsCount: toFiniteNumber(breadth.symbolsCount),
261
+ advanceDeclineRatio: toFiniteNumber(breadth.advanceDeclineRatio),
262
+ pctAboveMa20: toFiniteNumber(breadth.pctAboveMa20),
263
+ pctAboveMa50: toFiniteNumber(breadth.pctAboveMa50),
264
+ equalWeightedReturn: toFiniteNumber(breadth.equalWeightedReturn),
265
+ volumeWeightedReturn: toFiniteNumber(breadth.volumeWeightedReturn),
266
+ dispersion: toFiniteNumber(breadth.dispersion)
267
+ };
268
+ };
269
+ return {
270
+ top5: build("top5"),
271
+ top10: build("top10"),
272
+ top30: build("top30"),
273
+ top50: build("top50"),
274
+ top100: build("top100")
275
+ };
276
+ };
232
277
  var buildTargetVsBtcContextFromSignal = (signal) => {
233
278
  const baseContext = toRecord(signal.additionalIndicators?.baseContext);
234
279
  const relative = toRecord(baseContext?.relative);
@@ -566,6 +611,7 @@ var buildAiMarketContext = (signal) => ({
566
611
  },
567
612
  relative: {
568
613
  marketBreadth: buildMarketBreadthContextFromSignal(signal),
614
+ marketBreadths: buildMarketBreadthsContextFromSignal(signal),
569
615
  targetVsBtc: buildTargetVsBtcContextFromSignal(signal),
570
616
  btcAltRegime: buildBtcAltRegimeContextFromSignal(signal),
571
617
  cmcGlobal: buildCmcGlobalContextFromSignal(signal),
@@ -1254,7 +1300,7 @@ Input payload structure:
1254
1300
  \u2022 \`marketContext.execution.binanceCoinbaseSpread\`: AI-friendly BTC spread view projected from \`payload.additionalIndicators.baseContext.relative.execution.venueSpread\`; \`value=(Coinbase-Binance)/Binance\`, \`bps=value*10000\`.
1255
1301
  \u2022 \`marketContext.participation.trueDelta\`: Binance taker buy/sell volume delta from kline payload when \`source=kline_taker_volume\`; otherwise absent/unavailable.
1256
1302
  \u2022 \`marketContext.participation.tradeFlow\`: Binance aggTrades buy/sell pressure buckets when available.
1257
- \u2022 \`marketContext.relative.marketBreadth\`: equal/volume-weighted alt-basket return, advance/decline ratio, and MA breadth for the configured Binance breadth universe.
1303
+ \u2022 \`marketContext.relative.marketBreadths.top5|top10|top30|top50|top100\`: equal/volume-weighted alt-basket return, advance/decline ratio, and MA breadth for the five versioned Binance breadth universes. \`marketBreadth\` remains the top30 primary view used by existing gates.
1258
1304
  \u2022 \`marketContext.relative.targetVsBtc\`: target/BTC ratio returns, alpha, beta, and short-window correlation; use it to decide whether the target is leading or lagging BTC in the signal direction.
1259
1305
  \u2022 \`marketContext.relative.btcAltRegime\`: Binance-derived BTC-vs-alt basket regime, BTC/alt 24h returns, BTC turnover share, and alt dispersion; use it as a broad alt-market risk pocket.
1260
1306
  \u2022 \`marketContext.relative.cmcGlobal\`: historical CoinMarketCap global market metrics: total/alt market cap, total/alt volume, BTC/ETH dominance and 24h changes, active markets, \`interval\`, and \`altLiquidityRegime\`.
package/dist/ai.mjs CHANGED
@@ -14,7 +14,7 @@ import {
14
14
  runAiPrompt,
15
15
  runAiPromptLocal,
16
16
  trimSeriesDeep
17
- } from "./chunk-IUZML4RK.mjs";
17
+ } from "./chunk-PD25CABK.mjs";
18
18
  import "./chunk-QVSMINLG.mjs";
19
19
  import "./chunk-WS5DYEVZ.mjs";
20
20
  import "./chunk-UV2HVMKZ.mjs";