@bloomai/cli 0.1.7 → 0.1.9

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 (3) hide show
  1. package/SKILL.md +1 -0
  2. package/dist/index.js +93 -34
  3. package/package.json +2 -2
package/SKILL.md CHANGED
@@ -36,6 +36,7 @@ jq '.data[] | select(.revenue_growth > 0.1)' /tmp/bloom/aapl-revenue.json
36
36
  | `news` | Recent news headlines | `bloom news AAPL --limit 5` |
37
37
  | `price` | Historical price data | `bloom price AAPL --timeframes 1d,1m,1y` |
38
38
  | `financials` | Revenue, margins, cash flow | `bloom financials AAPL --type revenue` |
39
+ | `briefing` | Today's written Morning Market Briefing | `bloom briefing` |
39
40
  | `sentiment` | Market mood (AAII, Fear&Greed, VIX) | `bloom sentiment` |
40
41
  | `market` | Market map, sectors, movers | `bloom market --type top_movers` |
41
42
  | `collections` | Curated stock lists by theme | `bloom collections --section VALUE` |
package/dist/index.js CHANGED
@@ -712,6 +712,10 @@ var BloomClient = class _BloomClient {
712
712
  async getEarningsCalendar(params) {
713
713
  return callRestCached("/markets/earnings-calendar/", params, "earnings");
714
714
  }
715
+ // --- Market briefing ---
716
+ async getMarketBriefing() {
717
+ return callTool("get_market_briefing", {});
718
+ }
715
719
  // --- Sentiment ---
716
720
  async getSentiment(sections) {
717
721
  const args = {};
@@ -1094,6 +1098,19 @@ Examples:
1094
1098
  });
1095
1099
  }
1096
1100
 
1101
+ // src/commands/briefing.ts
1102
+ function registerBriefingCommand(program2) {
1103
+ addGlobalOptions(
1104
+ program2.command("briefing").description("Today's Morning Market Briefing, written once each trading day")
1105
+ ).action(async (opts) => {
1106
+ const data = await BloomClient.instance().getMarketBriefing();
1107
+ outputResult(data, opts, (d) => {
1108
+ const obj = d;
1109
+ return obj.briefing ?? "No briefing yet today (written each trading day around 10am ET).";
1110
+ });
1111
+ });
1112
+ }
1113
+
1097
1114
  // src/commands/sentiment.ts
1098
1115
  var SECTIONS = [
1099
1116
  "aaii_sentiment",
@@ -2017,7 +2034,7 @@ function formatDcf(data, symbol) {
2017
2034
  // src/commands/holders.ts
2018
2035
  function registerHoldersCommand(program2) {
2019
2036
  addGlobalOptions(
2020
- program2.command("holders").description("Institutional holders of a stock").argument("<symbol>", "Ticker symbol")
2037
+ program2.command("holders").description("Institutional and mutual fund holders of a stock").argument("<symbol>", "Ticker symbol")
2021
2038
  ).addHelpText("after", `
2022
2039
  Examples:
2023
2040
  $ bloom holders AAPL Top institutional holders of Apple
@@ -2029,15 +2046,49 @@ Examples:
2029
2046
  });
2030
2047
  }
2031
2048
  function formatHolders(data) {
2032
- if (!Array.isArray(data) || data.length === 0) return "(no holders data)";
2033
- const rows = data.map((h) => [
2034
- String(h.holder ?? "-"),
2035
- fmtNum2(h.shares),
2036
- h.dateReported ? String(h.dateReported).slice(0, 10) : "-",
2037
- h.change != null ? String(h.change) : "-",
2038
- h.weightPercent != null ? `${Number(h.weightPercent).toFixed(2)}%` : "-"
2039
- ]);
2040
- return makeTable(["Holder", "Shares", "Date", "Change", "Weight %"], rows);
2049
+ const obj = data ?? {};
2050
+ const parts = [];
2051
+ const s = obj.institutional_summary;
2052
+ if (s) {
2053
+ parts.push(
2054
+ `INSTITUTIONAL OWNERSHIP (13F, quarter ending ${String(s.date ?? "-")})
2055
+ ` + makeTable(
2056
+ ["Owned %", "Change (pts)", "Holders", "Holder change", "New", "Closed"],
2057
+ [[
2058
+ fmtPct(s.ownershipPercent),
2059
+ fmtPct(s.ownershipPercentChange),
2060
+ fmtNum2(s.investorsHolding),
2061
+ String(s.investorsHoldingChange ?? "-"),
2062
+ String(s.newPositions ?? "-"),
2063
+ String(s.closedPositions ?? "-")
2064
+ ]]
2065
+ )
2066
+ );
2067
+ }
2068
+ if (Array.isArray(obj.institutional) && obj.institutional.length > 0) {
2069
+ const rows = obj.institutional.map((h) => [
2070
+ String(h.investorName ?? "-"),
2071
+ fmtNum2(h.sharesNumber),
2072
+ fmtPct(h.changeInSharesNumberPercentage),
2073
+ fmtPct(h.ownership)
2074
+ ]);
2075
+ parts.push("TOP INSTITUTIONS\n" + makeTable(["Holder", "Shares", "Change %", "Owned %"], rows));
2076
+ }
2077
+ if (Array.isArray(obj.mutual_fund) && obj.mutual_fund.length > 0) {
2078
+ const rows = obj.mutual_fund.map((h) => [
2079
+ String(h.holder ?? "-"),
2080
+ fmtNum2(h.shares),
2081
+ h.dateReported ? String(h.dateReported).slice(0, 10) : "-",
2082
+ fmtNum2(h.change)
2083
+ ]);
2084
+ parts.push("TOP MUTUAL FUNDS\n" + makeTable(["Fund", "Shares", "Date", "Change"], rows));
2085
+ }
2086
+ return parts.length > 0 ? parts.join("\n\n") : "(no holders data)";
2087
+ }
2088
+ function fmtPct(v) {
2089
+ if (v == null) return "-";
2090
+ const n = Number(v);
2091
+ return isNaN(n) ? String(v) : `${n.toFixed(2)}%`;
2041
2092
  }
2042
2093
  function fmtNum2(v) {
2043
2094
  if (v == null) return "-";
@@ -2052,11 +2103,10 @@ function fmtNum2(v) {
2052
2103
  // src/commands/short-interest.ts
2053
2104
  function registerShortInterestCommand(program2) {
2054
2105
  addGlobalOptions(
2055
- program2.command("short-interest").description("Short interest history").argument("<symbol>", "Ticker symbol").option("--limit <n>", "Number of records", "10")
2106
+ program2.command("short-interest").description("Latest short interest as % of float").argument("<symbol>", "Ticker symbol").option("--limit <n>", "Number of records", "10")
2056
2107
  ).addHelpText("after", `
2057
2108
  Examples:
2058
- $ bloom short-interest GME Short interest history for GameStop
2059
- $ bloom short-interest AMC --limit 20 Last 20 short interest records
2109
+ $ bloom short-interest GME Latest short interest for GameStop
2060
2110
  `).action(async (symbol, opts) => {
2061
2111
  const sym = symbol.toUpperCase();
2062
2112
  const limit = parseIntArg(opts.limit, "--limit");
@@ -2067,14 +2117,12 @@ Examples:
2067
2117
  function formatShort(data) {
2068
2118
  if (!Array.isArray(data) || data.length === 0) return "(no short interest data)";
2069
2119
  const rows = data.map((r) => [
2070
- String(r.date ?? "-"),
2071
- fmtNum3(r.shortInterest),
2072
- String(r.daysToCover ?? r.daysTocover ?? "-"),
2073
- String(r.shortInterestRatio ?? "-"),
2074
- fmtNum3(r.shortPriorMonthInterest ?? r.shortPriorMonth),
2075
- r.changePercent != null ? `${Number(r.changePercent).toFixed(2)}%` : "-"
2120
+ String(r.symbol ?? "-"),
2121
+ r.short_percent_float != null ? `${Number(r.short_percent_float).toFixed(2)}%` : "-",
2122
+ fmtNum3(r.shares_float),
2123
+ String(r.source ?? "-")
2076
2124
  ]);
2077
- return makeTable(["Date", "Short Interest", "Days to Cover", "Short Ratio", "Prior Month", "Change %"], rows);
2125
+ return makeTable(["Symbol", "Short % Float", "Float", "Source"], rows);
2078
2126
  }
2079
2127
  function fmtNum3(v) {
2080
2128
  if (v == null) return "-";
@@ -2285,12 +2333,22 @@ Examples:
2285
2333
  const result = await BloomClient.instance().getRatings(sym, limit);
2286
2334
  outputResult(result, opts, () => {
2287
2335
  const obj = result;
2288
- return formatRatings(obj.grades, obj.estimates);
2336
+ return formatRatings(obj.consensus, obj.grades, obj.estimates);
2289
2337
  });
2290
2338
  });
2291
2339
  }
2292
- function formatRatings(grades, estimates) {
2340
+ function formatRatings(consensus, grades, estimates) {
2293
2341
  const parts = [];
2342
+ if (consensus && typeof consensus === "object") {
2343
+ const c = consensus;
2344
+ const keys = ["strongBuy", "buy", "hold", "sell", "strongSell"];
2345
+ parts.push(
2346
+ "ANALYST CONSENSUS\n" + makeTable(
2347
+ ["Strong Buy", "Buy", "Hold", "Sell", "Strong Sell", "Consensus"],
2348
+ [[...keys.map((k) => String(c[k] ?? "-")), String(c.consensus ?? "-")]]
2349
+ )
2350
+ );
2351
+ }
2294
2352
  if (Array.isArray(grades) && grades.length > 0) {
2295
2353
  const rows = grades.map((g) => [
2296
2354
  String(g.date ?? "-").slice(0, 10),
@@ -2362,7 +2420,7 @@ function fmtMoney(n) {
2362
2420
  if (n >= 1e3) return `$${(n / 1e3).toFixed(1)}K`;
2363
2421
  return `$${n.toFixed(0)}`;
2364
2422
  }
2365
- function fmtPct(n, signed = false) {
2423
+ function fmtPct2(n, signed = false) {
2366
2424
  const v = (n * 100).toFixed(1);
2367
2425
  return signed && n >= 0 ? `+${v}%` : `${v}%`;
2368
2426
  }
@@ -2375,10 +2433,10 @@ function renderText(data) {
2375
2433
  const s = data.summary;
2376
2434
  const headerParts = [fmtMoney(s.total_value)];
2377
2435
  if (s.ytd_return !== null && s.ytd_return !== void 0) {
2378
- headerParts.push(`${fmtPct(s.ytd_return, true)} YTD`);
2436
+ headerParts.push(`${fmtPct2(s.ytd_return, true)} YTD`);
2379
2437
  }
2380
2438
  if (s.vs_spy !== null && s.vs_spy !== void 0) {
2381
- headerParts.push(`${fmtPct(s.vs_spy, true)} SPY`);
2439
+ headerParts.push(`${fmtPct2(s.vs_spy, true)} SPY`);
2382
2440
  }
2383
2441
  lines.push("");
2384
2442
  lines.push(" " + headerParts.join(" \u2022 "));
@@ -2391,7 +2449,7 @@ function renderText(data) {
2391
2449
  lines.push("");
2392
2450
  for (const sec of data.concentration.by_sector) {
2393
2451
  const name = sec.name.padEnd(14);
2394
- lines.push(` ${name} ${bar(sec.pct)} ${fmtPct(sec.pct)}`);
2452
+ lines.push(` ${name} ${bar(sec.pct)} ${fmtPct2(sec.pct)}`);
2395
2453
  }
2396
2454
  lines.push("");
2397
2455
  lines.push(" " + data.concentration.insight);
@@ -2416,7 +2474,7 @@ function renderText(data) {
2416
2474
  const r = data.risk;
2417
2475
  if (r.volatility && r.volatility.value != null) {
2418
2476
  lines.push(
2419
- ` Volatility ${r.volatility.label.padEnd(8)} ${fmtPct(r.volatility.value)}`
2477
+ ` Volatility ${r.volatility.label.padEnd(8)} ${fmtPct2(r.volatility.value)}`
2420
2478
  );
2421
2479
  }
2422
2480
  if (r.correlation_spy != null) {
@@ -2426,7 +2484,7 @@ function renderText(data) {
2426
2484
  );
2427
2485
  }
2428
2486
  if (r.max_drawdown != null) {
2429
- lines.push(` Max drawdown ${fmtPct(r.max_drawdown)}`);
2487
+ lines.push(` Max drawdown ${fmtPct2(r.max_drawdown)}`);
2430
2488
  }
2431
2489
  if (r.sharpe != null) {
2432
2490
  lines.push(` Sharpe ${r.sharpe.toFixed(2)}`);
@@ -2467,8 +2525,8 @@ function renderMarkdown(data) {
2467
2525
  lines.push("# Portfolio Analytics");
2468
2526
  lines.push("");
2469
2527
  const hp = [`**${fmtMoney(s.total_value)}**`];
2470
- if (s.ytd_return != null) hp.push(`${fmtPct(s.ytd_return, true)} YTD`);
2471
- if (s.vs_spy != null) hp.push(`${fmtPct(s.vs_spy, true)} SPY`);
2528
+ if (s.ytd_return != null) hp.push(`${fmtPct2(s.ytd_return, true)} YTD`);
2529
+ if (s.vs_spy != null) hp.push(`${fmtPct2(s.vs_spy, true)} SPY`);
2472
2530
  lines.push(hp.join(" \u2022 "));
2473
2531
  lines.push("");
2474
2532
  lines.push(`> ${s.headline_insight}`);
@@ -2478,7 +2536,7 @@ function renderMarkdown(data) {
2478
2536
  lines.push("| Sector | Allocation | Value |");
2479
2537
  lines.push("|---|---|---|");
2480
2538
  for (const sec of data.concentration.by_sector) {
2481
- lines.push(`| ${sec.name} | ${fmtPct(sec.pct)} | ${fmtMoney(sec.value)} |`);
2539
+ lines.push(`| ${sec.name} | ${fmtPct2(sec.pct)} | ${fmtMoney(sec.value)} |`);
2482
2540
  }
2483
2541
  lines.push("");
2484
2542
  lines.push(data.concentration.insight);
@@ -2499,9 +2557,9 @@ function renderMarkdown(data) {
2499
2557
  lines.push("## Risk");
2500
2558
  lines.push("");
2501
2559
  const r = data.risk;
2502
- if (r.volatility && r.volatility.value != null) lines.push(`- Volatility: ${r.volatility.label} (${fmtPct(r.volatility.value)})`);
2560
+ if (r.volatility && r.volatility.value != null) lines.push(`- Volatility: ${r.volatility.label} (${fmtPct2(r.volatility.value)})`);
2503
2561
  if (r.correlation_spy != null) lines.push(`- Correlation to SPY: ${r.correlation_spy.toFixed(2)}`);
2504
- if (r.max_drawdown != null) lines.push(`- Max drawdown: ${fmtPct(r.max_drawdown)}`);
2562
+ if (r.max_drawdown != null) lines.push(`- Max drawdown: ${fmtPct2(r.max_drawdown)}`);
2505
2563
  if (r.sharpe != null) lines.push(`- Sharpe: ${r.sharpe.toFixed(2)}`);
2506
2564
  lines.push("");
2507
2565
  lines.push(r.insight);
@@ -2757,7 +2815,7 @@ Examples:
2757
2815
  var program = new Command3();
2758
2816
  var __dirname = path.dirname(fileURLToPath(import.meta.url));
2759
2817
  var pkgPath = path.join(__dirname, "..", "package.json");
2760
- var compiledVersion = "0.1.7".length > 0 ? "0.1.7" : void 0;
2818
+ var compiledVersion = "0.1.9".length > 0 ? "0.1.9" : void 0;
2761
2819
  var envVersion = process.env.BLOOM_CLI_VERSION ?? process.env.npm_package_version;
2762
2820
  var fallbackVersion = compiledVersion ?? "unknown";
2763
2821
  var cliVersion = envVersion ?? fallbackVersion;
@@ -2815,6 +2873,7 @@ registerCorrelationCommand(program);
2815
2873
  registerRiskCommand(program);
2816
2874
  registerDrawdownCommand(program);
2817
2875
  registerMacroCommand(program);
2876
+ registerBriefingCommand(program);
2818
2877
  registerSectorsCommand(program);
2819
2878
  registerDcfCommand(program);
2820
2879
  registerHoldersCommand(program);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bloomai/cli",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "CLI tool for Bloom financial data - download market data to files for analysis",
5
5
  "repository": {
6
6
  "type": "git",
@@ -35,7 +35,7 @@
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/node": "^22.13.0",
38
- "tsup": "^8.5.1",
38
+ "tsup": "^9.0.0",
39
39
  "typescript": "^5.7.0"
40
40
  }
41
41
  }