perp-cli 0.7.3 → 0.7.4

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.
@@ -263,7 +263,7 @@ function printFundingExchangeStatus(snapshot) {
263
263
  console.log(chalk.gray(` Exchange status: ${statuses.join(" ")}\n`));
264
264
  }
265
265
  function printDetailedComparison(comparison) {
266
- const exAbbr = (e) => e === "pacifica" ? "PAC" : e === "hyperliquid" ? "HL" : "LT";
266
+ const exAbbr = (e) => e === "pacifica" ? "PAC" : e === "hyperliquid" ? "HL" : e === "lighter" ? "LT" : e === "aster" ? "AST" : e.toUpperCase();
267
267
  console.log(chalk.cyan.bold(` ${comparison.symbol} Funding Rate Comparison\n`));
268
268
  console.log(` Mark Price: $${formatUsd(comparison.bestMarkPrice)}\n`);
269
269
  for (const r of comparison.rates) {
@@ -446,8 +446,7 @@ export function registerBotCommands(program, getAdapter, getAdapterFor, isJson)
446
446
  if (sym === "ALL" && symbolRequiredStrategies.includes(strategyName)) {
447
447
  console.error(chalk.red(`\n Error: The '${strategyName}' strategy requires a <symbol> argument.`));
448
448
  console.error(chalk.gray(` Usage: perp bot run ${strategyName} <symbol>\n`));
449
- process.exitCode = 1;
450
- return;
449
+ return process.exit(1);
451
450
  }
452
451
  // Load or build config
453
452
  let config;
@@ -505,7 +504,7 @@ export function registerBotCommands(program, getAdapter, getAdapterFor, isJson)
505
504
  for (const s of available)
506
505
  console.error(chalk.gray(` - ${s}`));
507
506
  console.error();
508
- return;
507
+ return process.exit(1);
509
508
  }
510
509
  const adapter = await getAdapter();
511
510
  config.exchange = adapter.name;
package/dist/utils.js CHANGED
@@ -10,9 +10,14 @@ export function formatUsd(value) {
10
10
  const num = Number(value);
11
11
  if (isNaN(num))
12
12
  return String(value);
13
+ // Use more decimals for sub-cent values so they don't show as $0.00
14
+ const absNum = Math.abs(num);
15
+ const maxDecimals = absNum > 0 && absNum < 0.01 ? 6
16
+ : absNum < 1 ? 4
17
+ : 2;
13
18
  return num.toLocaleString("en-US", {
14
19
  minimumFractionDigits: 2,
15
- maximumFractionDigits: 2,
20
+ maximumFractionDigits: maxDecimals,
16
21
  });
17
22
  }
18
23
  export function formatPnl(value) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "perp-cli",
3
- "version": "0.7.3",
3
+ "version": "0.7.4",
4
4
  "description": "Multi-DEX Perpetual Futures CLI - Pacifica, Hyperliquid, Lighter",
5
5
  "bin": {
6
6
  "perp": "dist/index.js",