@tradejs/infra 2.0.18 → 2.0.19

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 (53) hide show
  1. package/dist/ai.js +3 -54
  2. package/dist/ai.mjs +1 -54
  3. package/dist/chunk-2CZREG43.mjs +112 -0
  4. package/dist/chunk-DFMKDB2R.mjs +1285 -0
  5. package/dist/chunk-I2J6YDBD.mjs +910 -0
  6. package/dist/chunk-NWXFWTWU.mjs +1114 -0
  7. package/dist/chunk-SZQB7ER5.mjs +492 -0
  8. package/dist/chunk-YVIHTUV5.mjs +286 -0
  9. package/dist/internal-2coHaaos.d.mts +26 -0
  10. package/dist/internal-2coHaaos.d.ts +26 -0
  11. package/dist/runtimeDeployments.d.mts +10 -0
  12. package/dist/runtimeDeployments.d.ts +10 -0
  13. package/dist/runtimeDeployments.js +447 -0
  14. package/dist/runtimeDeployments.mjs +81 -0
  15. package/dist/runtimeStrategyConfigs.d.mts +28 -0
  16. package/dist/runtimeStrategyConfigs.d.ts +28 -0
  17. package/dist/runtimeStrategyConfigs.js +425 -0
  18. package/dist/runtimeStrategyConfigs.mjs +89 -0
  19. package/dist/timescale/candles.d.mts +38 -0
  20. package/dist/timescale/candles.d.ts +38 -0
  21. package/dist/timescale/candles.js +408 -0
  22. package/dist/timescale/candles.mjs +21 -0
  23. package/dist/timescale/client.d.mts +4 -0
  24. package/dist/timescale/client.d.ts +4 -0
  25. package/dist/timescale/client.js +109 -0
  26. package/dist/timescale/client.mjs +12 -0
  27. package/dist/timescale/derivatives.d.mts +90 -0
  28. package/dist/timescale/derivatives.d.ts +90 -0
  29. package/dist/timescale/derivatives.js +1270 -0
  30. package/dist/timescale/derivatives.mjs +26 -0
  31. package/dist/timescale/hyperliquidWhales.d.mts +149 -0
  32. package/dist/timescale/hyperliquidWhales.d.ts +149 -0
  33. package/dist/timescale/hyperliquidWhales.js +1893 -0
  34. package/dist/timescale/hyperliquidWhales.mjs +30 -0
  35. package/dist/timescale/marketContext.d.mts +188 -0
  36. package/dist/timescale/marketContext.d.ts +188 -0
  37. package/dist/timescale/marketContext.js +2091 -0
  38. package/dist/timescale/marketContext.mjs +60 -0
  39. package/dist/timescale/spread.d.mts +11 -0
  40. package/dist/timescale/spread.d.ts +11 -0
  41. package/dist/timescale/spread.js +215 -0
  42. package/dist/timescale/spread.mjs +11 -0
  43. package/dist/timescale.d.mts +9 -476
  44. package/dist/timescale.d.ts +9 -476
  45. package/dist/timescale.js +2121 -2112
  46. package/dist/timescale.mjs +73 -4070
  47. package/dist/tradingAccounts.d.mts +2 -8
  48. package/dist/tradingAccounts.d.ts +2 -8
  49. package/dist/tradingAccounts.js +0 -71
  50. package/dist/tradingAccounts.mjs +0 -65
  51. package/dist/values-BrvcmnfM.d.mts +6 -0
  52. package/dist/values-BrvcmnfM.d.ts +6 -0
  53. package/package.json +43 -2
@@ -1,4 +1,4 @@
1
- import { RuntimeDeployment, RuntimeDeploymentHeartbeat, TradingAccountRef, MarketUniverse } from '@tradejs/types';
1
+ import { TradingAccountRef, MarketUniverse } from '@tradejs/types';
2
2
 
3
3
  declare const listTradingAccounts: (userName: string) => Promise<TradingAccountRef[]>;
4
4
  declare const getTradingAccount: (userName: string, accountId: string) => Promise<TradingAccountRef | null>;
@@ -10,11 +10,5 @@ declare const resolveTradingAccount: ({ userName, accountId, provider, universe,
10
10
  provider: string;
11
11
  universe?: MarketUniverse;
12
12
  }) => Promise<TradingAccountRef | null>;
13
- declare const listRuntimeDeployments: (userName: string) => Promise<RuntimeDeployment[]>;
14
- declare const getRuntimeDeployment: (userName: string, deploymentId: string) => Promise<RuntimeDeployment | null>;
15
- declare const saveRuntimeDeployment: (userName: string, deployment: RuntimeDeployment) => Promise<RuntimeDeployment>;
16
- declare const deleteRuntimeDeployment: (userName: string, deploymentId: string) => Promise<void>;
17
- declare const getRuntimeDeploymentHeartbeat: (userName: string, deploymentId: string) => Promise<RuntimeDeploymentHeartbeat | null>;
18
- declare const saveRuntimeDeploymentHeartbeat: (userName: string, heartbeat: RuntimeDeploymentHeartbeat) => Promise<RuntimeDeploymentHeartbeat>;
19
13
 
20
- export { deleteRuntimeDeployment, deleteTradingAccount, getRuntimeDeployment, getRuntimeDeploymentHeartbeat, getTradingAccount, listRuntimeDeployments, listTradingAccounts, resolveTradingAccount, saveRuntimeDeployment, saveRuntimeDeploymentHeartbeat, saveTradingAccount };
14
+ export { deleteTradingAccount, getTradingAccount, listTradingAccounts, resolveTradingAccount, saveTradingAccount };
@@ -1,4 +1,4 @@
1
- import { RuntimeDeployment, RuntimeDeploymentHeartbeat, TradingAccountRef, MarketUniverse } from '@tradejs/types';
1
+ import { TradingAccountRef, MarketUniverse } from '@tradejs/types';
2
2
 
3
3
  declare const listTradingAccounts: (userName: string) => Promise<TradingAccountRef[]>;
4
4
  declare const getTradingAccount: (userName: string, accountId: string) => Promise<TradingAccountRef | null>;
@@ -10,11 +10,5 @@ declare const resolveTradingAccount: ({ userName, accountId, provider, universe,
10
10
  provider: string;
11
11
  universe?: MarketUniverse;
12
12
  }) => Promise<TradingAccountRef | null>;
13
- declare const listRuntimeDeployments: (userName: string) => Promise<RuntimeDeployment[]>;
14
- declare const getRuntimeDeployment: (userName: string, deploymentId: string) => Promise<RuntimeDeployment | null>;
15
- declare const saveRuntimeDeployment: (userName: string, deployment: RuntimeDeployment) => Promise<RuntimeDeployment>;
16
- declare const deleteRuntimeDeployment: (userName: string, deploymentId: string) => Promise<void>;
17
- declare const getRuntimeDeploymentHeartbeat: (userName: string, deploymentId: string) => Promise<RuntimeDeploymentHeartbeat | null>;
18
- declare const saveRuntimeDeploymentHeartbeat: (userName: string, heartbeat: RuntimeDeploymentHeartbeat) => Promise<RuntimeDeploymentHeartbeat>;
19
13
 
20
- export { deleteRuntimeDeployment, deleteTradingAccount, getRuntimeDeployment, getRuntimeDeploymentHeartbeat, getTradingAccount, listRuntimeDeployments, listTradingAccounts, resolveTradingAccount, saveRuntimeDeployment, saveRuntimeDeploymentHeartbeat, saveTradingAccount };
14
+ export { deleteTradingAccount, getTradingAccount, listTradingAccounts, resolveTradingAccount, saveTradingAccount };
@@ -30,16 +30,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/tradingAccounts.ts
31
31
  var tradingAccounts_exports = {};
32
32
  __export(tradingAccounts_exports, {
33
- deleteRuntimeDeployment: () => deleteRuntimeDeployment,
34
33
  deleteTradingAccount: () => deleteTradingAccount,
35
- getRuntimeDeployment: () => getRuntimeDeployment,
36
- getRuntimeDeploymentHeartbeat: () => getRuntimeDeploymentHeartbeat,
37
34
  getTradingAccount: () => getTradingAccount,
38
- listRuntimeDeployments: () => listRuntimeDeployments,
39
35
  listTradingAccounts: () => listTradingAccounts,
40
36
  resolveTradingAccount: () => resolveTradingAccount,
41
- saveRuntimeDeployment: () => saveRuntimeDeployment,
42
- saveRuntimeDeploymentHeartbeat: () => saveRuntimeDeploymentHeartbeat,
43
37
  saveTradingAccount: () => saveTradingAccount
44
38
  });
45
39
  module.exports = __toCommonJS(tradingAccounts_exports);
@@ -387,9 +381,6 @@ var normalizeId = (value, label) => {
387
381
  var isTradingAccount = (value) => Boolean(
388
382
  value && typeof value === "object" && typeof value.id === "string" && typeof value.provider === "string"
389
383
  );
390
- var isRuntimeDeployment = (value) => Boolean(
391
- value && typeof value === "object" && typeof value.id === "string" && typeof value.accountId === "string"
392
- );
393
384
  var withProviderUniverses = (account) => account.provider.toLowerCase() === "bybit" ? { ...account, universes: ["crypto", "tradfi"] } : account;
394
385
  var listTradingAccounts = async (userName) => {
395
386
  if (typeof redisKeys.tradingAccounts !== "function") return [];
@@ -489,73 +480,11 @@ var resolveTradingAccount = async ({
489
480
  apiSecret: legacyApiSecret
490
481
  };
491
482
  };
492
- var listRuntimeDeployments = async (userName) => {
493
- const keys = await getKeys(redisKeys.runtimeDeployments(userName));
494
- const values = await Promise.all(keys.map((key) => getData(key, null)));
495
- return values.filter(isRuntimeDeployment).sort((left, right) => left.label.localeCompare(right.label));
496
- };
497
- var getRuntimeDeployment = async (userName, deploymentId) => {
498
- const normalizedId = normalizeId(deploymentId, "Deployment id");
499
- const value = await getData(
500
- redisKeys.runtimeDeployment(userName, normalizedId),
501
- null
502
- );
503
- return isRuntimeDeployment(value) ? value : null;
504
- };
505
- var saveRuntimeDeployment = async (userName, deployment) => {
506
- const normalized = {
507
- ...deployment,
508
- id: normalizeId(deployment.id, "Deployment id"),
509
- label: deployment.label.trim(),
510
- provider: deployment.provider.trim().toLowerCase(),
511
- accountId: normalizeId(deployment.accountId, "Account id")
512
- };
513
- await setData(
514
- redisKeys.runtimeDeployment(userName, normalized.id),
515
- normalized,
516
- { expire: 0 }
517
- );
518
- return normalized;
519
- };
520
- var deleteRuntimeDeployment = async (userName, deploymentId) => {
521
- const normalizedId = normalizeId(deploymentId, "Deployment id");
522
- await Promise.all([
523
- delKey(redisKeys.runtimeDeployment(userName, normalizedId)),
524
- delKey(redisKeys.runtimeDeploymentHeartbeat(userName, normalizedId))
525
- ]);
526
- };
527
- var getRuntimeDeploymentHeartbeat = async (userName, deploymentId) => {
528
- const value = await getData(
529
- redisKeys.runtimeDeploymentHeartbeat(
530
- userName,
531
- normalizeId(deploymentId, "Deployment id")
532
- ),
533
- null
534
- );
535
- return value && typeof value === "object" ? value : null;
536
- };
537
- var saveRuntimeDeploymentHeartbeat = async (userName, heartbeat) => {
538
- await setData(
539
- redisKeys.runtimeDeploymentHeartbeat(
540
- userName,
541
- normalizeId(heartbeat.deploymentId, "Deployment id")
542
- ),
543
- heartbeat,
544
- { expire: 0 }
545
- );
546
- return heartbeat;
547
- };
548
483
  // Annotate the CommonJS export names for ESM import in node:
549
484
  0 && (module.exports = {
550
- deleteRuntimeDeployment,
551
485
  deleteTradingAccount,
552
- getRuntimeDeployment,
553
- getRuntimeDeploymentHeartbeat,
554
486
  getTradingAccount,
555
- listRuntimeDeployments,
556
487
  listTradingAccounts,
557
488
  resolveTradingAccount,
558
- saveRuntimeDeployment,
559
- saveRuntimeDeploymentHeartbeat,
560
489
  saveTradingAccount
561
490
  });
@@ -17,9 +17,6 @@ var normalizeId = (value, label) => {
17
17
  var isTradingAccount = (value) => Boolean(
18
18
  value && typeof value === "object" && typeof value.id === "string" && typeof value.provider === "string"
19
19
  );
20
- var isRuntimeDeployment = (value) => Boolean(
21
- value && typeof value === "object" && typeof value.id === "string" && typeof value.accountId === "string"
22
- );
23
20
  var withProviderUniverses = (account) => account.provider.toLowerCase() === "bybit" ? { ...account, universes: ["crypto", "tradfi"] } : account;
24
21
  var listTradingAccounts = async (userName) => {
25
22
  if (typeof redisKeys.tradingAccounts !== "function") return [];
@@ -119,72 +116,10 @@ var resolveTradingAccount = async ({
119
116
  apiSecret: legacyApiSecret
120
117
  };
121
118
  };
122
- var listRuntimeDeployments = async (userName) => {
123
- const keys = await getKeys(redisKeys.runtimeDeployments(userName));
124
- const values = await Promise.all(keys.map((key) => getData(key, null)));
125
- return values.filter(isRuntimeDeployment).sort((left, right) => left.label.localeCompare(right.label));
126
- };
127
- var getRuntimeDeployment = async (userName, deploymentId) => {
128
- const normalizedId = normalizeId(deploymentId, "Deployment id");
129
- const value = await getData(
130
- redisKeys.runtimeDeployment(userName, normalizedId),
131
- null
132
- );
133
- return isRuntimeDeployment(value) ? value : null;
134
- };
135
- var saveRuntimeDeployment = async (userName, deployment) => {
136
- const normalized = {
137
- ...deployment,
138
- id: normalizeId(deployment.id, "Deployment id"),
139
- label: deployment.label.trim(),
140
- provider: deployment.provider.trim().toLowerCase(),
141
- accountId: normalizeId(deployment.accountId, "Account id")
142
- };
143
- await setData(
144
- redisKeys.runtimeDeployment(userName, normalized.id),
145
- normalized,
146
- { expire: 0 }
147
- );
148
- return normalized;
149
- };
150
- var deleteRuntimeDeployment = async (userName, deploymentId) => {
151
- const normalizedId = normalizeId(deploymentId, "Deployment id");
152
- await Promise.all([
153
- delKey(redisKeys.runtimeDeployment(userName, normalizedId)),
154
- delKey(redisKeys.runtimeDeploymentHeartbeat(userName, normalizedId))
155
- ]);
156
- };
157
- var getRuntimeDeploymentHeartbeat = async (userName, deploymentId) => {
158
- const value = await getData(
159
- redisKeys.runtimeDeploymentHeartbeat(
160
- userName,
161
- normalizeId(deploymentId, "Deployment id")
162
- ),
163
- null
164
- );
165
- return value && typeof value === "object" ? value : null;
166
- };
167
- var saveRuntimeDeploymentHeartbeat = async (userName, heartbeat) => {
168
- await setData(
169
- redisKeys.runtimeDeploymentHeartbeat(
170
- userName,
171
- normalizeId(heartbeat.deploymentId, "Deployment id")
172
- ),
173
- heartbeat,
174
- { expire: 0 }
175
- );
176
- return heartbeat;
177
- };
178
119
  export {
179
- deleteRuntimeDeployment,
180
120
  deleteTradingAccount,
181
- getRuntimeDeployment,
182
- getRuntimeDeploymentHeartbeat,
183
121
  getTradingAccount,
184
- listRuntimeDeployments,
185
122
  listTradingAccounts,
186
123
  resolveTradingAccount,
187
- saveRuntimeDeployment,
188
- saveRuntimeDeploymentHeartbeat,
189
124
  saveTradingAccount
190
125
  };
@@ -0,0 +1,6 @@
1
+ type MarketFeatureAsOf<T> = T & {
2
+ ageMs: number | null;
3
+ stale: boolean;
4
+ };
5
+
6
+ export type { MarketFeatureAsOf as M };
@@ -0,0 +1,6 @@
1
+ type MarketFeatureAsOf<T> = T & {
2
+ ageMs: number | null;
3
+ stale: boolean;
4
+ };
5
+
6
+ export type { MarketFeatureAsOf as M };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tradejs/infra",
3
- "version": "2.0.18",
3
+ "version": "2.0.19",
4
4
  "description": "MIT-licensed server infrastructure adapters for TradeJS: Redis, Timescale, ML, logging, and IO.",
5
5
  "keywords": [
6
6
  "tradejs",
@@ -74,6 +74,16 @@
74
74
  "import": "./dist/redis.mjs",
75
75
  "require": "./dist/redis.js"
76
76
  },
77
+ "./runtimeStrategyConfigs": {
78
+ "types": "./dist/runtimeStrategyConfigs.d.ts",
79
+ "import": "./dist/runtimeStrategyConfigs.mjs",
80
+ "require": "./dist/runtimeStrategyConfigs.js"
81
+ },
82
+ "./runtimeDeployments": {
83
+ "types": "./dist/runtimeDeployments.d.ts",
84
+ "import": "./dist/runtimeDeployments.mjs",
85
+ "require": "./dist/runtimeDeployments.js"
86
+ },
77
87
  "./userSettings": {
78
88
  "types": "./dist/userSettings.d.ts",
79
89
  "import": "./dist/userSettings.mjs",
@@ -84,6 +94,36 @@
84
94
  "import": "./dist/timescale.mjs",
85
95
  "require": "./dist/timescale.js"
86
96
  },
97
+ "./timescale/client": {
98
+ "types": "./dist/timescale/client.d.ts",
99
+ "import": "./dist/timescale/client.mjs",
100
+ "require": "./dist/timescale/client.js"
101
+ },
102
+ "./timescale/candles": {
103
+ "types": "./dist/timescale/candles.d.ts",
104
+ "import": "./dist/timescale/candles.mjs",
105
+ "require": "./dist/timescale/candles.js"
106
+ },
107
+ "./timescale/derivatives": {
108
+ "types": "./dist/timescale/derivatives.d.ts",
109
+ "import": "./dist/timescale/derivatives.mjs",
110
+ "require": "./dist/timescale/derivatives.js"
111
+ },
112
+ "./timescale/hyperliquidWhales": {
113
+ "types": "./dist/timescale/hyperliquidWhales.d.ts",
114
+ "import": "./dist/timescale/hyperliquidWhales.mjs",
115
+ "require": "./dist/timescale/hyperliquidWhales.js"
116
+ },
117
+ "./timescale/marketContext": {
118
+ "types": "./dist/timescale/marketContext.d.ts",
119
+ "import": "./dist/timescale/marketContext.mjs",
120
+ "require": "./dist/timescale/marketContext.js"
121
+ },
122
+ "./timescale/spread": {
123
+ "types": "./dist/timescale/spread.d.ts",
124
+ "import": "./dist/timescale/spread.mjs",
125
+ "require": "./dist/timescale/spread.js"
126
+ },
87
127
  "./tradingAccounts": {
88
128
  "types": "./dist/tradingAccounts.d.ts",
89
129
  "import": "./dist/tradingAccounts.mjs",
@@ -93,8 +133,9 @@
93
133
  "dependencies": {
94
134
  "@grpc/grpc-js": "^1.14.4",
95
135
  "@grpc/proto-loader": "^0.8.1",
96
- "@tradejs/types": "^2.0.18",
136
+ "@tradejs/types": "^2.0.19",
97
137
  "chalk": "4.1.2",
138
+ "date-fns": "^3.6.0",
98
139
  "ioredis": "5.11.1",
99
140
  "pg": "8.22.0",
100
141
  "winston": "3.19.0"