@tradejs/infra 2.0.20 → 3.0.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.
Files changed (59) hide show
  1. package/dist/{chunk-YVIHTUV5.mjs → chunk-OLB6NQRG.mjs} +1 -1
  2. package/dist/{chunk-I2J6YDBD.mjs → chunk-ZXU7OYFU.mjs} +65 -38
  3. package/dist/internal-BuHqoCCV.d.mts +9 -0
  4. package/dist/internal-q48Torp4.d.ts +9 -0
  5. package/dist/ml.mjs +3 -3
  6. package/dist/query-tkHVD4Xo.d.mts +12 -0
  7. package/dist/query-tkHVD4Xo.d.ts +12 -0
  8. package/dist/strategyReleaseEvidence.d.mts +6 -1
  9. package/dist/strategyReleaseEvidence.d.ts +6 -1
  10. package/dist/strategyReleaseEvidence.js +20 -0
  11. package/dist/strategyReleaseEvidence.mjs +19 -0
  12. package/dist/timescale/candles.js +6 -4
  13. package/dist/timescale/candles.mjs +2 -2
  14. package/dist/timescale/client.d.mts +3 -2
  15. package/dist/timescale/client.d.ts +3 -2
  16. package/dist/timescale/client.js +40 -15
  17. package/dist/timescale/client.mjs +2 -2
  18. package/dist/timescale/derivatives.d.mts +4 -2
  19. package/dist/timescale/derivatives.d.ts +4 -2
  20. package/dist/timescale/derivatives.js +20 -12
  21. package/dist/timescale/derivatives.mjs +479 -13
  22. package/dist/timescale/hyperliquidWhales.d.mts +29 -25
  23. package/dist/timescale/hyperliquidWhales.d.ts +29 -25
  24. package/dist/timescale/hyperliquidWhales.js +84 -71
  25. package/dist/timescale/hyperliquidWhales.mjs +1103 -14
  26. package/dist/timescale/marketContext.d.mts +15 -11
  27. package/dist/timescale/marketContext.d.ts +15 -11
  28. package/dist/timescale/marketContext.js +67 -57
  29. package/dist/timescale/marketContext.mjs +1259 -28
  30. package/dist/timescale/spread.js +6 -4
  31. package/dist/timescale/spread.mjs +105 -5
  32. package/dist/userSettings.js +3 -316
  33. package/dist/userSettings.mjs +3 -21
  34. package/package.json +2 -22
  35. package/dist/aiEndpoints.d.mts +0 -10
  36. package/dist/aiEndpoints.d.ts +0 -10
  37. package/dist/aiEndpoints.js +0 -159
  38. package/dist/aiEndpoints.mjs +0 -12
  39. package/dist/aiLanguages.d.mts +0 -11
  40. package/dist/aiLanguages.d.ts +0 -11
  41. package/dist/aiLanguages.js +0 -71
  42. package/dist/aiLanguages.mjs +0 -12
  43. package/dist/aiModels.d.mts +0 -12
  44. package/dist/aiModels.d.ts +0 -12
  45. package/dist/aiModels.js +0 -272
  46. package/dist/aiModels.mjs +0 -17
  47. package/dist/chunk-2CZREG43.mjs +0 -112
  48. package/dist/chunk-CCC7DX2T.mjs +0 -44
  49. package/dist/chunk-DFMKDB2R.mjs +0 -1285
  50. package/dist/chunk-DTCLZIBM.mjs +0 -163
  51. package/dist/chunk-NWXFWTWU.mjs +0 -1114
  52. package/dist/chunk-SZQB7ER5.mjs +0 -492
  53. package/dist/chunk-XQ3YBULV.mjs +0 -132
  54. package/dist/internal-2coHaaos.d.mts +0 -26
  55. package/dist/internal-2coHaaos.d.ts +0 -26
  56. package/dist/timescale.d.mts +0 -9
  57. package/dist/timescale.d.ts +0 -9
  58. package/dist/timescale.js +0 -4228
  59. package/dist/timescale.mjs +0 -138
@@ -3,7 +3,7 @@ import {
3
3
  getPool,
4
4
  normalizeCandleProvider,
5
5
  normalizeCandleSymbol
6
- } from "./chunk-I2J6YDBD.mjs";
6
+ } from "./chunk-ZXU7OYFU.mjs";
7
7
 
8
8
  // src/timescale/candles.ts
9
9
  var toRows = (provider, symbol, interval, data) => {
@@ -97,42 +97,7 @@ var toMarketFeatureAge = (rowTs, atMs) => {
97
97
  return Number.isFinite(ageMs) ? ageMs : null;
98
98
  };
99
99
 
100
- // src/timescale/internal.ts
101
- var candlesSchemaReady = false;
102
- var derivativesSchemaReady = false;
103
- var spreadSchemaReady = false;
104
- var binanceMarketSchemaReady = false;
105
- var hyperliquidWhaleSchemaReady = false;
106
- var candlesSchemaReadyPromise = null;
107
- var derivativesSchemaReadyPromise = null;
108
- var spreadSchemaReadyPromise = null;
109
- var binanceMarketSchemaReadyPromise = null;
110
- var hyperliquidWhaleSchemaReadyPromise = null;
111
- var marketContextSchemaMode = "ensure";
112
- var verifiedMarketContextSchemas = /* @__PURE__ */ new Set();
113
- var configureTimescaleMarketContextSchemaMode = (mode) => {
114
- marketContextSchemaMode = mode;
115
- verifiedMarketContextSchemas.clear();
116
- };
117
- var closeTimescalePool = async () => {
118
- candlesSchemaReady = false;
119
- derivativesSchemaReady = false;
120
- spreadSchemaReady = false;
121
- binanceMarketSchemaReady = false;
122
- hyperliquidWhaleSchemaReady = false;
123
- candlesSchemaReadyPromise = null;
124
- derivativesSchemaReadyPromise = null;
125
- spreadSchemaReadyPromise = null;
126
- binanceMarketSchemaReadyPromise = null;
127
- hyperliquidWhaleSchemaReadyPromise = null;
128
- verifiedMarketContextSchemas.clear();
129
- await closePool();
130
- };
131
- var CANDLES_SCHEMA_LOCK_KEY = 61e4;
132
- var DERIVATIVES_SCHEMA_LOCK_KEY = 610001;
133
- var SPREAD_SCHEMA_LOCK_KEY = 610002;
134
- var BINANCE_MARKET_SCHEMA_LOCK_KEY = 610003;
135
- var HYPERLIQUID_WHALE_SCHEMA_LOCK_KEY = 610004;
100
+ // src/timescale/schema/lifecycle.ts
136
101
  var withSchemaLock = async (lockKey, work) => {
137
102
  const pool = getPool();
138
103
  await pool.query("SELECT pg_advisory_lock($1)", [lockKey]);
@@ -142,6 +107,15 @@ var withSchemaLock = async (lockKey, work) => {
142
107
  await pool.query("SELECT pg_advisory_unlock($1)", [lockKey]);
143
108
  }
144
109
  };
110
+
111
+ // src/timescale/schema/candles.ts
112
+ var candlesSchemaReady = false;
113
+ var candlesSchemaReadyPromise = null;
114
+ var CANDLES_SCHEMA_LOCK_KEY = 61e4;
115
+ var resetCandlesSchemaState = () => {
116
+ candlesSchemaReady = false;
117
+ candlesSchemaReadyPromise = null;
118
+ };
145
119
  var ensureCandlesSchema = async () => {
146
120
  if (candlesSchemaReady) return;
147
121
  if (candlesSchemaReadyPromise) {
@@ -198,6 +172,15 @@ var ensureCandlesSchema = async () => {
198
172
  });
199
173
  await candlesSchemaReadyPromise;
200
174
  };
175
+
176
+ // src/timescale/schema/derivatives.ts
177
+ var derivativesSchemaReady = false;
178
+ var derivativesSchemaReadyPromise = null;
179
+ var DERIVATIVES_SCHEMA_LOCK_KEY = 610001;
180
+ var resetDerivativesSchemaState = () => {
181
+ derivativesSchemaReady = false;
182
+ derivativesSchemaReadyPromise = null;
183
+ };
201
184
  var ensureDerivativesSchema = async () => {
202
185
  if (derivativesSchemaReady) return;
203
186
  if (derivativesSchemaReadyPromise) {
@@ -285,6 +268,15 @@ var ensureDerivativesSchema = async () => {
285
268
  });
286
269
  await derivativesSchemaReadyPromise;
287
270
  };
271
+
272
+ // src/timescale/schema/spread.ts
273
+ var spreadSchemaReady = false;
274
+ var spreadSchemaReadyPromise = null;
275
+ var SPREAD_SCHEMA_LOCK_KEY = 610002;
276
+ var resetSpreadSchemaState = () => {
277
+ spreadSchemaReady = false;
278
+ spreadSchemaReadyPromise = null;
279
+ };
288
280
  var ensureSpreadSchema = async () => {
289
281
  if (spreadSchemaReady) return;
290
282
  if (spreadSchemaReadyPromise) {
@@ -329,6 +321,15 @@ var ensureSpreadSchema = async () => {
329
321
  });
330
322
  await spreadSchemaReadyPromise;
331
323
  };
324
+
325
+ // src/timescale/schema/marketContext.ts
326
+ var binanceMarketSchemaReady = false;
327
+ var binanceMarketSchemaReadyPromise = null;
328
+ var BINANCE_MARKET_SCHEMA_LOCK_KEY = 610003;
329
+ var resetMarketContextSchemaState = () => {
330
+ binanceMarketSchemaReady = false;
331
+ binanceMarketSchemaReadyPromise = null;
332
+ };
332
333
  var ensureBinanceMarketSchema = async () => {
333
334
  if (binanceMarketSchemaReady) return;
334
335
  if (binanceMarketSchemaReadyPromise) {
@@ -609,6 +610,15 @@ var ensureBinanceMarketSchema = async () => {
609
610
  });
610
611
  await binanceMarketSchemaReadyPromise;
611
612
  };
613
+
614
+ // src/timescale/schema/hyperliquidWhales.ts
615
+ var hyperliquidWhaleSchemaReady = false;
616
+ var hyperliquidWhaleSchemaReadyPromise = null;
617
+ var HYPERLIQUID_WHALE_SCHEMA_LOCK_KEY = 610004;
618
+ var resetHyperliquidWhalesSchemaState = () => {
619
+ hyperliquidWhaleSchemaReady = false;
620
+ hyperliquidWhaleSchemaReadyPromise = null;
621
+ };
612
622
  var ensureHyperliquidWhaleSchema = async () => {
613
623
  if (hyperliquidWhaleSchemaReady) return;
614
624
  if (hyperliquidWhaleSchemaReadyPromise) {
@@ -837,6 +847,23 @@ var ensureHyperliquidWhaleSchema = async () => {
837
847
  });
838
848
  await hyperliquidWhaleSchemaReadyPromise;
839
849
  };
850
+
851
+ // src/timescale/internal.ts
852
+ var marketContextSchemaMode = "ensure";
853
+ var verifiedMarketContextSchemas = /* @__PURE__ */ new Set();
854
+ var configureTimescaleMarketContextSchemaMode = (mode) => {
855
+ marketContextSchemaMode = mode;
856
+ verifiedMarketContextSchemas.clear();
857
+ };
858
+ var closeTimescalePool = async () => {
859
+ resetCandlesSchemaState();
860
+ resetDerivativesSchemaState();
861
+ resetSpreadSchemaState();
862
+ resetMarketContextSchemaState();
863
+ resetHyperliquidWhalesSchemaState();
864
+ verifiedMarketContextSchemas.clear();
865
+ await closePool();
866
+ };
840
867
  var ensureCoinMarketCapContextSchema = async () => ensureBinanceMarketSchema();
841
868
  var ensureMarketContextSchema = async (source) => {
842
869
  switch (source) {
@@ -897,13 +924,13 @@ export {
897
924
  normalizeCandleSymbol,
898
925
  getSafeBulkInsertRows,
899
926
  toMarketFeatureAge,
900
- configureTimescaleMarketContextSchemaMode,
901
- closeTimescalePool,
902
927
  ensureCandlesSchema,
903
928
  ensureDerivativesSchema,
904
929
  ensureSpreadSchema,
905
930
  ensureBinanceMarketSchema,
906
931
  ensureHyperliquidWhaleSchema,
932
+ configureTimescaleMarketContextSchemaMode,
933
+ closeTimescalePool,
907
934
  ensureCoinMarketCapContextSchema,
908
935
  prepareMarketContextSchemaForRead,
909
936
  ensureMarketContextSchemas
@@ -0,0 +1,9 @@
1
+ import './query-tkHVD4Xo.mjs';
2
+
3
+ type TimescaleMarketContextSource = 'binance' | 'coinmarketcap' | 'derivatives' | 'hyperliquidWhales';
4
+ declare const configureTimescaleMarketContextSchemaMode: (mode: "ensure" | "verify") => void;
5
+ declare const closeTimescalePool: () => Promise<void>;
6
+ declare const ensureCoinMarketCapContextSchema: () => Promise<void>;
7
+ declare const ensureMarketContextSchemas: (sources: Iterable<TimescaleMarketContextSource>) => Promise<void>;
8
+
9
+ export { type TimescaleMarketContextSource as T, configureTimescaleMarketContextSchemaMode as a, ensureMarketContextSchemas as b, closeTimescalePool as c, ensureCoinMarketCapContextSchema as e };
@@ -0,0 +1,9 @@
1
+ import './query-tkHVD4Xo.js';
2
+
3
+ type TimescaleMarketContextSource = 'binance' | 'coinmarketcap' | 'derivatives' | 'hyperliquidWhales';
4
+ declare const configureTimescaleMarketContextSchemaMode: (mode: "ensure" | "verify") => void;
5
+ declare const closeTimescalePool: () => Promise<void>;
6
+ declare const ensureCoinMarketCapContextSchema: () => Promise<void>;
7
+ declare const ensureMarketContextSchemas: (sources: Iterable<TimescaleMarketContextSource>) => Promise<void>;
8
+
9
+ export { type TimescaleMarketContextSource as T, configureTimescaleMarketContextSchemaMode as a, ensureMarketContextSchemas as b, closeTimescalePool as c, ensureCoinMarketCapContextSchema as e };
package/dist/ml.mjs CHANGED
@@ -1,6 +1,3 @@
1
- import {
2
- logger
3
- } from "./chunk-LNFUOXDW.mjs";
4
1
  import {
5
2
  appendMlDatasetRow,
6
3
  closeAllMlDatasetWriters,
@@ -13,6 +10,9 @@ import {
13
10
  mergeJsonlFiles,
14
11
  toFileToken
15
12
  } from "./chunk-RQP5VSTH.mjs";
13
+ import {
14
+ logger
15
+ } from "./chunk-LNFUOXDW.mjs";
16
16
 
17
17
  // src/mlGrpc.ts
18
18
  import path from "path";
@@ -0,0 +1,12 @@
1
+ import { Pool } from 'pg';
2
+
3
+ declare global {
4
+ var __pgPool__: Pool | undefined;
5
+ }
6
+
7
+ type TimescaleMarketContextQueryOptions = {
8
+ signal?: AbortSignal;
9
+ timeoutMs?: number;
10
+ };
11
+
12
+ export type { TimescaleMarketContextQueryOptions as T };
@@ -0,0 +1,12 @@
1
+ import { Pool } from 'pg';
2
+
3
+ declare global {
4
+ var __pgPool__: Pool | undefined;
5
+ }
6
+
7
+ type TimescaleMarketContextQueryOptions = {
8
+ signal?: AbortSignal;
9
+ timeoutMs?: number;
10
+ };
11
+
12
+ export type { TimescaleMarketContextQueryOptions as T };
@@ -3,10 +3,15 @@ import { StrategyEvidenceMarkerPayload, StrategyEvidenceMarkerEnvelope } from '@
3
3
  declare const canonicalStrategyEvidenceJson: (value: unknown) => string;
4
4
  declare const strategyEvidenceSha256: (value: unknown) => string;
5
5
  declare const strategyEvidenceFingerprint: (value: unknown) => string;
6
+ /**
7
+ * Fingerprints strategy decision semantics without local/runtime bindings,
8
+ * credentials, config identity, or position-risk scale.
9
+ */
10
+ declare const strategyLogicConfigFingerprint: (value: unknown) => string;
6
11
  declare const strategyEvidenceFileSha256: (filePath: string) => Promise<string>;
7
12
  declare const safeStrategyEvidenceSegment: (value: string, fallback?: string) => string;
8
13
  declare const compactStrategyEvidenceTimestamp: (timestamp: number) => string;
9
14
  declare const createStrategyEvidenceMarkerEnvelope: (payload: StrategyEvidenceMarkerPayload) => StrategyEvidenceMarkerEnvelope;
10
15
  declare const verifyStrategyEvidenceMarkerEnvelope: (value: unknown) => StrategyEvidenceMarkerEnvelope;
11
16
 
12
- export { canonicalStrategyEvidenceJson, compactStrategyEvidenceTimestamp, createStrategyEvidenceMarkerEnvelope, safeStrategyEvidenceSegment, strategyEvidenceFileSha256, strategyEvidenceFingerprint, strategyEvidenceSha256, verifyStrategyEvidenceMarkerEnvelope };
17
+ export { canonicalStrategyEvidenceJson, compactStrategyEvidenceTimestamp, createStrategyEvidenceMarkerEnvelope, safeStrategyEvidenceSegment, strategyEvidenceFileSha256, strategyEvidenceFingerprint, strategyEvidenceSha256, strategyLogicConfigFingerprint, verifyStrategyEvidenceMarkerEnvelope };
@@ -3,10 +3,15 @@ import { StrategyEvidenceMarkerPayload, StrategyEvidenceMarkerEnvelope } from '@
3
3
  declare const canonicalStrategyEvidenceJson: (value: unknown) => string;
4
4
  declare const strategyEvidenceSha256: (value: unknown) => string;
5
5
  declare const strategyEvidenceFingerprint: (value: unknown) => string;
6
+ /**
7
+ * Fingerprints strategy decision semantics without local/runtime bindings,
8
+ * credentials, config identity, or position-risk scale.
9
+ */
10
+ declare const strategyLogicConfigFingerprint: (value: unknown) => string;
6
11
  declare const strategyEvidenceFileSha256: (filePath: string) => Promise<string>;
7
12
  declare const safeStrategyEvidenceSegment: (value: string, fallback?: string) => string;
8
13
  declare const compactStrategyEvidenceTimestamp: (timestamp: number) => string;
9
14
  declare const createStrategyEvidenceMarkerEnvelope: (payload: StrategyEvidenceMarkerPayload) => StrategyEvidenceMarkerEnvelope;
10
15
  declare const verifyStrategyEvidenceMarkerEnvelope: (value: unknown) => StrategyEvidenceMarkerEnvelope;
11
16
 
12
- export { canonicalStrategyEvidenceJson, compactStrategyEvidenceTimestamp, createStrategyEvidenceMarkerEnvelope, safeStrategyEvidenceSegment, strategyEvidenceFileSha256, strategyEvidenceFingerprint, strategyEvidenceSha256, verifyStrategyEvidenceMarkerEnvelope };
17
+ export { canonicalStrategyEvidenceJson, compactStrategyEvidenceTimestamp, createStrategyEvidenceMarkerEnvelope, safeStrategyEvidenceSegment, strategyEvidenceFileSha256, strategyEvidenceFingerprint, strategyEvidenceSha256, strategyLogicConfigFingerprint, verifyStrategyEvidenceMarkerEnvelope };
@@ -27,6 +27,7 @@ __export(strategyReleaseEvidence_exports, {
27
27
  strategyEvidenceFileSha256: () => strategyEvidenceFileSha256,
28
28
  strategyEvidenceFingerprint: () => strategyEvidenceFingerprint,
29
29
  strategyEvidenceSha256: () => strategyEvidenceSha256,
30
+ strategyLogicConfigFingerprint: () => strategyLogicConfigFingerprint,
30
31
  verifyStrategyEvidenceMarkerEnvelope: () => verifyStrategyEvidenceMarkerEnvelope
31
32
  });
32
33
  module.exports = __toCommonJS(strategyReleaseEvidence_exports);
@@ -43,6 +44,13 @@ var MARKER_TYPES = /* @__PURE__ */ new Set([
43
44
  "P",
44
45
  "R"
45
46
  ]);
47
+ var STRATEGY_LOGIC_BINDING_KEYS = /* @__PURE__ */ new Set([
48
+ "ACCOUNT_ID",
49
+ "DEPLOYMENT_ID",
50
+ "MAX_LOSS_VALUE",
51
+ "configId"
52
+ ]);
53
+ var SECRET_CONFIG_KEY_RE = /(?:^|_)(?:API_KEY|API_SECRET|TOKEN|PASSWORD|PRIVATE_KEY)$/i;
46
54
  var asRecord = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : null;
47
55
  var isString = (value) => typeof value === "string" && value.trim().length > 0;
48
56
  var isNumber = (value) => typeof value === "number" && Number.isFinite(value);
@@ -59,6 +67,17 @@ var canonicalStrategyEvidenceJson = (value) => {
59
67
  };
60
68
  var strategyEvidenceSha256 = (value) => (0, import_node_crypto.createHash)("sha256").update(canonicalStrategyEvidenceJson(value)).digest("hex");
61
69
  var strategyEvidenceFingerprint = (value) => strategyEvidenceSha256(value).slice(0, 16);
70
+ var normalizeStrategyLogicConfig = (value) => {
71
+ if (Array.isArray(value)) return value.map(normalizeStrategyLogicConfig);
72
+ const record = asRecord(value);
73
+ if (!record) return value;
74
+ return Object.fromEntries(
75
+ Object.entries(record).filter(
76
+ ([key]) => !STRATEGY_LOGIC_BINDING_KEYS.has(key) && !SECRET_CONFIG_KEY_RE.test(key)
77
+ ).sort(([left], [right]) => left.localeCompare(right)).map(([key, entry]) => [key, normalizeStrategyLogicConfig(entry)])
78
+ );
79
+ };
80
+ var strategyLogicConfigFingerprint = (value) => strategyEvidenceFingerprint(normalizeStrategyLogicConfig(value));
62
81
  var strategyEvidenceFileSha256 = async (filePath) => {
63
82
  const hash = (0, import_node_crypto.createHash)("sha256");
64
83
  for await (const chunk of (0, import_node_fs.createReadStream)(filePath)) hash.update(chunk);
@@ -116,5 +135,6 @@ var verifyStrategyEvidenceMarkerEnvelope = (value) => {
116
135
  strategyEvidenceFileSha256,
117
136
  strategyEvidenceFingerprint,
118
137
  strategyEvidenceSha256,
138
+ strategyLogicConfigFingerprint,
119
139
  verifyStrategyEvidenceMarkerEnvelope
120
140
  });
@@ -14,6 +14,13 @@ var MARKER_TYPES = /* @__PURE__ */ new Set([
14
14
  "P",
15
15
  "R"
16
16
  ]);
17
+ var STRATEGY_LOGIC_BINDING_KEYS = /* @__PURE__ */ new Set([
18
+ "ACCOUNT_ID",
19
+ "DEPLOYMENT_ID",
20
+ "MAX_LOSS_VALUE",
21
+ "configId"
22
+ ]);
23
+ var SECRET_CONFIG_KEY_RE = /(?:^|_)(?:API_KEY|API_SECRET|TOKEN|PASSWORD|PRIVATE_KEY)$/i;
17
24
  var asRecord = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : null;
18
25
  var isString = (value) => typeof value === "string" && value.trim().length > 0;
19
26
  var isNumber = (value) => typeof value === "number" && Number.isFinite(value);
@@ -30,6 +37,17 @@ var canonicalStrategyEvidenceJson = (value) => {
30
37
  };
31
38
  var strategyEvidenceSha256 = (value) => createHash("sha256").update(canonicalStrategyEvidenceJson(value)).digest("hex");
32
39
  var strategyEvidenceFingerprint = (value) => strategyEvidenceSha256(value).slice(0, 16);
40
+ var normalizeStrategyLogicConfig = (value) => {
41
+ if (Array.isArray(value)) return value.map(normalizeStrategyLogicConfig);
42
+ const record = asRecord(value);
43
+ if (!record) return value;
44
+ return Object.fromEntries(
45
+ Object.entries(record).filter(
46
+ ([key]) => !STRATEGY_LOGIC_BINDING_KEYS.has(key) && !SECRET_CONFIG_KEY_RE.test(key)
47
+ ).sort(([left], [right]) => left.localeCompare(right)).map(([key, entry]) => [key, normalizeStrategyLogicConfig(entry)])
48
+ );
49
+ };
50
+ var strategyLogicConfigFingerprint = (value) => strategyEvidenceFingerprint(normalizeStrategyLogicConfig(value));
33
51
  var strategyEvidenceFileSha256 = async (filePath) => {
34
52
  const hash = createHash("sha256");
35
53
  for await (const chunk of createReadStream(filePath)) hash.update(chunk);
@@ -86,5 +104,6 @@ export {
86
104
  strategyEvidenceFileSha256,
87
105
  strategyEvidenceFingerprint,
88
106
  strategyEvidenceSha256,
107
+ strategyLogicConfigFingerprint,
89
108
  verifyStrategyEvidenceMarkerEnvelope
90
109
  };
@@ -57,10 +57,7 @@ var getPool = () => {
57
57
  var normalizeCandleProvider = (provider) => String(provider || "").trim().toLowerCase();
58
58
  var normalizeCandleSymbol = (symbol) => String(symbol || "").trim().toUpperCase();
59
59
 
60
- // src/timescale/internal.ts
61
- var candlesSchemaReady = false;
62
- var candlesSchemaReadyPromise = null;
63
- var CANDLES_SCHEMA_LOCK_KEY = 61e4;
60
+ // src/timescale/schema/lifecycle.ts
64
61
  var withSchemaLock = async (lockKey, work) => {
65
62
  const pool = getPool();
66
63
  await pool.query("SELECT pg_advisory_lock($1)", [lockKey]);
@@ -70,6 +67,11 @@ var withSchemaLock = async (lockKey, work) => {
70
67
  await pool.query("SELECT pg_advisory_unlock($1)", [lockKey]);
71
68
  }
72
69
  };
70
+
71
+ // src/timescale/schema/candles.ts
72
+ var candlesSchemaReady = false;
73
+ var candlesSchemaReadyPromise = null;
74
+ var CANDLES_SCHEMA_LOCK_KEY = 61e4;
73
75
  var ensureCandlesSchema = async () => {
74
76
  if (candlesSchemaReady) return;
75
77
  if (candlesSchemaReadyPromise) {
@@ -7,8 +7,8 @@ import {
7
7
  toRows,
8
8
  upsertCandles,
9
9
  waitForDbReady
10
- } from "../chunk-YVIHTUV5.mjs";
11
- import "../chunk-I2J6YDBD.mjs";
10
+ } from "../chunk-OLB6NQRG.mjs";
11
+ import "../chunk-ZXU7OYFU.mjs";
12
12
  export {
13
13
  deleteCandles,
14
14
  findContinuityGap,
@@ -1,4 +1,5 @@
1
- export { T as TimescaleMarketContextQueryOptions, a as TimescaleMarketContextSource, c as closeTimescalePool, b as configureTimescaleMarketContextSchemaMode } from '../internal-2coHaaos.mjs';
1
+ export { T as TimescaleMarketContextSource, c as closeTimescalePool, a as configureTimescaleMarketContextSchemaMode } from '../internal-BuHqoCCV.mjs';
2
2
  export { waitForDbReady } from './candles.mjs';
3
- import 'pg';
3
+ export { T as TimescaleMarketContextQueryOptions } from '../query-tkHVD4Xo.mjs';
4
4
  import '@tradejs/types';
5
+ import 'pg';
@@ -1,4 +1,5 @@
1
- export { T as TimescaleMarketContextQueryOptions, a as TimescaleMarketContextSource, c as closeTimescalePool, b as configureTimescaleMarketContextSchemaMode } from '../internal-2coHaaos.js';
1
+ export { T as TimescaleMarketContextSource, c as closeTimescalePool, a as configureTimescaleMarketContextSchemaMode } from '../internal-q48Torp4.js';
2
2
  export { waitForDbReady } from './candles.js';
3
- import 'pg';
3
+ export { T as TimescaleMarketContextQueryOptions } from '../query-tkHVD4Xo.js';
4
4
  import '@tradejs/types';
5
+ import 'pg';
@@ -54,17 +54,47 @@ var closePool = async () => {
54
54
  await pool.end();
55
55
  };
56
56
 
57
- // src/timescale/internal.ts
57
+ // src/timescale/schema/candles.ts
58
58
  var candlesSchemaReady = false;
59
- var derivativesSchemaReady = false;
60
- var spreadSchemaReady = false;
61
- var binanceMarketSchemaReady = false;
62
- var hyperliquidWhaleSchemaReady = false;
63
59
  var candlesSchemaReadyPromise = null;
60
+ var resetCandlesSchemaState = () => {
61
+ candlesSchemaReady = false;
62
+ candlesSchemaReadyPromise = null;
63
+ };
64
+
65
+ // src/timescale/schema/derivatives.ts
66
+ var derivativesSchemaReady = false;
64
67
  var derivativesSchemaReadyPromise = null;
68
+ var resetDerivativesSchemaState = () => {
69
+ derivativesSchemaReady = false;
70
+ derivativesSchemaReadyPromise = null;
71
+ };
72
+
73
+ // src/timescale/schema/spread.ts
74
+ var spreadSchemaReady = false;
65
75
  var spreadSchemaReadyPromise = null;
76
+ var resetSpreadSchemaState = () => {
77
+ spreadSchemaReady = false;
78
+ spreadSchemaReadyPromise = null;
79
+ };
80
+
81
+ // src/timescale/schema/marketContext.ts
82
+ var binanceMarketSchemaReady = false;
66
83
  var binanceMarketSchemaReadyPromise = null;
84
+ var resetMarketContextSchemaState = () => {
85
+ binanceMarketSchemaReady = false;
86
+ binanceMarketSchemaReadyPromise = null;
87
+ };
88
+
89
+ // src/timescale/schema/hyperliquidWhales.ts
90
+ var hyperliquidWhaleSchemaReady = false;
67
91
  var hyperliquidWhaleSchemaReadyPromise = null;
92
+ var resetHyperliquidWhalesSchemaState = () => {
93
+ hyperliquidWhaleSchemaReady = false;
94
+ hyperliquidWhaleSchemaReadyPromise = null;
95
+ };
96
+
97
+ // src/timescale/internal.ts
68
98
  var marketContextSchemaMode = "ensure";
69
99
  var verifiedMarketContextSchemas = /* @__PURE__ */ new Set();
70
100
  var configureTimescaleMarketContextSchemaMode = (mode) => {
@@ -72,16 +102,11 @@ var configureTimescaleMarketContextSchemaMode = (mode) => {
72
102
  verifiedMarketContextSchemas.clear();
73
103
  };
74
104
  var closeTimescalePool = async () => {
75
- candlesSchemaReady = false;
76
- derivativesSchemaReady = false;
77
- spreadSchemaReady = false;
78
- binanceMarketSchemaReady = false;
79
- hyperliquidWhaleSchemaReady = false;
80
- candlesSchemaReadyPromise = null;
81
- derivativesSchemaReadyPromise = null;
82
- spreadSchemaReadyPromise = null;
83
- binanceMarketSchemaReadyPromise = null;
84
- hyperliquidWhaleSchemaReadyPromise = null;
105
+ resetCandlesSchemaState();
106
+ resetDerivativesSchemaState();
107
+ resetSpreadSchemaState();
108
+ resetMarketContextSchemaState();
109
+ resetHyperliquidWhalesSchemaState();
85
110
  verifiedMarketContextSchemas.clear();
86
111
  await closePool();
87
112
  };
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  waitForDbReady
3
- } from "../chunk-YVIHTUV5.mjs";
3
+ } from "../chunk-OLB6NQRG.mjs";
4
4
  import {
5
5
  closeTimescalePool,
6
6
  configureTimescaleMarketContextSchemaMode
7
- } from "../chunk-I2J6YDBD.mjs";
7
+ } from "../chunk-ZXU7OYFU.mjs";
8
8
  export {
9
9
  closeTimescalePool,
10
10
  configureTimescaleMarketContextSchemaMode,
@@ -1,8 +1,10 @@
1
1
  import { DerivativesInterval, DerivativesRow } from '@tradejs/types';
2
- export { T as TimescaleMarketContextQueryOptions, f as ensureDerivativesSchema } from '../internal-2coHaaos.mjs';
2
+ export { T as TimescaleMarketContextQueryOptions } from '../query-tkHVD4Xo.mjs';
3
3
  export { M as MarketFeatureAsOf } from '../values-BrvcmnfM.mjs';
4
4
  import 'pg';
5
5
 
6
+ declare const ensureDerivativesSchema: () => Promise<void>;
7
+
6
8
  declare function upsertDerivatives(rows: DerivativesRow[]): Promise<void>;
7
9
  declare function getDerivativesRangeForSymbols(symbols: string[], interval: DerivativesInterval, startMs: number, endMs: number): Promise<any[]>;
8
10
  declare function getDerivativesDataEdgesForSymbols(symbols: string[], interval: DerivativesInterval): Promise<Map<string, {
@@ -87,4 +89,4 @@ declare function getDerivativesSummary(hours?: number, limit?: number, symbols?:
87
89
  }[];
88
90
  }>;
89
91
 
90
- export { type DerivativesMetricCoverageMetric, applyDerivativesMetricCoverage, getDerivativesBackfillCoverage, getDerivativesDataEdgesForSymbols, getDerivativesMetricCoverage, getDerivativesRangeForSymbols, getDerivativesSummary, getDerivativesWindow, upsertDerivatives, upsertDerivativesBackfillCoverage };
92
+ export { type DerivativesMetricCoverageMetric, applyDerivativesMetricCoverage, ensureDerivativesSchema, getDerivativesBackfillCoverage, getDerivativesDataEdgesForSymbols, getDerivativesMetricCoverage, getDerivativesRangeForSymbols, getDerivativesSummary, getDerivativesWindow, upsertDerivatives, upsertDerivativesBackfillCoverage };
@@ -1,8 +1,10 @@
1
1
  import { DerivativesInterval, DerivativesRow } from '@tradejs/types';
2
- export { T as TimescaleMarketContextQueryOptions, f as ensureDerivativesSchema } from '../internal-2coHaaos.js';
2
+ export { T as TimescaleMarketContextQueryOptions } from '../query-tkHVD4Xo.js';
3
3
  export { M as MarketFeatureAsOf } from '../values-BrvcmnfM.js';
4
4
  import 'pg';
5
5
 
6
+ declare const ensureDerivativesSchema: () => Promise<void>;
7
+
6
8
  declare function upsertDerivatives(rows: DerivativesRow[]): Promise<void>;
7
9
  declare function getDerivativesRangeForSymbols(symbols: string[], interval: DerivativesInterval, startMs: number, endMs: number): Promise<any[]>;
8
10
  declare function getDerivativesDataEdgesForSymbols(symbols: string[], interval: DerivativesInterval): Promise<Map<string, {
@@ -87,4 +89,4 @@ declare function getDerivativesSummary(hours?: number, limit?: number, symbols?:
87
89
  }[];
88
90
  }>;
89
91
 
90
- export { type DerivativesMetricCoverageMetric, applyDerivativesMetricCoverage, getDerivativesBackfillCoverage, getDerivativesDataEdgesForSymbols, getDerivativesMetricCoverage, getDerivativesRangeForSymbols, getDerivativesSummary, getDerivativesWindow, upsertDerivatives, upsertDerivativesBackfillCoverage };
92
+ export { type DerivativesMetricCoverageMetric, applyDerivativesMetricCoverage, ensureDerivativesSchema, getDerivativesBackfillCoverage, getDerivativesDataEdgesForSymbols, getDerivativesMetricCoverage, getDerivativesRangeForSymbols, getDerivativesSummary, getDerivativesWindow, upsertDerivatives, upsertDerivativesBackfillCoverage };
@@ -119,18 +119,7 @@ var queryMarketContext = async (text, values, options = {}) => {
119
119
  // src/timescale/values.ts
120
120
  var normalizeCandleSymbol = (symbol) => String(symbol || "").trim().toUpperCase();
121
121
 
122
- // src/timescale/internal.ts
123
- var derivativesSchemaReady = false;
124
- var binanceMarketSchemaReady = false;
125
- var hyperliquidWhaleSchemaReady = false;
126
- var derivativesSchemaReadyPromise = null;
127
- var binanceMarketSchemaReadyPromise = null;
128
- var hyperliquidWhaleSchemaReadyPromise = null;
129
- var marketContextSchemaMode = "ensure";
130
- var verifiedMarketContextSchemas = /* @__PURE__ */ new Set();
131
- var DERIVATIVES_SCHEMA_LOCK_KEY = 610001;
132
- var BINANCE_MARKET_SCHEMA_LOCK_KEY = 610003;
133
- var HYPERLIQUID_WHALE_SCHEMA_LOCK_KEY = 610004;
122
+ // src/timescale/schema/lifecycle.ts
134
123
  var withSchemaLock = async (lockKey, work) => {
135
124
  const pool = getPool();
136
125
  await pool.query("SELECT pg_advisory_lock($1)", [lockKey]);
@@ -140,6 +129,11 @@ var withSchemaLock = async (lockKey, work) => {
140
129
  await pool.query("SELECT pg_advisory_unlock($1)", [lockKey]);
141
130
  }
142
131
  };
132
+
133
+ // src/timescale/schema/derivatives.ts
134
+ var derivativesSchemaReady = false;
135
+ var derivativesSchemaReadyPromise = null;
136
+ var DERIVATIVES_SCHEMA_LOCK_KEY = 610001;
143
137
  var ensureDerivativesSchema = async () => {
144
138
  if (derivativesSchemaReady) return;
145
139
  if (derivativesSchemaReadyPromise) {
@@ -227,6 +221,11 @@ var ensureDerivativesSchema = async () => {
227
221
  });
228
222
  await derivativesSchemaReadyPromise;
229
223
  };
224
+
225
+ // src/timescale/schema/marketContext.ts
226
+ var binanceMarketSchemaReady = false;
227
+ var binanceMarketSchemaReadyPromise = null;
228
+ var BINANCE_MARKET_SCHEMA_LOCK_KEY = 610003;
230
229
  var ensureBinanceMarketSchema = async () => {
231
230
  if (binanceMarketSchemaReady) return;
232
231
  if (binanceMarketSchemaReadyPromise) {
@@ -507,6 +506,11 @@ var ensureBinanceMarketSchema = async () => {
507
506
  });
508
507
  await binanceMarketSchemaReadyPromise;
509
508
  };
509
+
510
+ // src/timescale/schema/hyperliquidWhales.ts
511
+ var hyperliquidWhaleSchemaReady = false;
512
+ var hyperliquidWhaleSchemaReadyPromise = null;
513
+ var HYPERLIQUID_WHALE_SCHEMA_LOCK_KEY = 610004;
510
514
  var ensureHyperliquidWhaleSchema = async () => {
511
515
  if (hyperliquidWhaleSchemaReady) return;
512
516
  if (hyperliquidWhaleSchemaReadyPromise) {
@@ -735,6 +739,10 @@ var ensureHyperliquidWhaleSchema = async () => {
735
739
  });
736
740
  await hyperliquidWhaleSchemaReadyPromise;
737
741
  };
742
+
743
+ // src/timescale/internal.ts
744
+ var marketContextSchemaMode = "ensure";
745
+ var verifiedMarketContextSchemas = /* @__PURE__ */ new Set();
738
746
  var ensureCoinMarketCapContextSchema = async () => ensureBinanceMarketSchema();
739
747
  var ensureMarketContextSchema = async (source) => {
740
748
  switch (source) {