@trading-boy/cli 1.3.0 → 1.4.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.
@@ -39795,6 +39795,7 @@ var envSchema = external_exports.object({
39795
39795
  FINNHUB_API_KEY: external_exports.string().default(""),
39796
39796
  // Macro data sources
39797
39797
  FRED_API_KEY: external_exports.string().default(""),
39798
+ EIA_API_KEY: external_exports.string().default(""),
39798
39799
  NEWSDATA_API_KEY: external_exports.string().default(""),
39799
39800
  KALSHI_API_KEY: external_exports.string().default(""),
39800
39801
  OILPRICE_API_KEY: external_exports.string().default(""),
@@ -57256,6 +57257,35 @@ function registerAgentCommand(program2) {
57256
57257
  handleApiError4(error49, "Agent delete failed");
57257
57258
  }
57258
57259
  });
57260
+ agent.command("exit <agentId>").description("Exit/close an open position for an agent").requiredOption("--symbol <symbol>", "Token symbol to exit (e.g. xyz:NATGAS)").option("--reason <text>", "Reason for exit").addOption(new Option("--format <format>", "Output format").choices(["text", "json"]).default("text")).action(async (agentId, options) => {
57261
+ if (!await ensureRemote2())
57262
+ return;
57263
+ try {
57264
+ const body = {};
57265
+ if (options.reason)
57266
+ body.reason = options.reason;
57267
+ const result = await apiRequest(`/api/v1/agents/${encodeURIComponent(agentId)}/positions/${encodeURIComponent(options.symbol)}/exit`, { method: "POST", body });
57268
+ if (options.format === "json") {
57269
+ console.log(JSON.stringify(result, null, 2));
57270
+ } else {
57271
+ const pnlColor = result.pnl >= 0 ? source_default.green : source_default.red;
57272
+ const pnlSign = result.pnl >= 0 ? "+" : "";
57273
+ console.log("");
57274
+ console.log(source_default.green(" Position closed"));
57275
+ console.log(` ${source_default.gray("Symbol:")} ${result.symbol}`);
57276
+ console.log(` ${source_default.gray("Side:")} ${result.side}`);
57277
+ console.log(` ${source_default.gray("Exit price:")} $${result.exitPrice.toLocaleString()}`);
57278
+ console.log(` ${source_default.gray("PnL:")} ${pnlColor(`${pnlSign}$${result.pnl.toFixed(2)} (${pnlSign}${result.pnlPct.toFixed(2)}%)`)}`);
57279
+ console.log(` ${source_default.gray("Closed at:")} ${formatShortDate5(result.closedAt)}`);
57280
+ if (options.reason) {
57281
+ console.log(` ${source_default.gray("Reason:")} ${options.reason}`);
57282
+ }
57283
+ console.log("");
57284
+ }
57285
+ } catch (error49) {
57286
+ handleApiError4(error49, "Position exit failed");
57287
+ }
57288
+ });
57259
57289
  agent.command("update <agentId>").description("Update agent config").option("--name <name>", "Agent name").option("--autonomy <level>", "Autonomy level").option("--scan-interval <ms>", "Scan interval in ms").option("--scan-interval-human <duration>", "Scan interval in human-readable format (e.g. 1m, 5m, 15m, 30m, 1h)").option("--watchlist <symbols>", "Comma-separated token symbols").option("--max-daily-trades <n>", "Max daily trades").option("--max-daily-loss <usd>", "Max daily loss in USD").option("--max-position-size <pct>", "Max position size as decimal").option("--min-confidence <n>", "Min confidence threshold").option("--scan-model <model>", "LLM model for market scanning").option("--analyze-model <model>", "LLM model for deep analysis").option("--decide-model <model>", "LLM model for trade decisions").addOption(new Option("--asset-class <class>", "Asset class for this agent").choices(["crypto", "commodities", "mixed"])).option("--soul-override <text>", "Custom soul/personality for this agent").option("--purpose-override <text>", "Custom purpose/mission for this agent").option("--soul-file <path>", "Load soul from a file").option("--purpose-file <path>", "Load purpose from a file").action(async (agentId, options) => {
57260
57290
  if (!await ensureRemote2())
57261
57291
  return;
@@ -411,6 +411,44 @@ export function registerAgentCommand(program) {
411
411
  handleApiError(error, 'Agent delete failed');
412
412
  }
413
413
  });
414
+ // ── exit ───────────────────────────────────────────────────────────────────
415
+ agent
416
+ .command('exit <agentId>')
417
+ .description('Exit/close an open position for an agent')
418
+ .requiredOption('--symbol <symbol>', 'Token symbol to exit (e.g. xyz:NATGAS)')
419
+ .option('--reason <text>', 'Reason for exit')
420
+ .addOption(new Option('--format <format>', 'Output format').choices(['text', 'json']).default('text'))
421
+ .action(async (agentId, options) => {
422
+ if (!(await ensureRemote()))
423
+ return;
424
+ try {
425
+ const body = {};
426
+ if (options.reason)
427
+ body.reason = options.reason;
428
+ const result = await apiRequest(`/api/v1/agents/${encodeURIComponent(agentId)}/positions/${encodeURIComponent(options.symbol)}/exit`, { method: 'POST', body });
429
+ if (options.format === 'json') {
430
+ console.log(JSON.stringify(result, null, 2));
431
+ }
432
+ else {
433
+ const pnlColor = result.pnl >= 0 ? chalk.green : chalk.red;
434
+ const pnlSign = result.pnl >= 0 ? '+' : '';
435
+ console.log('');
436
+ console.log(chalk.green(' Position closed'));
437
+ console.log(` ${chalk.gray('Symbol:')} ${result.symbol}`);
438
+ console.log(` ${chalk.gray('Side:')} ${result.side}`);
439
+ console.log(` ${chalk.gray('Exit price:')} $${result.exitPrice.toLocaleString()}`);
440
+ console.log(` ${chalk.gray('PnL:')} ${pnlColor(`${pnlSign}$${result.pnl.toFixed(2)} (${pnlSign}${result.pnlPct.toFixed(2)}%)`)}`);
441
+ console.log(` ${chalk.gray('Closed at:')} ${formatShortDate(result.closedAt)}`);
442
+ if (options.reason) {
443
+ console.log(` ${chalk.gray('Reason:')} ${options.reason}`);
444
+ }
445
+ console.log('');
446
+ }
447
+ }
448
+ catch (error) {
449
+ handleApiError(error, 'Position exit failed');
450
+ }
451
+ });
414
452
  // ── update ──────────────────────────────────────────────────────────────────
415
453
  agent
416
454
  .command('update <agentId>')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trading-boy/cli",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "Trading Boy CLI — crypto context intelligence for traders and AI agents. Query real-time prices, funding rates, whale activity, and DeFi risk for 100+ Solana tokens and 229 Hyperliquid perpetuals.",
5
5
  "homepage": "https://cabal.ventures",
6
6
  "repository": {