sentisense 0.72.0 → 0.73.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.
- package/README.md +1 -0
- package/dist/cli.cjs +320 -23
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -75,6 +75,7 @@ npx -y sentisense@latest health
|
|
|
75
75
|
| `analysts <ticker>` | Consensus, price target band, recent upgrades and downgrades. `--coverage` for who covers it, by firm |
|
|
76
76
|
| `analyst <slug>` | One analyst: their firms, their coverage book, and `--calls` for their price target notes |
|
|
77
77
|
| `earnings [ticker]` | Forward calendar with no ticker, per-quarter analysis with one (`earnings AAPL`) |
|
|
78
|
+
| `kpis <ticker>` | Company KPIs from earnings filings: latest value and year-over-year change per series, `--series ID` for one series' history, `--types` for the series list, `--coverage` for the covered tickers |
|
|
78
79
|
| `insiders <ticker>` | Filed Form 4 transactions, including whether they were pre-planned |
|
|
79
80
|
| `insights <ticker>` | Generated signals, filterable by `--urgency` and `--type` |
|
|
80
81
|
| `congress [ticker]` | Congressional disclosures, market-wide or for one symbol |
|
package/dist/cli.cjs
CHANGED
|
@@ -512,6 +512,26 @@ var analystCommand = {
|
|
|
512
512
|
}
|
|
513
513
|
};
|
|
514
514
|
|
|
515
|
+
// src/cli/sample.ts
|
|
516
|
+
function sampleNote(envelope, ticker) {
|
|
517
|
+
if (envelope.sampleCompany) {
|
|
518
|
+
return {
|
|
519
|
+
kind: "text",
|
|
520
|
+
text: `${ticker} is a sample company: full data on every plan. PRO unlocks every company.`,
|
|
521
|
+
tone: "dim"
|
|
522
|
+
};
|
|
523
|
+
}
|
|
524
|
+
const tickers = envelope.upgrade?.sampleTickers;
|
|
525
|
+
if (tickers && tickers.length > 0) {
|
|
526
|
+
return {
|
|
527
|
+
kind: "text",
|
|
528
|
+
text: `Full data on every plan for the sample companies: ${tickers.join(", ")}.`,
|
|
529
|
+
tone: "dim"
|
|
530
|
+
};
|
|
531
|
+
}
|
|
532
|
+
return void 0;
|
|
533
|
+
}
|
|
534
|
+
|
|
515
535
|
// src/cli/ticker.ts
|
|
516
536
|
function rejectSurplus(args, name, allowed) {
|
|
517
537
|
if (args.positionals.length <= allowed) return;
|
|
@@ -596,7 +616,8 @@ var analystsCommand = {
|
|
|
596
616
|
],
|
|
597
617
|
notes: [
|
|
598
618
|
"The price target band and analyst count come back in full on every key.",
|
|
599
|
-
"The buy / hold / sell distribution and the longer action history are PRO
|
|
619
|
+
"The buy / hold / sell distribution and the longer action history are PRO, and full on a",
|
|
620
|
+
"free key for the sample companies.",
|
|
600
621
|
"A ticker with no analyst coverage exits 4 rather than returning an empty band.",
|
|
601
622
|
"--coverage answers who covers the ticker instead: one row per firm, the analyst that",
|
|
602
623
|
"firm last published under, their latest target, and the firm's current rating. The slug",
|
|
@@ -693,7 +714,7 @@ var analystsCommand = {
|
|
|
693
714
|
tone: "dim"
|
|
694
715
|
});
|
|
695
716
|
}
|
|
696
|
-
return { json: { consensus, actions }, doc: doc(...blocks), notes };
|
|
717
|
+
return { json: { consensus, actions }, doc: doc(...blocks, sampleNote(consensus, ticker)), notes };
|
|
697
718
|
}
|
|
698
719
|
};
|
|
699
720
|
async function coverageRun({ api, ticker, lookbackDays, full, args }) {
|
|
@@ -779,7 +800,7 @@ async function coverageRun({ api, ticker, lookbackDays, full, args }) {
|
|
|
779
800
|
tone: "dim"
|
|
780
801
|
});
|
|
781
802
|
}
|
|
782
|
-
return { json: envelope, doc: doc(...blocks) };
|
|
803
|
+
return { json: envelope, doc: doc(...blocks, sampleNote(envelope, ticker)) };
|
|
783
804
|
}
|
|
784
805
|
|
|
785
806
|
// src/cli/config.ts
|
|
@@ -972,7 +993,7 @@ var congressCommand = {
|
|
|
972
993
|
"Disclosures are filed after the fact, so the gap between the trade date and the",
|
|
973
994
|
"disclosure date is part of the picture. The delay column carries it in days.",
|
|
974
995
|
"Amounts are the filed ranges, never exact figures: that is how the filings work.",
|
|
975
|
-
"A free key sees a short preview of either feed.",
|
|
996
|
+
"A free key sees a short preview of either feed, or every filing for a sample company.",
|
|
976
997
|
EMPTY_VERIFY_NOTE,
|
|
977
998
|
EMPTY_VERIFY_NOTE_2
|
|
978
999
|
],
|
|
@@ -1054,7 +1075,7 @@ var congressCommand = {
|
|
|
1054
1075
|
tone: "dim"
|
|
1055
1076
|
});
|
|
1056
1077
|
}
|
|
1057
|
-
return { json: envelope, doc: doc(...blocks), notes };
|
|
1078
|
+
return { json: envelope, doc: doc(...blocks, ticker ? sampleNote(envelope, ticker) : void 0), notes };
|
|
1058
1079
|
}
|
|
1059
1080
|
};
|
|
1060
1081
|
|
|
@@ -1078,8 +1099,10 @@ var earningsCommand = {
|
|
|
1078
1099
|
notes: [
|
|
1079
1100
|
"With no ticker this is the forward calendar: who reports, when, and the consensus EPS.",
|
|
1080
1101
|
"With a ticker it is the backward-looking analysis: one entry per reported quarter with",
|
|
1081
|
-
"the editorial headline, and on a PRO key the written summary and
|
|
1082
|
-
"
|
|
1102
|
+
"the editorial headline, and on a PRO key or a sample company the written summary and",
|
|
1103
|
+
"guidance language.",
|
|
1104
|
+
"A free key sees the current week of the calendar and the latest quarter of the analysis,",
|
|
1105
|
+
"or every quarter for a sample company.",
|
|
1083
1106
|
"Coverage of the per-ticker analysis is not the whole market, so a tracked company can",
|
|
1084
1107
|
"have no stored quarter yet.",
|
|
1085
1108
|
EMPTY_VERIFY_NOTE,
|
|
@@ -1168,7 +1191,7 @@ var earningsCommand = {
|
|
|
1168
1191
|
tone: "dim"
|
|
1169
1192
|
});
|
|
1170
1193
|
}
|
|
1171
|
-
return { json: envelope2, doc: doc(...blocks2), notes };
|
|
1194
|
+
return { json: envelope2, doc: doc(...blocks2, sampleNote(envelope2, ticker)), notes };
|
|
1172
1195
|
}
|
|
1173
1196
|
const week = typeof args.flags.week === "string" ? args.flags.week : void 0;
|
|
1174
1197
|
if (week && week !== "this" && week !== "next") {
|
|
@@ -1241,9 +1264,9 @@ function latestSettledQuarter(quarters) {
|
|
|
1241
1264
|
const dated = quarters.filter(
|
|
1242
1265
|
(q) => typeof q.reportDate === "string"
|
|
1243
1266
|
);
|
|
1244
|
-
const
|
|
1245
|
-
const settled =
|
|
1246
|
-
return (settled ??
|
|
1267
|
+
const newestFirst2 = [...dated].sort((a, b) => b.reportDate.localeCompare(a.reportDate));
|
|
1268
|
+
const settled = newestFirst2.find((q) => q.pending !== true);
|
|
1269
|
+
return (settled ?? newestFirst2[0])?.reportDate;
|
|
1247
1270
|
}
|
|
1248
1271
|
var flowsCommand = {
|
|
1249
1272
|
name: "flows",
|
|
@@ -1354,7 +1377,7 @@ var flowsCommand = {
|
|
|
1354
1377
|
tone: "dim"
|
|
1355
1378
|
});
|
|
1356
1379
|
}
|
|
1357
|
-
return { json: envelope2, doc: doc(...blocks2), notes };
|
|
1380
|
+
return { json: envelope2, doc: doc(...blocks2, sampleNote(envelope2, ticker)), notes };
|
|
1358
1381
|
}
|
|
1359
1382
|
const envelope = await api.institutional.getFlows(quarter, { limit });
|
|
1360
1383
|
const data = envelope.data;
|
|
@@ -1409,7 +1432,7 @@ var flowsCommand = {
|
|
|
1409
1432
|
};
|
|
1410
1433
|
|
|
1411
1434
|
// src/version.ts
|
|
1412
|
-
var VERSION = "0.
|
|
1435
|
+
var VERSION = "0.73.0";
|
|
1413
1436
|
|
|
1414
1437
|
// src/resources/analyst.ts
|
|
1415
1438
|
var Analyst = class {
|
|
@@ -3494,7 +3517,8 @@ var insidersCommand = {
|
|
|
3494
3517
|
"to sell, so they are excluded from sold and shown separately as withheld.",
|
|
3495
3518
|
"The plan column says whether the trade was under a confirmed pre-arranged 10b5-1 plan,",
|
|
3496
3519
|
"which is the difference between a scheduled sale and a discretionary one.",
|
|
3497
|
-
"A free key sees the top few transactions
|
|
3520
|
+
"A free key sees the top few transactions, or the full window for a sample company; a PRO",
|
|
3521
|
+
"key sees the window you asked for.",
|
|
3498
3522
|
EMPTY_VERIFY_NOTE,
|
|
3499
3523
|
EMPTY_VERIFY_NOTE_2
|
|
3500
3524
|
],
|
|
@@ -3569,7 +3593,7 @@ var insidersCommand = {
|
|
|
3569
3593
|
tone: "dim"
|
|
3570
3594
|
});
|
|
3571
3595
|
}
|
|
3572
|
-
return { json: envelope, doc: doc(...blocks), notes };
|
|
3596
|
+
return { json: envelope, doc: doc(...blocks, sampleNote(envelope, ticker)), notes };
|
|
3573
3597
|
}
|
|
3574
3598
|
};
|
|
3575
3599
|
|
|
@@ -3591,7 +3615,8 @@ var insightsCommand = {
|
|
|
3591
3615
|
notes: [
|
|
3592
3616
|
"Signals are generated observations about filings, flows, and attention, ordered by",
|
|
3593
3617
|
"urgency then confidence. They describe what the data shows, not what to do about it.",
|
|
3594
|
-
"A free key sees the top three; a PRO key sees the
|
|
3618
|
+
"A free key sees the top three, or the whole list for a sample company; a PRO key sees the",
|
|
3619
|
+
"whole list.",
|
|
3595
3620
|
"Signal types vary by ticker and over time, so take --type from what a plain run reports",
|
|
3596
3621
|
"rather than guessing a name.",
|
|
3597
3622
|
EMPTY_VERIFY_NOTE,
|
|
@@ -3677,10 +3702,279 @@ var insightsCommand = {
|
|
|
3677
3702
|
tone: "dim"
|
|
3678
3703
|
});
|
|
3679
3704
|
}
|
|
3680
|
-
return { json: envelope, doc: doc(...blocks), notes };
|
|
3705
|
+
return { json: envelope, doc: doc(...blocks, sampleNote(envelope, ticker)), notes };
|
|
3681
3706
|
}
|
|
3682
3707
|
};
|
|
3683
3708
|
|
|
3709
|
+
// src/cli/commands/kpis.ts
|
|
3710
|
+
var DEFAULT_PERIODS = 12;
|
|
3711
|
+
var DEFAULT_COVERAGE_ROWS2 = 20;
|
|
3712
|
+
function newestFirst(values) {
|
|
3713
|
+
return [...values].sort((a, b) => a.date < b.date ? 1 : a.date > b.date ? -1 : 0);
|
|
3714
|
+
}
|
|
3715
|
+
function yearAgoLabel(period) {
|
|
3716
|
+
const match = /(\d{4})/.exec(period);
|
|
3717
|
+
if (!match) return void 0;
|
|
3718
|
+
const year = Number(match[1]);
|
|
3719
|
+
return `${period.slice(0, match.index)}${year - 1}${period.slice(match.index + 4)}`;
|
|
3720
|
+
}
|
|
3721
|
+
function yearOverYear(series, point) {
|
|
3722
|
+
const label = yearAgoLabel(point.period);
|
|
3723
|
+
const prior = label === void 0 ? void 0 : series.values.find((value) => value.period === label);
|
|
3724
|
+
if (!prior || !Number.isFinite(prior.value) || !Number.isFinite(point.value)) return cell(ABSENT);
|
|
3725
|
+
if (series.unit === "percent") {
|
|
3726
|
+
const diff = point.value - prior.value;
|
|
3727
|
+
return cell(`${signed(diff, 1)} pts`, direction(diff));
|
|
3728
|
+
}
|
|
3729
|
+
if (prior.value <= 0) return cell(ABSENT);
|
|
3730
|
+
const change = (point.value - prior.value) / prior.value * 100;
|
|
3731
|
+
return cell(signedPercent(change, 1), direction(change));
|
|
3732
|
+
}
|
|
3733
|
+
function formatKpiValue(value, series) {
|
|
3734
|
+
if (!Number.isFinite(value)) return ABSENT;
|
|
3735
|
+
const { unit, displayFormat } = series;
|
|
3736
|
+
if (unit === "percent") return percent(value, 1);
|
|
3737
|
+
if (unit === "USD") return displayFormat === "currency" ? money(value) : `$${humanize(value)}`;
|
|
3738
|
+
if (/^[A-Z]{3}$/.test(unit)) {
|
|
3739
|
+
return displayFormat === "currency" ? `${value.toFixed(2)} ${unit}` : `${humanize(value)} ${unit}`;
|
|
3740
|
+
}
|
|
3741
|
+
return unit ? `${humanize(value)} ${unit}` : humanize(value);
|
|
3742
|
+
}
|
|
3743
|
+
async function noCoverage(api, ticker) {
|
|
3744
|
+
await verifyTickerOnEmpty(api, ticker);
|
|
3745
|
+
throw new CliCommandError(
|
|
3746
|
+
`${ticker} has no curated KPI coverage yet.`,
|
|
3747
|
+
'run "sentisense kpis --coverage" for the tickers that have it.',
|
|
3748
|
+
EXIT.NOT_FOUND
|
|
3749
|
+
);
|
|
3750
|
+
}
|
|
3751
|
+
async function orNoCoverage(api, ticker, request) {
|
|
3752
|
+
try {
|
|
3753
|
+
return await request;
|
|
3754
|
+
} catch (error) {
|
|
3755
|
+
if (error instanceof NotFoundError) return noCoverage(api, ticker);
|
|
3756
|
+
throw error;
|
|
3757
|
+
}
|
|
3758
|
+
}
|
|
3759
|
+
var kpisCommand = {
|
|
3760
|
+
name: "kpis",
|
|
3761
|
+
summary: "Company KPIs from earnings filings: segment revenue, deliveries, subscribers",
|
|
3762
|
+
usage: "sentisense kpis <ticker> [--series ID | --types] | sentisense kpis --coverage",
|
|
3763
|
+
examples: [
|
|
3764
|
+
"sentisense kpis TSLA",
|
|
3765
|
+
"sentisense kpis TSLA --series vehicle_deliveries",
|
|
3766
|
+
"sentisense kpis TSLA --types",
|
|
3767
|
+
"sentisense kpis --coverage --full",
|
|
3768
|
+
"sentisense kpis TSLA --json"
|
|
3769
|
+
],
|
|
3770
|
+
notes: [
|
|
3771
|
+
"One row per series: its latest reported period and value, and the change from the same",
|
|
3772
|
+
"period a year earlier, computed only from that series' own values. A percent series",
|
|
3773
|
+
"changes in points. Discontinued series are hidden unless --full.",
|
|
3774
|
+
"--series ID prints that series' periods, newest first. The ids are in the first column.",
|
|
3775
|
+
"--types lists the series without their values, on any key and at no quota cost.",
|
|
3776
|
+
"--coverage lists every covered ticker and marks the sample companies, whose full KPI",
|
|
3777
|
+
"series a free key can read. Other companies return the series list only on a free key;",
|
|
3778
|
+
"PRO returns every series in full.",
|
|
3779
|
+
"A ticker without KPI coverage exits 4 and says so; an unknown symbol exits 4 as a typo.",
|
|
3780
|
+
EMPTY_VERIFY_NOTE,
|
|
3781
|
+
EMPTY_VERIFY_NOTE_2
|
|
3782
|
+
],
|
|
3783
|
+
flags: {
|
|
3784
|
+
series: { type: "string", placeholder: "ID", describe: "Print one series' periods, newest first" },
|
|
3785
|
+
types: { type: "boolean", describe: "List the series without their values (free on any key)" },
|
|
3786
|
+
coverage: { type: "boolean", describe: "List every ticker with KPI coverage" }
|
|
3787
|
+
},
|
|
3788
|
+
async run({ args, client, full }) {
|
|
3789
|
+
if (args.flags.coverage === true) {
|
|
3790
|
+
rejectPositionals(args, "kpis --coverage");
|
|
3791
|
+
return coverageRun2(client(), full);
|
|
3792
|
+
}
|
|
3793
|
+
const ticker = oneTicker(args, "kpis");
|
|
3794
|
+
const series = typeof args.flags.series === "string" ? args.flags.series : void 0;
|
|
3795
|
+
if (series !== void 0 && args.flags.types === true) {
|
|
3796
|
+
throw new CliUsageError("--series and --types do not go together.", "pass one or the other.");
|
|
3797
|
+
}
|
|
3798
|
+
const api = client();
|
|
3799
|
+
if (args.flags.types === true) return typesRun(api, ticker);
|
|
3800
|
+
const envelope = await orNoCoverage(api, ticker, api.stocks.getKpis(ticker));
|
|
3801
|
+
return series === void 0 ? summaryRun(envelope, ticker, full) : seriesRun(envelope, ticker, series, full);
|
|
3802
|
+
}
|
|
3803
|
+
};
|
|
3804
|
+
function headBlock(ticker, data, right) {
|
|
3805
|
+
return {
|
|
3806
|
+
kind: "head",
|
|
3807
|
+
title: field("ticker", ticker),
|
|
3808
|
+
subtitle: data?.companyName ? field("company", data.companyName) : void 0,
|
|
3809
|
+
right: fields(...right)
|
|
3810
|
+
};
|
|
3811
|
+
}
|
|
3812
|
+
function lockedBlocks(envelope, ticker) {
|
|
3813
|
+
if (!envelope.isPreview) return [];
|
|
3814
|
+
return [
|
|
3815
|
+
{
|
|
3816
|
+
kind: "text",
|
|
3817
|
+
text: "Preview response: KPI values for this company are PRO. A free key gets the full series for the sample companies.",
|
|
3818
|
+
tone: "dim"
|
|
3819
|
+
},
|
|
3820
|
+
{ kind: "text", text: `Run "sentisense kpis ${ticker} --types" for the series this company reports.`, tone: "dim" }
|
|
3821
|
+
];
|
|
3822
|
+
}
|
|
3823
|
+
function summaryRun(envelope, ticker, full) {
|
|
3824
|
+
const data = envelope.data;
|
|
3825
|
+
const all = data?.kpis ?? [];
|
|
3826
|
+
const discontinued = all.filter((series) => series.discontinued === true);
|
|
3827
|
+
const shown = full ? all : all.filter((series) => series.discontinued !== true);
|
|
3828
|
+
const blocks = [
|
|
3829
|
+
headBlock(ticker, data, [
|
|
3830
|
+
// A preview's empty list is a gate, not a count, so it prints no "series: 0".
|
|
3831
|
+
envelope.isPreview && all.length === 0 ? void 0 : field("series", String(all.length)),
|
|
3832
|
+
data?.lastUpdated ? field("updated", data.lastUpdated.slice(0, 10)) : void 0
|
|
3833
|
+
])
|
|
3834
|
+
];
|
|
3835
|
+
if (shown.length > 0) {
|
|
3836
|
+
blocks.push({
|
|
3837
|
+
kind: "table",
|
|
3838
|
+
head: ["ID", "SERIES", "PERIOD", "VALUE", "YOY"],
|
|
3839
|
+
align: ["left", "left", "left", "right", "right"],
|
|
3840
|
+
rows: shown.map((series) => {
|
|
3841
|
+
const latest = newestFirst(series.values)[0];
|
|
3842
|
+
const name = `${series.name}${series.discontinued ? " (discontinued)" : ""}`;
|
|
3843
|
+
return [
|
|
3844
|
+
// Never truncated: the id is what --series takes, so it has to copy and paste whole.
|
|
3845
|
+
cell(series.id),
|
|
3846
|
+
cell(truncate(name, full ? 60 : 32), series.discontinued ? "dim" : void 0),
|
|
3847
|
+
cell(latest ? `${latest.period}${latest.isEstimate ? " (prelim)" : ""}` : ABSENT),
|
|
3848
|
+
cell(latest ? formatKpiValue(latest.value, series) : ABSENT),
|
|
3849
|
+
latest ? yearOverYear(series, latest) : cell(ABSENT)
|
|
3850
|
+
];
|
|
3851
|
+
})
|
|
3852
|
+
});
|
|
3853
|
+
if (!full && discontinued.length > 0) {
|
|
3854
|
+
blocks.push({
|
|
3855
|
+
kind: "text",
|
|
3856
|
+
text: `${discontinued.length} discontinued series hidden. Add --full to show them.`,
|
|
3857
|
+
tone: "dim"
|
|
3858
|
+
});
|
|
3859
|
+
}
|
|
3860
|
+
} else if (!envelope.isPreview) {
|
|
3861
|
+
blocks.push({ kind: "text", text: "No KPI series reported for this company." });
|
|
3862
|
+
}
|
|
3863
|
+
blocks.push(...lockedBlocks(envelope, ticker));
|
|
3864
|
+
return { json: envelope, doc: doc(...blocks, sampleNote(envelope, ticker)) };
|
|
3865
|
+
}
|
|
3866
|
+
function seriesRun(envelope, ticker, id, full) {
|
|
3867
|
+
const data = envelope.data;
|
|
3868
|
+
if (envelope.isPreview && (data?.kpis ?? []).length === 0) {
|
|
3869
|
+
const blocks2 = [headBlock(ticker, data, [field("series", id)]), ...lockedBlocks(envelope, ticker)];
|
|
3870
|
+
return { json: envelope, doc: doc(...blocks2, sampleNote(envelope, ticker)) };
|
|
3871
|
+
}
|
|
3872
|
+
const series = (data?.kpis ?? []).find((candidate) => candidate.id === id);
|
|
3873
|
+
if (!series) {
|
|
3874
|
+
throw new CliCommandError(
|
|
3875
|
+
`${ticker} has no KPI series "${id}".`,
|
|
3876
|
+
`run "sentisense kpis ${ticker} --types" for its series ids.`,
|
|
3877
|
+
EXIT.NOT_FOUND
|
|
3878
|
+
);
|
|
3879
|
+
}
|
|
3880
|
+
const values = newestFirst(series.values);
|
|
3881
|
+
const shown = full ? values : values.slice(0, DEFAULT_PERIODS);
|
|
3882
|
+
const blocks = [
|
|
3883
|
+
headBlock(ticker, data, [field("series", series.name), field("periods", String(values.length))])
|
|
3884
|
+
];
|
|
3885
|
+
if (series.discontinued) {
|
|
3886
|
+
blocks.push({
|
|
3887
|
+
kind: "text",
|
|
3888
|
+
text: `Discontinued${series.discontinuedNote ? `: ${series.discontinuedNote}` : "."}`,
|
|
3889
|
+
tone: "dim"
|
|
3890
|
+
});
|
|
3891
|
+
}
|
|
3892
|
+
if (shown.length === 0) {
|
|
3893
|
+
blocks.push({ kind: "text", text: "No reported periods in this series." });
|
|
3894
|
+
} else {
|
|
3895
|
+
blocks.push({
|
|
3896
|
+
kind: "table",
|
|
3897
|
+
head: ["PERIOD", "DATE", "VALUE", "YOY", ""],
|
|
3898
|
+
align: ["left", "left", "right", "right", "left"],
|
|
3899
|
+
rows: shown.map((point) => [
|
|
3900
|
+
cell(point.period),
|
|
3901
|
+
cell(point.date),
|
|
3902
|
+
cell(formatKpiValue(point.value, series)),
|
|
3903
|
+
yearOverYear(series, point),
|
|
3904
|
+
cell(point.isEstimate ? "prelim" : "")
|
|
3905
|
+
])
|
|
3906
|
+
});
|
|
3907
|
+
if (shown.length < values.length) {
|
|
3908
|
+
blocks.push({
|
|
3909
|
+
kind: "text",
|
|
3910
|
+
text: `Showing ${shown.length} of ${values.length} periods. Add --full for the rest.`,
|
|
3911
|
+
tone: "dim"
|
|
3912
|
+
});
|
|
3913
|
+
}
|
|
3914
|
+
}
|
|
3915
|
+
if (series.sourceRef) blocks.push({ kind: "text", text: `Source: ${series.sourceRef}`, tone: "dim" });
|
|
3916
|
+
return { json: envelope, doc: doc(...blocks, sampleNote(envelope, ticker)) };
|
|
3917
|
+
}
|
|
3918
|
+
async function typesRun(api, ticker) {
|
|
3919
|
+
const types = await orNoCoverage(api, ticker, api.stocks.getKpiTypes(ticker));
|
|
3920
|
+
const blocks = [{ kind: "head", title: field("ticker", ticker), right: [field("series", String(types.length))] }];
|
|
3921
|
+
if (types.length === 0) {
|
|
3922
|
+
blocks.push({ kind: "text", text: "No KPI series listed for this company." });
|
|
3923
|
+
} else {
|
|
3924
|
+
blocks.push({
|
|
3925
|
+
kind: "table",
|
|
3926
|
+
head: ["ID", "SERIES", "CATEGORY"],
|
|
3927
|
+
rows: types.map((entry) => [cell(entry.id), cell(entry.name), cell(entry.category)])
|
|
3928
|
+
});
|
|
3929
|
+
}
|
|
3930
|
+
return { json: types, doc: doc(...blocks) };
|
|
3931
|
+
}
|
|
3932
|
+
async function coverageRun2(api, full) {
|
|
3933
|
+
const response = await api.stocks.listKpiCoverage();
|
|
3934
|
+
const rows = response.tickers ?? [];
|
|
3935
|
+
const samples = rows.filter((row) => row.sampleCompany === true);
|
|
3936
|
+
const count = response.count ?? rows.length;
|
|
3937
|
+
const shown = full ? rows : samples.length > 0 ? samples : rows.slice(0, DEFAULT_COVERAGE_ROWS2);
|
|
3938
|
+
const blocks = [
|
|
3939
|
+
{
|
|
3940
|
+
kind: "head",
|
|
3941
|
+
title: field("kpi coverage", `${count} tickers`),
|
|
3942
|
+
right: fields(samples.length > 0 ? field("sample companies", String(samples.length)) : void 0)
|
|
3943
|
+
}
|
|
3944
|
+
];
|
|
3945
|
+
if (shown.length === 0) {
|
|
3946
|
+
blocks.push({ kind: "text", text: "No tickers listed with KPI coverage." });
|
|
3947
|
+
} else {
|
|
3948
|
+
blocks.push({
|
|
3949
|
+
kind: "table",
|
|
3950
|
+
head: ["TICKER", "COMPANY", "SERIES", "UPDATED", "SAMPLE"],
|
|
3951
|
+
align: ["left", "left", "right", "left", "left"],
|
|
3952
|
+
rows: shown.map((row) => [
|
|
3953
|
+
cell(row.ticker),
|
|
3954
|
+
cell(truncate(row.companyName ?? "", full ? 48 : 32)),
|
|
3955
|
+
cell(String(row.kpiCount)),
|
|
3956
|
+
cell((row.lastUpdated ?? "").slice(0, 10)),
|
|
3957
|
+
cell(row.sampleCompany ? "sample" : "", row.sampleCompany ? "accent" : void 0)
|
|
3958
|
+
])
|
|
3959
|
+
});
|
|
3960
|
+
}
|
|
3961
|
+
if (samples.length > 0) {
|
|
3962
|
+
blocks.push({
|
|
3963
|
+
kind: "text",
|
|
3964
|
+
text: `Full KPI data on ${samples.length} sample companies, free; a preview for every other company. PRO unlocks them all.`,
|
|
3965
|
+
tone: "dim"
|
|
3966
|
+
});
|
|
3967
|
+
}
|
|
3968
|
+
if (shown.length < rows.length) {
|
|
3969
|
+
blocks.push({
|
|
3970
|
+
kind: "text",
|
|
3971
|
+
text: samples.length > 0 && !full ? `Showing the ${shown.length} sample companies of ${rows.length} covered tickers. Add --full for all of them.` : `Showing ${shown.length} of ${rows.length} covered tickers. Add --full for all of them.`,
|
|
3972
|
+
tone: "dim"
|
|
3973
|
+
});
|
|
3974
|
+
}
|
|
3975
|
+
return { json: response, doc: doc(...blocks) };
|
|
3976
|
+
}
|
|
3977
|
+
|
|
3684
3978
|
// src/cli/commands/mood.ts
|
|
3685
3979
|
function readMarket(payload) {
|
|
3686
3980
|
if (!payload || typeof payload !== "object") return {};
|
|
@@ -3904,7 +4198,7 @@ async function intraday(api, ticker, session) {
|
|
|
3904
4198
|
if (envelope.upgrade?.url) {
|
|
3905
4199
|
lines.push({ kind: "text", text: envelope.upgrade.url, tone: "dim" });
|
|
3906
4200
|
}
|
|
3907
|
-
return { json: envelope, doc: doc(...lines) };
|
|
4201
|
+
return { json: envelope, doc: doc(...lines, sampleNote(envelope, ticker)) };
|
|
3908
4202
|
}
|
|
3909
4203
|
const series = data?.series ?? [];
|
|
3910
4204
|
const served = data?.session ?? session ?? "the latest session";
|
|
@@ -3955,7 +4249,7 @@ async function intraday(api, ticker, session) {
|
|
|
3955
4249
|
text: `Volumes are cumulative for the session, from chains delayed ${data?.delayMinutes ?? 15} minutes.`,
|
|
3956
4250
|
tone: "dim"
|
|
3957
4251
|
});
|
|
3958
|
-
return { json: envelope, doc: doc(...blocks) };
|
|
4252
|
+
return { json: envelope, doc: doc(...blocks, sampleNote(envelope, ticker)) };
|
|
3959
4253
|
}
|
|
3960
4254
|
var optionsCommand = {
|
|
3961
4255
|
name: "options",
|
|
@@ -3977,13 +4271,14 @@ var optionsCommand = {
|
|
|
3977
4271
|
EMPTY_VERIFY_NOTE,
|
|
3978
4272
|
EMPTY_VERIFY_NOTE_2,
|
|
3979
4273
|
"A free key gets the full dossier for the first ten calls each month, then a headline",
|
|
3980
|
-
"preview. Calls that return no dossier do not count against that.",
|
|
4274
|
+
"preview. Calls that return no dossier do not count against that. Sample companies are",
|
|
4275
|
+
"always full and spend none of the ten.",
|
|
3981
4276
|
"--intraday shows one session's intraday series instead: the ticker's volumes, put/call",
|
|
3982
|
-
"ratio, unusual-contract count and ATM IV at every 15-minute cycle (PRO keys
|
|
4277
|
+
"ratio, unusual-contract count and ATM IV at every 15-minute cycle (PRO keys and sample companies).",
|
|
3983
4278
|
"--session picks the session and implies --intraday; omitted, the latest one."
|
|
3984
4279
|
],
|
|
3985
4280
|
flags: {
|
|
3986
|
-
intraday: { type: "boolean", describe: "Show the session's intraday series, every 15-minute cycle (PRO)" },
|
|
4281
|
+
intraday: { type: "boolean", describe: "Show the session's intraday series, every 15-minute cycle (PRO or a sample company)" },
|
|
3987
4282
|
session: {
|
|
3988
4283
|
type: "string",
|
|
3989
4284
|
placeholder: "YYYY-MM-DD",
|
|
@@ -4099,7 +4394,7 @@ var optionsCommand = {
|
|
|
4099
4394
|
tone: "dim"
|
|
4100
4395
|
});
|
|
4101
4396
|
}
|
|
4102
|
-
return { json: envelope, doc: doc(...blocks) };
|
|
4397
|
+
return { json: envelope, doc: doc(...blocks, sampleNote(envelope, ticker)) };
|
|
4103
4398
|
}
|
|
4104
4399
|
};
|
|
4105
4400
|
|
|
@@ -4788,6 +5083,7 @@ var COMMANDS = [
|
|
|
4788
5083
|
analystsCommand,
|
|
4789
5084
|
analystCommand,
|
|
4790
5085
|
earningsCommand,
|
|
5086
|
+
kpisCommand,
|
|
4791
5087
|
insidersCommand,
|
|
4792
5088
|
insightsCommand,
|
|
4793
5089
|
congressCommand,
|
|
@@ -4814,6 +5110,7 @@ var EXAMPLE = {
|
|
|
4814
5110
|
analysts: "sentisense analysts NVDA --coverage",
|
|
4815
5111
|
analyst: "sentisense analyst dan-ives --calls",
|
|
4816
5112
|
earnings: "sentisense earnings --week next",
|
|
5113
|
+
kpis: "sentisense kpis TSLA",
|
|
4817
5114
|
insiders: "sentisense insiders NVDA",
|
|
4818
5115
|
insights: "sentisense insights NVDA",
|
|
4819
5116
|
congress: "sentisense congress NVDA",
|