@spfunctions/cli 1.7.19 → 1.7.22
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/101.index.js +1 -0
- package/dist/12.index.js +1 -0
- package/dist/160.index.js +1 -0
- package/dist/174.index.js +1 -0
- package/dist/278.index.js +6 -0
- package/dist/582.index.js +1 -0
- package/dist/641.index.js +324 -0
- package/dist/669.index.js +1 -0
- package/dist/722.index.js +1 -0
- package/dist/788.index.js +1 -0
- package/dist/816.index.js +12 -0
- package/dist/830.index.js +1 -0
- package/dist/921.index.js +1 -0
- package/dist/index.js +1 -833
- package/package.json +5 -2
- package/dist/cache.d.ts +0 -6
- package/dist/cache.js +0 -31
- package/dist/cache.test.d.ts +0 -1
- package/dist/cache.test.js +0 -73
- package/dist/client.d.ts +0 -56
- package/dist/client.js +0 -205
- package/dist/client.test.d.ts +0 -1
- package/dist/client.test.js +0 -89
- package/dist/commands/agent.d.ts +0 -20
- package/dist/commands/agent.js +0 -4119
- package/dist/commands/announcements.d.ts +0 -3
- package/dist/commands/announcements.js +0 -28
- package/dist/commands/augment.d.ts +0 -12
- package/dist/commands/augment.js +0 -56
- package/dist/commands/balance.d.ts +0 -3
- package/dist/commands/balance.js +0 -17
- package/dist/commands/book.d.ts +0 -17
- package/dist/commands/book.js +0 -220
- package/dist/commands/cancel.d.ts +0 -5
- package/dist/commands/cancel.js +0 -41
- package/dist/commands/context.d.ts +0 -6
- package/dist/commands/context.js +0 -208
- package/dist/commands/create.d.ts +0 -7
- package/dist/commands/create.js +0 -42
- package/dist/commands/dashboard.d.ts +0 -14
- package/dist/commands/dashboard.js +0 -215
- package/dist/commands/delta.d.ts +0 -16
- package/dist/commands/delta.js +0 -115
- package/dist/commands/edges.d.ts +0 -26
- package/dist/commands/edges.js +0 -246
- package/dist/commands/evaluate.d.ts +0 -4
- package/dist/commands/evaluate.js +0 -30
- package/dist/commands/explore.d.ts +0 -14
- package/dist/commands/explore.js +0 -116
- package/dist/commands/feed.d.ts +0 -13
- package/dist/commands/feed.js +0 -73
- package/dist/commands/fills.d.ts +0 -4
- package/dist/commands/fills.js +0 -29
- package/dist/commands/forecast.d.ts +0 -4
- package/dist/commands/forecast.js +0 -53
- package/dist/commands/get.d.ts +0 -5
- package/dist/commands/get.js +0 -98
- package/dist/commands/heartbeat.d.ts +0 -20
- package/dist/commands/heartbeat.js +0 -73
- package/dist/commands/history.d.ts +0 -3
- package/dist/commands/history.js +0 -38
- package/dist/commands/liquidity.d.ts +0 -14
- package/dist/commands/liquidity.js +0 -378
- package/dist/commands/list.d.ts +0 -5
- package/dist/commands/list.js +0 -38
- package/dist/commands/login.d.ts +0 -10
- package/dist/commands/login.js +0 -98
- package/dist/commands/markets.d.ts +0 -10
- package/dist/commands/markets.js +0 -39
- package/dist/commands/milestones.d.ts +0 -8
- package/dist/commands/milestones.js +0 -56
- package/dist/commands/orders.d.ts +0 -4
- package/dist/commands/orders.js +0 -28
- package/dist/commands/performance.d.ts +0 -11
- package/dist/commands/performance.js +0 -250
- package/dist/commands/positions.d.ts +0 -19
- package/dist/commands/positions.js +0 -294
- package/dist/commands/prompt.d.ts +0 -13
- package/dist/commands/prompt.js +0 -35
- package/dist/commands/publish.d.ts +0 -15
- package/dist/commands/publish.js +0 -39
- package/dist/commands/query.d.ts +0 -15
- package/dist/commands/query.js +0 -132
- package/dist/commands/rfq.d.ts +0 -5
- package/dist/commands/rfq.js +0 -35
- package/dist/commands/scan.d.ts +0 -11
- package/dist/commands/scan.js +0 -230
- package/dist/commands/schedule.d.ts +0 -3
- package/dist/commands/schedule.js +0 -38
- package/dist/commands/settlements.d.ts +0 -6
- package/dist/commands/settlements.js +0 -50
- package/dist/commands/setup.d.ts +0 -24
- package/dist/commands/setup.js +0 -700
- package/dist/commands/signal.d.ts +0 -6
- package/dist/commands/signal.js +0 -32
- package/dist/commands/strategies.d.ts +0 -11
- package/dist/commands/strategies.js +0 -130
- package/dist/commands/telegram.d.ts +0 -15
- package/dist/commands/telegram.js +0 -125
- package/dist/commands/trade.d.ts +0 -12
- package/dist/commands/trade.js +0 -112
- package/dist/commands/watch.d.ts +0 -19
- package/dist/commands/watch.js +0 -157
- package/dist/commands/whatif.d.ts +0 -17
- package/dist/commands/whatif.js +0 -209
- package/dist/commands/x.d.ts +0 -28
- package/dist/commands/x.js +0 -167
- package/dist/config.d.ts +0 -55
- package/dist/config.js +0 -139
- package/dist/config.test.d.ts +0 -1
- package/dist/config.test.js +0 -138
- package/dist/index.d.ts +0 -20
- package/dist/kalshi.d.ts +0 -144
- package/dist/kalshi.js +0 -498
- package/dist/polymarket.d.ts +0 -237
- package/dist/polymarket.js +0 -353
- package/dist/polymarket.test.d.ts +0 -1
- package/dist/polymarket.test.js +0 -424
- package/dist/share.d.ts +0 -4
- package/dist/share.js +0 -27
- package/dist/skills/loader.d.ts +0 -19
- package/dist/skills/loader.js +0 -86
- package/dist/telegram/agent-bridge.d.ts +0 -15
- package/dist/telegram/agent-bridge.js +0 -573
- package/dist/telegram/bot.d.ts +0 -10
- package/dist/telegram/bot.js +0 -297
- package/dist/telegram/commands.d.ts +0 -11
- package/dist/telegram/commands.js +0 -120
- package/dist/telegram/format.d.ts +0 -11
- package/dist/telegram/format.js +0 -51
- package/dist/telegram/format.test.d.ts +0 -1
- package/dist/telegram/format.test.js +0 -73
- package/dist/telegram/poller.d.ts +0 -6
- package/dist/telegram/poller.js +0 -32
- package/dist/topics.d.ts +0 -17
- package/dist/topics.js +0 -102
- package/dist/topics.test.d.ts +0 -1
- package/dist/topics.test.js +0 -131
- package/dist/tui/border.d.ts +0 -33
- package/dist/tui/border.js +0 -87
- package/dist/tui/chart.d.ts +0 -19
- package/dist/tui/chart.js +0 -117
- package/dist/tui/dashboard.d.ts +0 -9
- package/dist/tui/dashboard.js +0 -814
- package/dist/tui/layout.d.ts +0 -16
- package/dist/tui/layout.js +0 -41
- package/dist/tui/screen.d.ts +0 -33
- package/dist/tui/screen.js +0 -102
- package/dist/tui/state.d.ts +0 -40
- package/dist/tui/state.js +0 -36
- package/dist/tui/widgets/commandbar.d.ts +0 -8
- package/dist/tui/widgets/commandbar.js +0 -82
- package/dist/tui/widgets/detail.d.ts +0 -9
- package/dist/tui/widgets/detail.js +0 -151
- package/dist/tui/widgets/edges.d.ts +0 -4
- package/dist/tui/widgets/edges.js +0 -34
- package/dist/tui/widgets/liquidity.d.ts +0 -9
- package/dist/tui/widgets/liquidity.js +0 -142
- package/dist/tui/widgets/orders.d.ts +0 -4
- package/dist/tui/widgets/orders.js +0 -37
- package/dist/tui/widgets/portfolio.d.ts +0 -4
- package/dist/tui/widgets/portfolio.js +0 -59
- package/dist/tui/widgets/signals.d.ts +0 -4
- package/dist/tui/widgets/signals.js +0 -31
- package/dist/tui/widgets/statusbar.d.ts +0 -8
- package/dist/tui/widgets/statusbar.js +0 -72
- package/dist/tui/widgets/thesis.d.ts +0 -4
- package/dist/tui/widgets/thesis.js +0 -66
- package/dist/tui/widgets/trade.d.ts +0 -9
- package/dist/tui/widgets/trade.js +0 -117
- package/dist/tui/widgets/upcoming.d.ts +0 -4
- package/dist/tui/widgets/upcoming.js +0 -41
- package/dist/tui/widgets/whatif.d.ts +0 -7
- package/dist/tui/widgets/whatif.js +0 -113
- package/dist/types/output.d.ts +0 -412
- package/dist/types/output.js +0 -9
- package/dist/utils.d.ts +0 -52
- package/dist/utils.js +0 -146
- package/dist/utils.test.d.ts +0 -1
- package/dist/utils.test.js +0 -111
package/dist/topics.js
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Topic → Kalshi series mapping
|
|
4
|
-
*
|
|
5
|
-
* Shared between dashboard, liquidity scanner, and other commands
|
|
6
|
-
* that need to categorize markets by topic.
|
|
7
|
-
*
|
|
8
|
-
* Sourced from Kalshi's top series by volume (non-sports).
|
|
9
|
-
* Run `sf scan` to discover new series.
|
|
10
|
-
*/
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.RISK_CATEGORIES = exports.TOPIC_SERIES = void 0;
|
|
13
|
-
exports.tickerToTopic = tickerToTopic;
|
|
14
|
-
exports.TOPIC_SERIES = {
|
|
15
|
-
oil: ['KXWTIMAX', 'KXWTIW', 'KXWTID', 'KXWTI'],
|
|
16
|
-
gas: ['KXAAAGASM', 'KXAAAGASW', 'KXCPIGAS'],
|
|
17
|
-
fed: ['KXFEDDECISION', 'KXFED', 'KXRATECUT', 'KXRATECUTCOUNT'],
|
|
18
|
-
cpi: ['KXCPI', 'KXCPIYOY'],
|
|
19
|
-
recession: ['KXRECSSNBER'],
|
|
20
|
-
sp500: ['KXINXY', 'KXINXU', 'KXINX'],
|
|
21
|
-
nasdaq: ['KXNASDAQ100', 'KXNASDAQ100U', 'KXNASDAQ100Y'],
|
|
22
|
-
crypto: ['KXBTCD', 'KXBTC', 'KXBTC15M', 'KXBTCMAXY', 'KXBTCMINY', 'KXBTCY',
|
|
23
|
-
'KXETHD', 'KXETH', 'KXETH15M', 'KXETHMAXY', 'KXETHMINY',
|
|
24
|
-
'KXSOL15M', 'KXXRP15M'],
|
|
25
|
-
unemployment: ['KXU3', 'KXPAYROLLS'],
|
|
26
|
-
gdp: ['KXGDP'],
|
|
27
|
-
treasury: ['KXTNOTEW', 'KXTNOTED'],
|
|
28
|
-
geopolitics: ['KXCLOSEHORMUZ', 'KXHORMUZTRAFFICW', 'KXHORMUZTRAFFIC', 'KXHORMUZNORM',
|
|
29
|
-
'KXLEADERSOUT', 'KXLEADEROUT', 'KXMADUROOUT', 'KXKHAMENEIOUT'],
|
|
30
|
-
elections: ['PRES', 'KXFEDCHAIRNOM', 'KXPRESNOMD', 'KXPRESNOMR', 'KXPRESPERSON',
|
|
31
|
-
'KXNEXTPOPE', 'KXTRUMPOUT', 'KXCANADAPM'],
|
|
32
|
-
politics: ['KXGOVSHUT', 'KXGOVTSHUTDOWN', 'KXGOVSHUTLENGTH', 'KXGOVTCUTS',
|
|
33
|
-
'KXTRUMPMENTION', 'KXEOWEEK', 'KXGREENLAND', 'KXCANCOALITION'],
|
|
34
|
-
centralbanks: ['KXCBDECISIONJAPAN', 'KXCBDECISIONENGLAND', 'KXCBDECISIONEU',
|
|
35
|
-
'KXCBDECISIONAUSTRALIA', 'KXCBDECISIONCANADA', 'KXCBDECISIONCHINA',
|
|
36
|
-
'KXCBDECISIONMEXICO', 'KXCBDECISIONKOREA'],
|
|
37
|
-
forex: ['KXUSDJPY'],
|
|
38
|
-
tariffs: ['KXTARIFFRATEPRC', 'KXTARIFFRATECAN', 'KXTARIFFRATECA',
|
|
39
|
-
'KXTARIFFRATEINDIA', 'KXTARIFFRATEBR', 'KXTARIFFRATEEU',
|
|
40
|
-
'KXTARIFFRATEJP', 'KXTARIFFRATEKR'],
|
|
41
|
-
tech: ['KXLLM1', 'KXTOPMODEL', 'KXALIENS'],
|
|
42
|
-
};
|
|
43
|
-
/** Map a series prefix to a human-readable category name (for dashboard display) */
|
|
44
|
-
exports.RISK_CATEGORIES = {
|
|
45
|
-
KXWTIMAX: 'Oil',
|
|
46
|
-
KXWTIW: 'Oil',
|
|
47
|
-
KXWTID: 'Oil',
|
|
48
|
-
KXWTI: 'Oil',
|
|
49
|
-
KXAAAGASM: 'Gas',
|
|
50
|
-
KXAAAGASW: 'Gas',
|
|
51
|
-
KXCPIGAS: 'Gas',
|
|
52
|
-
KXRECSSNBER: 'Recession',
|
|
53
|
-
KXCPI: 'Inflation',
|
|
54
|
-
KXCPIYOY: 'Inflation',
|
|
55
|
-
KXINXY: 'S&P 500',
|
|
56
|
-
KXINXU: 'S&P 500',
|
|
57
|
-
KXINX: 'S&P 500',
|
|
58
|
-
KXNASDAQ100: 'Nasdaq',
|
|
59
|
-
KXNASDAQ100U: 'Nasdaq',
|
|
60
|
-
KXNASDAQ100Y: 'Nasdaq',
|
|
61
|
-
KXFEDDECISION: 'Fed Rate',
|
|
62
|
-
KXFED: 'Fed Rate',
|
|
63
|
-
KXRATECUT: 'Fed Rate',
|
|
64
|
-
KXRATECUTCOUNT: 'Fed Rate',
|
|
65
|
-
KXBTCD: 'Bitcoin',
|
|
66
|
-
KXBTC: 'Bitcoin',
|
|
67
|
-
KXBTC15M: 'Bitcoin',
|
|
68
|
-
KXETHD: 'Ethereum',
|
|
69
|
-
KXETH: 'Ethereum',
|
|
70
|
-
KXETH15M: 'Ethereum',
|
|
71
|
-
KXU3: 'Unemployment',
|
|
72
|
-
KXPAYROLLS: 'Jobs',
|
|
73
|
-
KXGDP: 'GDP',
|
|
74
|
-
KXTNOTEW: 'Treasury',
|
|
75
|
-
KXTNOTED: 'Treasury',
|
|
76
|
-
KXCLOSEHORMUZ: 'Hormuz',
|
|
77
|
-
KXHORMUZTRAFFICW: 'Hormuz',
|
|
78
|
-
KXHORMUZTRAFFIC: 'Hormuz',
|
|
79
|
-
KXUSDJPY: 'USD/JPY',
|
|
80
|
-
KXGOVSHUT: 'Govt Shutdown',
|
|
81
|
-
KXGOVTSHUTDOWN: 'Govt Shutdown',
|
|
82
|
-
PRES: 'Elections',
|
|
83
|
-
KXFEDCHAIRNOM: 'Elections',
|
|
84
|
-
KXTARIFFRATEPRC: 'Tariffs',
|
|
85
|
-
KXCBDECISIONJAPAN: 'Central Banks',
|
|
86
|
-
KXCBDECISIONENGLAND: 'Central Banks',
|
|
87
|
-
KXCBDECISIONEU: 'Central Banks',
|
|
88
|
-
};
|
|
89
|
-
/**
|
|
90
|
-
* Given a ticker string, return the topic name (uppercased).
|
|
91
|
-
* Matches longest prefix first to avoid ambiguity (e.g. KXWTIMAX before KXWTI).
|
|
92
|
-
*/
|
|
93
|
-
function tickerToTopic(ticker) {
|
|
94
|
-
const sorted = Object.entries(exports.TOPIC_SERIES)
|
|
95
|
-
.flatMap(([topic, series]) => series.map(s => ({ prefix: s, topic })))
|
|
96
|
-
.sort((a, b) => b.prefix.length - a.prefix.length);
|
|
97
|
-
for (const { prefix, topic } of sorted) {
|
|
98
|
-
if (ticker.toUpperCase().startsWith(prefix))
|
|
99
|
-
return topic.toUpperCase();
|
|
100
|
-
}
|
|
101
|
-
return 'OTHER';
|
|
102
|
-
}
|
package/dist/topics.test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/topics.test.js
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const vitest_1 = require("vitest");
|
|
4
|
-
const topics_js_1 = require("./topics.js");
|
|
5
|
-
(0, vitest_1.describe)('tickerToTopic', () => {
|
|
6
|
-
(0, vitest_1.it)('matches oil tickers (longest prefix first)', () => {
|
|
7
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('KXWTIMAX-26DEC31-T135')).toBe('OIL');
|
|
8
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('KXWTID-something')).toBe('OIL');
|
|
9
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('KXWTIW-2026')).toBe('OIL');
|
|
10
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('KXWTI-26MAR24-T100')).toBe('OIL');
|
|
11
|
-
});
|
|
12
|
-
(0, vitest_1.it)('matches recession', () => {
|
|
13
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('KXRECSSNBER-26')).toBe('RECESSION');
|
|
14
|
-
});
|
|
15
|
-
(0, vitest_1.it)('matches fed', () => {
|
|
16
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('KXFEDDECISION-2026')).toBe('FED');
|
|
17
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('KXFED-something')).toBe('FED');
|
|
18
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('KXRATECUT-2026')).toBe('FED');
|
|
19
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('KXRATECUTCOUNT-2026')).toBe('FED');
|
|
20
|
-
});
|
|
21
|
-
(0, vitest_1.it)('matches cpi', () => {
|
|
22
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('KXCPI-26MAY-T0.4')).toBe('CPI');
|
|
23
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('KXCPIYOY-2026')).toBe('CPI');
|
|
24
|
-
});
|
|
25
|
-
(0, vitest_1.it)('matches gas', () => {
|
|
26
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('KXAAAGASM-26MAR31-4.40')).toBe('GAS');
|
|
27
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('KXAAAGASW-2026')).toBe('GAS');
|
|
28
|
-
});
|
|
29
|
-
(0, vitest_1.it)('matches sp500', () => {
|
|
30
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('KXINXY-26DEC31H1600-T4000')).toBe('SP500');
|
|
31
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('KXINXU-2026')).toBe('SP500');
|
|
32
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('KXINX-2026')).toBe('SP500');
|
|
33
|
-
});
|
|
34
|
-
(0, vitest_1.it)('matches nasdaq', () => {
|
|
35
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('KXNASDAQ100-2026')).toBe('NASDAQ');
|
|
36
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('KXNASDAQ100U-2026')).toBe('NASDAQ');
|
|
37
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('KXNASDAQ100Y-2026')).toBe('NASDAQ');
|
|
38
|
-
});
|
|
39
|
-
(0, vitest_1.it)('matches crypto', () => {
|
|
40
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('KXBTCD-2026')).toBe('CRYPTO');
|
|
41
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('KXBTC15M-2026')).toBe('CRYPTO');
|
|
42
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('KXBTCMAXY-2026')).toBe('CRYPTO');
|
|
43
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('KXETHD-2026')).toBe('CRYPTO');
|
|
44
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('KXETH15M-2026')).toBe('CRYPTO');
|
|
45
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('KXSOL15M-2026')).toBe('CRYPTO');
|
|
46
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('KXXRP15M-2026')).toBe('CRYPTO');
|
|
47
|
-
});
|
|
48
|
-
(0, vitest_1.it)('matches unemployment & jobs', () => {
|
|
49
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('KXU3-2026')).toBe('UNEMPLOYMENT');
|
|
50
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('KXPAYROLLS-2026')).toBe('UNEMPLOYMENT');
|
|
51
|
-
});
|
|
52
|
-
(0, vitest_1.it)('matches gdp', () => {
|
|
53
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('KXGDP-Q1-2026')).toBe('GDP');
|
|
54
|
-
});
|
|
55
|
-
(0, vitest_1.it)('matches geopolitics', () => {
|
|
56
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('KXCLOSEHORMUZ-2026')).toBe('GEOPOLITICS');
|
|
57
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('KXHORMUZTRAFFICW-26MAR')).toBe('GEOPOLITICS');
|
|
58
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('KXKHAMENEIOUT-2026')).toBe('GEOPOLITICS');
|
|
59
|
-
});
|
|
60
|
-
(0, vitest_1.it)('matches elections', () => {
|
|
61
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('PRES-2028')).toBe('ELECTIONS');
|
|
62
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('KXFEDCHAIRNOM-2026')).toBe('ELECTIONS');
|
|
63
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('KXTRUMPOUT-2026')).toBe('ELECTIONS');
|
|
64
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('KXNEXTPOPE-2026')).toBe('ELECTIONS');
|
|
65
|
-
});
|
|
66
|
-
(0, vitest_1.it)('matches politics', () => {
|
|
67
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('KXGOVSHUT-2026')).toBe('POLITICS');
|
|
68
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('KXGOVTSHUTDOWN-2026')).toBe('POLITICS');
|
|
69
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('KXGREENLAND-2026')).toBe('POLITICS');
|
|
70
|
-
});
|
|
71
|
-
(0, vitest_1.it)('matches central banks', () => {
|
|
72
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('KXCBDECISIONJAPAN-2026')).toBe('CENTRALBANKS');
|
|
73
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('KXCBDECISIONEU-2026')).toBe('CENTRALBANKS');
|
|
74
|
-
});
|
|
75
|
-
(0, vitest_1.it)('matches tariffs', () => {
|
|
76
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('KXTARIFFRATEPRC-2026')).toBe('TARIFFS');
|
|
77
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('KXTARIFFRATECA-2026')).toBe('TARIFFS');
|
|
78
|
-
});
|
|
79
|
-
(0, vitest_1.it)('matches treasury', () => {
|
|
80
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('KXTNOTEW-2026')).toBe('TREASURY');
|
|
81
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('KXTNOTED-2026')).toBe('TREASURY');
|
|
82
|
-
});
|
|
83
|
-
(0, vitest_1.it)('matches forex', () => {
|
|
84
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('KXUSDJPY-2026')).toBe('FOREX');
|
|
85
|
-
});
|
|
86
|
-
(0, vitest_1.it)('matches tech', () => {
|
|
87
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('KXLLM1-2026')).toBe('TECH');
|
|
88
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('KXTOPMODEL-2026')).toBe('TECH');
|
|
89
|
-
});
|
|
90
|
-
(0, vitest_1.it)('returns OTHER for unknown tickers', () => {
|
|
91
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('UNKNOWN-TICKER')).toBe('OTHER');
|
|
92
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('RANDOMSERIES-123')).toBe('OTHER');
|
|
93
|
-
});
|
|
94
|
-
(0, vitest_1.it)('is case-insensitive', () => {
|
|
95
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('kxwtimax-lower')).toBe('OIL');
|
|
96
|
-
(0, vitest_1.expect)((0, topics_js_1.tickerToTopic)('kxbtcd-lower')).toBe('CRYPTO');
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
(0, vitest_1.describe)('TOPIC_SERIES', () => {
|
|
100
|
-
(0, vitest_1.it)('has all expected topics', () => {
|
|
101
|
-
const topics = Object.keys(topics_js_1.TOPIC_SERIES);
|
|
102
|
-
(0, vitest_1.expect)(topics).toEqual(vitest_1.expect.arrayContaining([
|
|
103
|
-
'oil', 'gas', 'fed', 'cpi', 'recession', 'sp500', 'nasdaq',
|
|
104
|
-
'crypto', 'unemployment', 'gdp', 'treasury', 'geopolitics',
|
|
105
|
-
'elections', 'politics', 'centralbanks', 'forex', 'tariffs', 'tech',
|
|
106
|
-
]));
|
|
107
|
-
});
|
|
108
|
-
(0, vitest_1.it)('has at least 18 topics', () => {
|
|
109
|
-
(0, vitest_1.expect)(Object.keys(topics_js_1.TOPIC_SERIES).length).toBeGreaterThanOrEqual(18);
|
|
110
|
-
});
|
|
111
|
-
(0, vitest_1.it)('each topic has at least one series', () => {
|
|
112
|
-
for (const [, series] of Object.entries(topics_js_1.TOPIC_SERIES)) {
|
|
113
|
-
(0, vitest_1.expect)(series.length).toBeGreaterThan(0);
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
});
|
|
117
|
-
(0, vitest_1.describe)('RISK_CATEGORIES', () => {
|
|
118
|
-
(0, vitest_1.it)('maps oil series to Oil', () => {
|
|
119
|
-
(0, vitest_1.expect)(topics_js_1.RISK_CATEGORIES['KXWTIMAX']).toBe('Oil');
|
|
120
|
-
(0, vitest_1.expect)(topics_js_1.RISK_CATEGORIES['KXWTI']).toBe('Oil');
|
|
121
|
-
});
|
|
122
|
-
(0, vitest_1.it)('maps crypto series', () => {
|
|
123
|
-
(0, vitest_1.expect)(topics_js_1.RISK_CATEGORIES['KXBTCD']).toBe('Bitcoin');
|
|
124
|
-
(0, vitest_1.expect)(topics_js_1.RISK_CATEGORIES['KXETHD']).toBe('Ethereum');
|
|
125
|
-
});
|
|
126
|
-
(0, vitest_1.it)('maps financial series', () => {
|
|
127
|
-
(0, vitest_1.expect)(topics_js_1.RISK_CATEGORIES['KXINXY']).toBe('S&P 500');
|
|
128
|
-
(0, vitest_1.expect)(topics_js_1.RISK_CATEGORIES['KXNASDAQ100']).toBe('Nasdaq');
|
|
129
|
-
(0, vitest_1.expect)(topics_js_1.RISK_CATEGORIES['KXFEDDECISION']).toBe('Fed Rate');
|
|
130
|
-
});
|
|
131
|
-
});
|
package/dist/tui/border.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Border drawing — thin box-drawing characters
|
|
3
|
-
*/
|
|
4
|
-
import type { ScreenBuffer } from './screen.js';
|
|
5
|
-
import type { Region } from './layout.js';
|
|
6
|
-
export declare const rgb: (r: number, g: number, b: number) => string;
|
|
7
|
-
export declare const bgRgb: (r: number, g: number, b: number) => string;
|
|
8
|
-
export declare const CLR: {
|
|
9
|
-
border: string;
|
|
10
|
-
borderDim: string;
|
|
11
|
-
title: string;
|
|
12
|
-
text: string;
|
|
13
|
-
dim: string;
|
|
14
|
-
veryDim: string;
|
|
15
|
-
emerald: string;
|
|
16
|
-
green: string;
|
|
17
|
-
red: string;
|
|
18
|
-
yellow: string;
|
|
19
|
-
white: string;
|
|
20
|
-
bg: string;
|
|
21
|
-
bgPanel: string;
|
|
22
|
-
};
|
|
23
|
-
/** Draw a bordered box with title */
|
|
24
|
-
export declare function drawBorder(screen: ScreenBuffer, region: Region, title?: string): void;
|
|
25
|
-
/** Draw a horizontal divider across a region at a relative row */
|
|
26
|
-
export declare function drawHDivider(screen: ScreenBuffer, region: Region, relRow: number): void;
|
|
27
|
-
/** Pad/truncate string to exact width */
|
|
28
|
-
export declare function fit(s: string, width: number, align?: 'left' | 'right'): string;
|
|
29
|
-
/** Build sparkline from values */
|
|
30
|
-
export declare function sparkline(values: number[], colorFn?: (v: number) => string): Array<{
|
|
31
|
-
text: string;
|
|
32
|
-
fg?: string;
|
|
33
|
-
}>;
|
package/dist/tui/border.js
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Border drawing — thin box-drawing characters
|
|
4
|
-
*/
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.CLR = exports.bgRgb = exports.rgb = void 0;
|
|
7
|
-
exports.drawBorder = drawBorder;
|
|
8
|
-
exports.drawHDivider = drawHDivider;
|
|
9
|
-
exports.fit = fit;
|
|
10
|
-
exports.sparkline = sparkline;
|
|
11
|
-
// 24-bit RGB ANSI helpers
|
|
12
|
-
const rgb = (r, g, b) => `\x1b[38;2;${r};${g};${b}m`;
|
|
13
|
-
exports.rgb = rgb;
|
|
14
|
-
const bgRgb = (r, g, b) => `\x1b[48;2;${r};${g};${b}m`;
|
|
15
|
-
exports.bgRgb = bgRgb;
|
|
16
|
-
// Color palette (matching landing page: emerald on near-black)
|
|
17
|
-
exports.CLR = {
|
|
18
|
-
border: (0, exports.rgb)(63, 63, 70), // zinc-700
|
|
19
|
-
borderDim: (0, exports.rgb)(39, 39, 42), // zinc-800
|
|
20
|
-
title: (0, exports.rgb)(161, 161, 170), // zinc-400
|
|
21
|
-
text: (0, exports.rgb)(212, 212, 216), // zinc-300
|
|
22
|
-
dim: (0, exports.rgb)(113, 113, 122), // zinc-500
|
|
23
|
-
veryDim: (0, exports.rgb)(63, 63, 70), // zinc-700
|
|
24
|
-
emerald: (0, exports.rgb)(16, 185, 129), // emerald-500
|
|
25
|
-
green: (0, exports.rgb)(52, 211, 153), // emerald-400
|
|
26
|
-
red: (0, exports.rgb)(239, 68, 68), // red-500
|
|
27
|
-
yellow: (0, exports.rgb)(250, 204, 21), // yellow-400
|
|
28
|
-
white: (0, exports.rgb)(244, 244, 245), // zinc-100
|
|
29
|
-
bg: (0, exports.bgRgb)(10, 10, 10), // #0a0a0a
|
|
30
|
-
bgPanel: (0, exports.bgRgb)(13, 13, 13), // #0d0d0d
|
|
31
|
-
};
|
|
32
|
-
/** Draw a bordered box with title */
|
|
33
|
-
function drawBorder(screen, region, title) {
|
|
34
|
-
const { row, col, width, height } = region;
|
|
35
|
-
if (width < 3 || height < 3)
|
|
36
|
-
return;
|
|
37
|
-
const fg = exports.CLR.borderDim;
|
|
38
|
-
// Top
|
|
39
|
-
screen.write(row, col, '┌', fg);
|
|
40
|
-
for (let c = col + 1; c < col + width - 1; c++)
|
|
41
|
-
screen.write(row, c, '─', fg);
|
|
42
|
-
screen.write(row, col + width - 1, '┐', fg);
|
|
43
|
-
// Title
|
|
44
|
-
if (title) {
|
|
45
|
-
screen.write(row, col + 2, ` ${title} `, exports.CLR.title);
|
|
46
|
-
}
|
|
47
|
-
// Sides
|
|
48
|
-
for (let r = row + 1; r < row + height - 1; r++) {
|
|
49
|
-
screen.write(r, col, '│', fg);
|
|
50
|
-
screen.write(r, col + width - 1, '│', fg);
|
|
51
|
-
}
|
|
52
|
-
// Bottom
|
|
53
|
-
screen.write(row + height - 1, col, '└', fg);
|
|
54
|
-
for (let c = col + 1; c < col + width - 1; c++)
|
|
55
|
-
screen.write(row + height - 1, c, '─', fg);
|
|
56
|
-
screen.write(row + height - 1, col + width - 1, '┘', fg);
|
|
57
|
-
}
|
|
58
|
-
/** Draw a horizontal divider across a region at a relative row */
|
|
59
|
-
function drawHDivider(screen, region, relRow) {
|
|
60
|
-
const r = region.row + relRow;
|
|
61
|
-
const fg = exports.CLR.borderDim;
|
|
62
|
-
screen.write(r, region.col, '├', fg);
|
|
63
|
-
for (let c = region.col + 1; c < region.col + region.width - 1; c++)
|
|
64
|
-
screen.write(r, c, '─', fg);
|
|
65
|
-
screen.write(r, region.col + region.width - 1, '┤', fg);
|
|
66
|
-
}
|
|
67
|
-
/** Pad/truncate string to exact width */
|
|
68
|
-
function fit(s, width, align = 'left') {
|
|
69
|
-
if (s.length > width)
|
|
70
|
-
return s.slice(0, width - 1) + '…';
|
|
71
|
-
if (align === 'right')
|
|
72
|
-
return s.padStart(width);
|
|
73
|
-
return s.padEnd(width);
|
|
74
|
-
}
|
|
75
|
-
/** Build sparkline from values */
|
|
76
|
-
function sparkline(values, colorFn) {
|
|
77
|
-
if (values.length === 0)
|
|
78
|
-
return [];
|
|
79
|
-
const min = Math.min(...values);
|
|
80
|
-
const max = Math.max(...values);
|
|
81
|
-
const range = max - min || 1;
|
|
82
|
-
const blocks = '▁▂▃▄▅▆▇█';
|
|
83
|
-
return values.map(v => {
|
|
84
|
-
const idx = Math.round(((v - min) / range) * 7);
|
|
85
|
-
return { text: blocks[idx], fg: colorFn ? colorFn(v) : exports.CLR.dim };
|
|
86
|
-
});
|
|
87
|
-
}
|
package/dist/tui/chart.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ASCII area chart using block characters
|
|
3
|
-
*
|
|
4
|
-
* Uses ▁▂▃▄▅▆▇█ to draw a filled area chart that fills the width.
|
|
5
|
-
* Much cleaner than box-drawing line charts for small datasets.
|
|
6
|
-
*/
|
|
7
|
-
import type { ScreenBuffer } from './screen.js';
|
|
8
|
-
/**
|
|
9
|
-
* Draw an area chart at the given position.
|
|
10
|
-
*
|
|
11
|
-
* @param screen - ScreenBuffer to write to
|
|
12
|
-
* @param row - Top-left row of chart area
|
|
13
|
-
* @param col - Left column (after Y-axis labels)
|
|
14
|
-
* @param width - Total width including Y-axis labels
|
|
15
|
-
* @param height - Total height including X-axis row
|
|
16
|
-
* @param values - Data points (raw numbers)
|
|
17
|
-
* @param labels - Optional X-axis labels
|
|
18
|
-
*/
|
|
19
|
-
export declare function drawChart(screen: ScreenBuffer, row: number, col: number, width: number, height: number, values: number[], labels?: string[]): void;
|
package/dist/tui/chart.js
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* ASCII area chart using block characters
|
|
4
|
-
*
|
|
5
|
-
* Uses ▁▂▃▄▅▆▇█ to draw a filled area chart that fills the width.
|
|
6
|
-
* Much cleaner than box-drawing line charts for small datasets.
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.drawChart = drawChart;
|
|
10
|
-
const border_js_1 = require("./border.js");
|
|
11
|
-
/**
|
|
12
|
-
* Draw an area chart at the given position.
|
|
13
|
-
*
|
|
14
|
-
* @param screen - ScreenBuffer to write to
|
|
15
|
-
* @param row - Top-left row of chart area
|
|
16
|
-
* @param col - Left column (after Y-axis labels)
|
|
17
|
-
* @param width - Total width including Y-axis labels
|
|
18
|
-
* @param height - Total height including X-axis row
|
|
19
|
-
* @param values - Data points (raw numbers)
|
|
20
|
-
* @param labels - Optional X-axis labels
|
|
21
|
-
*/
|
|
22
|
-
function drawChart(screen, row, col, width, height, values, labels) {
|
|
23
|
-
if (values.length === 0 || width < 10 || height < 4)
|
|
24
|
-
return;
|
|
25
|
-
const yLabelWidth = 8;
|
|
26
|
-
const chartWidth = width - yLabelWidth - 1;
|
|
27
|
-
const chartHeight = height - 2; // reserve bottom for x-axis + labels
|
|
28
|
-
if (chartWidth < 4 || chartHeight < 2)
|
|
29
|
-
return;
|
|
30
|
-
const min = Math.min(...values);
|
|
31
|
-
const max = Math.max(...values);
|
|
32
|
-
const range = max - min || 1;
|
|
33
|
-
// Interpolate values to fill chart width
|
|
34
|
-
const interpolated = [];
|
|
35
|
-
for (let c = 0; c < chartWidth; c++) {
|
|
36
|
-
const t = (c / (chartWidth - 1)) * (values.length - 1);
|
|
37
|
-
const lo = Math.floor(t);
|
|
38
|
-
const hi = Math.min(lo + 1, values.length - 1);
|
|
39
|
-
const frac = t - lo;
|
|
40
|
-
interpolated.push(values[lo] * (1 - frac) + values[hi] * frac);
|
|
41
|
-
}
|
|
42
|
-
// Y-axis: show 3 labels (top, zero if in range, bottom)
|
|
43
|
-
const chartCol = col + yLabelWidth + 1;
|
|
44
|
-
const yLabels = [
|
|
45
|
-
{ row: 0, value: max },
|
|
46
|
-
{ row: chartHeight - 1, value: min },
|
|
47
|
-
];
|
|
48
|
-
// Add zero line if range crosses zero
|
|
49
|
-
let zeroChartRow = -1;
|
|
50
|
-
if (min < 0 && max > 0) {
|
|
51
|
-
zeroChartRow = Math.round((max / range) * (chartHeight - 1));
|
|
52
|
-
if (zeroChartRow > 0 && zeroChartRow < chartHeight - 1) {
|
|
53
|
-
yLabels.push({ row: zeroChartRow, value: 0 });
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
// Draw Y-axis
|
|
57
|
-
for (let r = 0; r < chartHeight; r++) {
|
|
58
|
-
screen.write(row + r, col + yLabelWidth, '│', border_js_1.CLR.borderDim);
|
|
59
|
-
}
|
|
60
|
-
for (const yl of yLabels) {
|
|
61
|
-
const fmt = Math.abs(yl.value) >= 100
|
|
62
|
-
? `$${(yl.value >= 0 ? '+' : '') + yl.value.toFixed(0)}`
|
|
63
|
-
: `$${(yl.value >= 0 ? '+' : '') + yl.value.toFixed(1)}`;
|
|
64
|
-
screen.write(row + yl.row, col, fmt.padStart(yLabelWidth), border_js_1.CLR.dim);
|
|
65
|
-
}
|
|
66
|
-
// Zero line (dashed)
|
|
67
|
-
if (zeroChartRow >= 0 && zeroChartRow < chartHeight) {
|
|
68
|
-
for (let c = 0; c < chartWidth; c++) {
|
|
69
|
-
screen.write(row + zeroChartRow, chartCol + c, '╌', border_js_1.CLR.veryDim);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
// Draw area chart using block characters
|
|
73
|
-
// Each column: compute how high the bar should go
|
|
74
|
-
const blocks = ' ▁▂▃▄▅▆▇█';
|
|
75
|
-
for (let c = 0; c < chartWidth; c++) {
|
|
76
|
-
const val = interpolated[c];
|
|
77
|
-
// Normalize to 0..1 (0=min, 1=max)
|
|
78
|
-
const norm = (val - min) / range;
|
|
79
|
-
// Height in sub-rows (chartHeight * 8 granularity levels)
|
|
80
|
-
const barHeight = norm * chartHeight * 8;
|
|
81
|
-
const color = val >= 0 ? border_js_1.CLR.green : border_js_1.CLR.red;
|
|
82
|
-
// Fill from bottom up
|
|
83
|
-
for (let r = chartHeight - 1; r >= 0; r--) {
|
|
84
|
-
const rowFromBottom = chartHeight - 1 - r;
|
|
85
|
-
const fillLevel = barHeight - rowFromBottom * 8;
|
|
86
|
-
if (fillLevel >= 8) {
|
|
87
|
-
// Full block
|
|
88
|
-
screen.write(row + r, chartCol + c, '█', color);
|
|
89
|
-
}
|
|
90
|
-
else if (fillLevel > 0) {
|
|
91
|
-
// Partial block
|
|
92
|
-
const idx = Math.round(Math.max(1, Math.min(fillLevel, 8)));
|
|
93
|
-
screen.write(row + r, chartCol + c, blocks[idx], color);
|
|
94
|
-
}
|
|
95
|
-
// else: empty (space), already default
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
// X-axis
|
|
99
|
-
const xRow = row + chartHeight;
|
|
100
|
-
screen.write(xRow, col + yLabelWidth, '└', border_js_1.CLR.borderDim);
|
|
101
|
-
for (let c = 0; c < chartWidth; c++) {
|
|
102
|
-
screen.write(xRow, chartCol + c, '─', border_js_1.CLR.borderDim);
|
|
103
|
-
}
|
|
104
|
-
// X-axis labels
|
|
105
|
-
if (labels && labels.length > 0) {
|
|
106
|
-
const labelRow = row + chartHeight + 1;
|
|
107
|
-
const numLabels = Math.min(labels.length, 6);
|
|
108
|
-
for (let i = 0; i < numLabels; i++) {
|
|
109
|
-
const srcIdx = Math.round(i * (labels.length - 1) / Math.max(numLabels - 1, 1));
|
|
110
|
-
const xPos = chartCol + Math.round(srcIdx * (chartWidth - 1) / Math.max(labels.length - 1, 1));
|
|
111
|
-
const label = labels[srcIdx] || '';
|
|
112
|
-
if (xPos >= chartCol && xPos + label.length < col + width) {
|
|
113
|
-
screen.write(labelRow, xPos, label.slice(0, 5), border_js_1.CLR.dim);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
package/dist/tui/dashboard.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TUI Dashboard Engine — main loop
|
|
3
|
-
*
|
|
4
|
-
* Manages the render loop, data loading, keypress handling, and mode transitions.
|
|
5
|
-
* This is NOT the commander entry point — see commands/dashboard.ts for that.
|
|
6
|
-
*/
|
|
7
|
-
import { type DashboardState } from './state.js';
|
|
8
|
-
export declare function loadAllData(state: DashboardState): Promise<void>;
|
|
9
|
-
export declare function startDashboard(): Promise<void>;
|