@bloomai/cli 0.1.8 → 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.
- package/dist/index.js +75 -34
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2034,7 +2034,7 @@ function formatDcf(data, symbol) {
|
|
|
2034
2034
|
// src/commands/holders.ts
|
|
2035
2035
|
function registerHoldersCommand(program2) {
|
|
2036
2036
|
addGlobalOptions(
|
|
2037
|
-
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")
|
|
2038
2038
|
).addHelpText("after", `
|
|
2039
2039
|
Examples:
|
|
2040
2040
|
$ bloom holders AAPL Top institutional holders of Apple
|
|
@@ -2046,15 +2046,49 @@ Examples:
|
|
|
2046
2046
|
});
|
|
2047
2047
|
}
|
|
2048
2048
|
function formatHolders(data) {
|
|
2049
|
-
|
|
2050
|
-
const
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
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)}%`;
|
|
2058
2092
|
}
|
|
2059
2093
|
function fmtNum2(v) {
|
|
2060
2094
|
if (v == null) return "-";
|
|
@@ -2069,11 +2103,10 @@ function fmtNum2(v) {
|
|
|
2069
2103
|
// src/commands/short-interest.ts
|
|
2070
2104
|
function registerShortInterestCommand(program2) {
|
|
2071
2105
|
addGlobalOptions(
|
|
2072
|
-
program2.command("short-interest").description("
|
|
2106
|
+
program2.command("short-interest").description("Latest short interest as % of float").argument("<symbol>", "Ticker symbol").option("--limit <n>", "Number of records", "10")
|
|
2073
2107
|
).addHelpText("after", `
|
|
2074
2108
|
Examples:
|
|
2075
|
-
$ bloom short-interest GME
|
|
2076
|
-
$ bloom short-interest AMC --limit 20 Last 20 short interest records
|
|
2109
|
+
$ bloom short-interest GME Latest short interest for GameStop
|
|
2077
2110
|
`).action(async (symbol, opts) => {
|
|
2078
2111
|
const sym = symbol.toUpperCase();
|
|
2079
2112
|
const limit = parseIntArg(opts.limit, "--limit");
|
|
@@ -2084,14 +2117,12 @@ Examples:
|
|
|
2084
2117
|
function formatShort(data) {
|
|
2085
2118
|
if (!Array.isArray(data) || data.length === 0) return "(no short interest data)";
|
|
2086
2119
|
const rows = data.map((r) => [
|
|
2087
|
-
String(r.
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
String(r.
|
|
2091
|
-
fmtNum3(r.shortPriorMonthInterest ?? r.shortPriorMonth),
|
|
2092
|
-
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 ?? "-")
|
|
2093
2124
|
]);
|
|
2094
|
-
return makeTable(["
|
|
2125
|
+
return makeTable(["Symbol", "Short % Float", "Float", "Source"], rows);
|
|
2095
2126
|
}
|
|
2096
2127
|
function fmtNum3(v) {
|
|
2097
2128
|
if (v == null) return "-";
|
|
@@ -2302,12 +2333,22 @@ Examples:
|
|
|
2302
2333
|
const result = await BloomClient.instance().getRatings(sym, limit);
|
|
2303
2334
|
outputResult(result, opts, () => {
|
|
2304
2335
|
const obj = result;
|
|
2305
|
-
return formatRatings(obj.grades, obj.estimates);
|
|
2336
|
+
return formatRatings(obj.consensus, obj.grades, obj.estimates);
|
|
2306
2337
|
});
|
|
2307
2338
|
});
|
|
2308
2339
|
}
|
|
2309
|
-
function formatRatings(grades, estimates) {
|
|
2340
|
+
function formatRatings(consensus, grades, estimates) {
|
|
2310
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
|
+
}
|
|
2311
2352
|
if (Array.isArray(grades) && grades.length > 0) {
|
|
2312
2353
|
const rows = grades.map((g) => [
|
|
2313
2354
|
String(g.date ?? "-").slice(0, 10),
|
|
@@ -2379,7 +2420,7 @@ function fmtMoney(n) {
|
|
|
2379
2420
|
if (n >= 1e3) return `$${(n / 1e3).toFixed(1)}K`;
|
|
2380
2421
|
return `$${n.toFixed(0)}`;
|
|
2381
2422
|
}
|
|
2382
|
-
function
|
|
2423
|
+
function fmtPct2(n, signed = false) {
|
|
2383
2424
|
const v = (n * 100).toFixed(1);
|
|
2384
2425
|
return signed && n >= 0 ? `+${v}%` : `${v}%`;
|
|
2385
2426
|
}
|
|
@@ -2392,10 +2433,10 @@ function renderText(data) {
|
|
|
2392
2433
|
const s = data.summary;
|
|
2393
2434
|
const headerParts = [fmtMoney(s.total_value)];
|
|
2394
2435
|
if (s.ytd_return !== null && s.ytd_return !== void 0) {
|
|
2395
|
-
headerParts.push(`${
|
|
2436
|
+
headerParts.push(`${fmtPct2(s.ytd_return, true)} YTD`);
|
|
2396
2437
|
}
|
|
2397
2438
|
if (s.vs_spy !== null && s.vs_spy !== void 0) {
|
|
2398
|
-
headerParts.push(`${
|
|
2439
|
+
headerParts.push(`${fmtPct2(s.vs_spy, true)} SPY`);
|
|
2399
2440
|
}
|
|
2400
2441
|
lines.push("");
|
|
2401
2442
|
lines.push(" " + headerParts.join(" \u2022 "));
|
|
@@ -2408,7 +2449,7 @@ function renderText(data) {
|
|
|
2408
2449
|
lines.push("");
|
|
2409
2450
|
for (const sec of data.concentration.by_sector) {
|
|
2410
2451
|
const name = sec.name.padEnd(14);
|
|
2411
|
-
lines.push(` ${name} ${bar(sec.pct)} ${
|
|
2452
|
+
lines.push(` ${name} ${bar(sec.pct)} ${fmtPct2(sec.pct)}`);
|
|
2412
2453
|
}
|
|
2413
2454
|
lines.push("");
|
|
2414
2455
|
lines.push(" " + data.concentration.insight);
|
|
@@ -2433,7 +2474,7 @@ function renderText(data) {
|
|
|
2433
2474
|
const r = data.risk;
|
|
2434
2475
|
if (r.volatility && r.volatility.value != null) {
|
|
2435
2476
|
lines.push(
|
|
2436
|
-
` Volatility ${r.volatility.label.padEnd(8)} ${
|
|
2477
|
+
` Volatility ${r.volatility.label.padEnd(8)} ${fmtPct2(r.volatility.value)}`
|
|
2437
2478
|
);
|
|
2438
2479
|
}
|
|
2439
2480
|
if (r.correlation_spy != null) {
|
|
@@ -2443,7 +2484,7 @@ function renderText(data) {
|
|
|
2443
2484
|
);
|
|
2444
2485
|
}
|
|
2445
2486
|
if (r.max_drawdown != null) {
|
|
2446
|
-
lines.push(` Max drawdown ${
|
|
2487
|
+
lines.push(` Max drawdown ${fmtPct2(r.max_drawdown)}`);
|
|
2447
2488
|
}
|
|
2448
2489
|
if (r.sharpe != null) {
|
|
2449
2490
|
lines.push(` Sharpe ${r.sharpe.toFixed(2)}`);
|
|
@@ -2484,8 +2525,8 @@ function renderMarkdown(data) {
|
|
|
2484
2525
|
lines.push("# Portfolio Analytics");
|
|
2485
2526
|
lines.push("");
|
|
2486
2527
|
const hp = [`**${fmtMoney(s.total_value)}**`];
|
|
2487
|
-
if (s.ytd_return != null) hp.push(`${
|
|
2488
|
-
if (s.vs_spy != null) hp.push(`${
|
|
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`);
|
|
2489
2530
|
lines.push(hp.join(" \u2022 "));
|
|
2490
2531
|
lines.push("");
|
|
2491
2532
|
lines.push(`> ${s.headline_insight}`);
|
|
@@ -2495,7 +2536,7 @@ function renderMarkdown(data) {
|
|
|
2495
2536
|
lines.push("| Sector | Allocation | Value |");
|
|
2496
2537
|
lines.push("|---|---|---|");
|
|
2497
2538
|
for (const sec of data.concentration.by_sector) {
|
|
2498
|
-
lines.push(`| ${sec.name} | ${
|
|
2539
|
+
lines.push(`| ${sec.name} | ${fmtPct2(sec.pct)} | ${fmtMoney(sec.value)} |`);
|
|
2499
2540
|
}
|
|
2500
2541
|
lines.push("");
|
|
2501
2542
|
lines.push(data.concentration.insight);
|
|
@@ -2516,9 +2557,9 @@ function renderMarkdown(data) {
|
|
|
2516
2557
|
lines.push("## Risk");
|
|
2517
2558
|
lines.push("");
|
|
2518
2559
|
const r = data.risk;
|
|
2519
|
-
if (r.volatility && r.volatility.value != null) lines.push(`- Volatility: ${r.volatility.label} (${
|
|
2560
|
+
if (r.volatility && r.volatility.value != null) lines.push(`- Volatility: ${r.volatility.label} (${fmtPct2(r.volatility.value)})`);
|
|
2520
2561
|
if (r.correlation_spy != null) lines.push(`- Correlation to SPY: ${r.correlation_spy.toFixed(2)}`);
|
|
2521
|
-
if (r.max_drawdown != null) lines.push(`- Max drawdown: ${
|
|
2562
|
+
if (r.max_drawdown != null) lines.push(`- Max drawdown: ${fmtPct2(r.max_drawdown)}`);
|
|
2522
2563
|
if (r.sharpe != null) lines.push(`- Sharpe: ${r.sharpe.toFixed(2)}`);
|
|
2523
2564
|
lines.push("");
|
|
2524
2565
|
lines.push(r.insight);
|
|
@@ -2774,7 +2815,7 @@ Examples:
|
|
|
2774
2815
|
var program = new Command3();
|
|
2775
2816
|
var __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
2776
2817
|
var pkgPath = path.join(__dirname, "..", "package.json");
|
|
2777
|
-
var compiledVersion = "0.1.
|
|
2818
|
+
var compiledVersion = "0.1.9".length > 0 ? "0.1.9" : void 0;
|
|
2778
2819
|
var envVersion = process.env.BLOOM_CLI_VERSION ?? process.env.npm_package_version;
|
|
2779
2820
|
var fallbackVersion = compiledVersion ?? "unknown";
|
|
2780
2821
|
var cliVersion = envVersion ?? fallbackVersion;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bloomai/cli",
|
|
3
|
-
"version": "0.1.
|
|
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": "^
|
|
38
|
+
"tsup": "^9.0.0",
|
|
39
39
|
"typescript": "^5.7.0"
|
|
40
40
|
}
|
|
41
41
|
}
|