@tradejs/cli 3.1.29-beta.290 → 3.1.29-beta.292

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.
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/scripts/tickerProfiles.ts
31
+ var tickerProfiles_exports = {};
32
+ __export(tickerProfiles_exports, {
33
+ main: () => main
34
+ });
35
+ module.exports = __toCommonJS(tickerProfiles_exports);
36
+ var import_promises = __toESM(require("fs/promises"));
37
+
38
+ // src/lib/tickerProfiles.ts
39
+ var import_tickerProfiles = require("@tradejs/core/tickerProfiles");
40
+ var import_candles = require("@tradejs/infra/timescale/candles");
41
+ var import_tickerProfiles2 = require("@tradejs/infra/tickerProfiles");
42
+ var prepareTickerProfiles = async ({
43
+ projectRoot,
44
+ provider,
45
+ universeId,
46
+ symbols,
47
+ start,
48
+ end
49
+ }) => {
50
+ if (!Number.isSafeInteger(end) || end <= start)
51
+ throw new Error("Invalid profile time window");
52
+ if (!symbols.length || new Set(symbols).size !== symbols.length || symbols.some((s) => !/^[A-Z0-9]+USDT$/.test(s)))
53
+ throw new Error("Supply a unique explicit USDT universe");
54
+ if (!symbols.includes("BTCUSDT") || !symbols.includes("ETHUSDT"))
55
+ throw new Error("The universe must include BTCUSDT and ETHUSDT references");
56
+ const receipts = [];
57
+ for (let asOf = (0, import_tickerProfiles.tickerProfileMonth)(start); asOf < end; asOf = (0, import_tickerProfiles.tickerProfileNextMonth)(asOf)) {
58
+ const candlesBySymbol = {};
59
+ for (const symbol of [...symbols].sort())
60
+ candlesBySymbol[symbol] = await (0, import_candles.getKlineCandlesRange)(
61
+ provider,
62
+ symbol,
63
+ 60,
64
+ asOf - 721 * 36e5,
65
+ asOf - 36e5
66
+ );
67
+ const snapshot = (0, import_tickerProfiles.buildTickerProfileSnapshot)({
68
+ asOf,
69
+ provider,
70
+ universeId,
71
+ membership: "frozen-list",
72
+ candlesBySymbol
73
+ });
74
+ const snapshotId = await (0, import_tickerProfiles2.writeTickerProfiles)(projectRoot, snapshot);
75
+ receipts.push({
76
+ asOf,
77
+ snapshotId,
78
+ symbols: snapshot.profiles.length,
79
+ unknown: snapshot.profiles.filter(
80
+ (p) => p.moneyGroup === "unknown" || p.volatilityGroup === "unknown"
81
+ ).length
82
+ });
83
+ }
84
+ return receipts;
85
+ };
86
+
87
+ // src/scripts/tickerProfiles.ts
88
+ var main = async () => {
89
+ const argv = process.argv.slice(2);
90
+ const option = (name) => {
91
+ const i = argv.indexOf(`--${name}`);
92
+ if (i < 0 || !argv[i + 1] || argv[i + 1].startsWith("--"))
93
+ throw new Error(`--${name} is required`);
94
+ return argv[i + 1];
95
+ };
96
+ const symbols = JSON.parse(
97
+ await import_promises.default.readFile(option("symbolsFile"), "utf8")
98
+ );
99
+ if (!Array.isArray(symbols) || !symbols.every((s) => typeof s === "string"))
100
+ throw new Error("symbolsFile must be a JSON string array");
101
+ const receipts = await prepareTickerProfiles({
102
+ projectRoot: process.env.PROJECT_CWD || process.cwd(),
103
+ provider: option("provider"),
104
+ universeId: option("universeId"),
105
+ symbols,
106
+ start: Number(option("startTime")),
107
+ end: Number(option("endTime"))
108
+ });
109
+ console.log(JSON.stringify({ command: "ticker-profiles", receipts }));
110
+ };
111
+ // Annotate the CommonJS export names for ESM import in node:
112
+ 0 && (module.exports = {
113
+ main
114
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tradejs/cli",
3
- "version": "3.1.29-beta.290",
3
+ "version": "3.1.29-beta.292",
4
4
  "description": "Official CLI for the TradeJS TypeScript framework: infra setup, backtests, signals, bots, and ML workflows.",
5
5
  "keywords": [
6
6
  "tradejs",
@@ -37,13 +37,13 @@
37
37
  "tradejs": "dist/cli.js"
38
38
  },
39
39
  "dependencies": {
40
- "@tradejs/connectors": "^3.1.29-beta.290",
41
- "@tradejs/core": "^3.1.29-beta.290",
42
- "@tradejs/indicators": "^3.1.29-beta.290",
43
- "@tradejs/infra": "^3.1.29-beta.290",
44
- "@tradejs/node": "^3.1.29-beta.290",
40
+ "@tradejs/connectors": "^3.1.29-beta.292",
41
+ "@tradejs/core": "^3.1.29-beta.292",
42
+ "@tradejs/indicators": "^3.1.29-beta.292",
43
+ "@tradejs/infra": "^3.1.29-beta.292",
44
+ "@tradejs/node": "^3.1.29-beta.292",
45
45
  "@tradejs/strategy-kit": "3.0.6",
46
- "@tradejs/types": "^3.1.29-beta.290",
46
+ "@tradejs/types": "^3.1.29-beta.292",
47
47
  "args": "^5.0.3",
48
48
  "bcryptjs": "^2.4.3",
49
49
  "chalk": "4.1.2",
@@ -54,6 +54,7 @@
54
54
  "lodash": "^4.18.1",
55
55
  "pg": "8.22.0",
56
56
  "progress": "^2.0.3",
57
+ "sharp": "^0.35.3",
57
58
  "ws": "^8.21.1"
58
59
  },
59
60
  "devDependencies": {