@spfunctions/cli 1.7.19 → 1.7.20
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
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.evaluateCommand = evaluateCommand;
|
|
4
|
-
const client_js_1 = require("../client.js");
|
|
5
|
-
const utils_js_1 = require("../utils.js");
|
|
6
|
-
async function evaluateCommand(id, opts) {
|
|
7
|
-
const client = new client_js_1.SFClient(opts.apiKey, opts.apiUrl);
|
|
8
|
-
console.log(`${utils_js_1.c.dim}Triggering deep evaluation (heavy model)...${utils_js_1.c.reset}`);
|
|
9
|
-
const result = await client.evaluate(id);
|
|
10
|
-
console.log(`\n${utils_js_1.c.green}✓${utils_js_1.c.reset} Evaluation complete`);
|
|
11
|
-
if (result.evaluation) {
|
|
12
|
-
const ev = result.evaluation;
|
|
13
|
-
if (ev.confidenceDelta !== undefined) {
|
|
14
|
-
const d = ev.confidenceDelta;
|
|
15
|
-
const dColor = d > 0 ? utils_js_1.c.green : d < 0 ? utils_js_1.c.red : utils_js_1.c.dim;
|
|
16
|
-
console.log(` ${utils_js_1.c.bold}Confidence:${utils_js_1.c.reset} ${(0, utils_js_1.pct)(ev.previousConfidence)} → ${(0, utils_js_1.pct)(ev.newConfidence)} ${dColor}(${(0, utils_js_1.delta)(d)})${utils_js_1.c.reset}`);
|
|
17
|
-
}
|
|
18
|
-
if (ev.summary) {
|
|
19
|
-
console.log(`\n ${ev.summary}`);
|
|
20
|
-
}
|
|
21
|
-
if (ev.positionUpdates && ev.positionUpdates.length > 0) {
|
|
22
|
-
console.log(`\n ${utils_js_1.c.bold}Position Recommendations:${utils_js_1.c.reset}`);
|
|
23
|
-
for (const pu of ev.positionUpdates) {
|
|
24
|
-
const recColor = pu.recommendation === 'hold' ? utils_js_1.c.dim : pu.recommendation === 'close' ? utils_js_1.c.red : utils_js_1.c.yellow;
|
|
25
|
-
console.log(` [${pu.positionId.slice(0, 8)}] ${recColor}${pu.recommendation}${utils_js_1.c.reset} — ${pu.reason}`);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
console.log('');
|
|
30
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* sf explore [slug]
|
|
3
|
-
*
|
|
4
|
-
* Browse public theses. No authentication required.
|
|
5
|
-
*
|
|
6
|
-
* Usage:
|
|
7
|
-
* sf explore — List all public theses
|
|
8
|
-
* sf explore us-iran-war — View a specific public thesis
|
|
9
|
-
* sf explore us-iran-war --json — JSON output (for agents)
|
|
10
|
-
*/
|
|
11
|
-
export declare function exploreCommand(slug?: string, opts?: {
|
|
12
|
-
json?: boolean;
|
|
13
|
-
share?: boolean;
|
|
14
|
-
}): Promise<void>;
|
package/dist/commands/explore.js
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* sf explore [slug]
|
|
4
|
-
*
|
|
5
|
-
* Browse public theses. No authentication required.
|
|
6
|
-
*
|
|
7
|
-
* Usage:
|
|
8
|
-
* sf explore — List all public theses
|
|
9
|
-
* sf explore us-iran-war — View a specific public thesis
|
|
10
|
-
* sf explore us-iran-war --json — JSON output (for agents)
|
|
11
|
-
*/
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.exploreCommand = exploreCommand;
|
|
14
|
-
const share_js_1 = require("../share.js");
|
|
15
|
-
const utils_js_1 = require("../utils.js");
|
|
16
|
-
const BASE_URL = 'https://simplefunctions.dev';
|
|
17
|
-
async function exploreCommand(slug, opts) {
|
|
18
|
-
if (!slug) {
|
|
19
|
-
// List all public theses
|
|
20
|
-
const res = await fetch(`${BASE_URL}/api/public/theses`);
|
|
21
|
-
if (!res.ok) {
|
|
22
|
-
console.error(` Error: ${res.status} ${await res.text()}`);
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
const { theses } = await res.json();
|
|
26
|
-
if (opts?.share) {
|
|
27
|
-
await (0, share_js_1.shareOutput)('explore', '', { theses });
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
if (opts?.json) {
|
|
31
|
-
console.log(JSON.stringify(theses, null, 2));
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
console.log('\n Public Theses\n');
|
|
35
|
-
if (theses.length === 0) {
|
|
36
|
-
console.log(` ${utils_js_1.c.dim}No public theses yet. Publish yours: sf publish <id>${utils_js_1.c.reset}\n`);
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
for (const t of theses) {
|
|
40
|
-
const conf = t.confidence != null ? Math.round(t.confidence * 100) : '?';
|
|
41
|
-
const ret = t.impliedReturn != null ? `${t.impliedReturn > 0 ? '+' : ''}${t.impliedReturn}%` : '';
|
|
42
|
-
console.log(` ${(t.slug || '').padEnd(35)} ${String(conf).padStart(3)}% ${ret.padStart(8)} ${(t.status || '').padEnd(8)} ${(t.title || '').slice(0, 45)}`);
|
|
43
|
-
}
|
|
44
|
-
console.log(`\n ${theses.length} public theses. Use: sf explore <slug>\n`);
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
// View a specific public thesis
|
|
48
|
-
const res = await fetch(`${BASE_URL}/api/public/thesis/${slug}`);
|
|
49
|
-
if (!res.ok) {
|
|
50
|
-
if (res.status === 404) {
|
|
51
|
-
console.error(` Not found: ${slug}`);
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
console.error(` Error: ${res.status} ${await res.text()}`);
|
|
55
|
-
}
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
const data = await res.json();
|
|
59
|
-
if (opts?.json) {
|
|
60
|
-
console.log(JSON.stringify(data, null, 2));
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
// Formatted output
|
|
64
|
-
const t = data.thesis;
|
|
65
|
-
const ir = data.impliedReturns;
|
|
66
|
-
console.log(`\n ${t.title}`);
|
|
67
|
-
console.log(` ${t.slug} | ${t.confidence != null ? Math.round(t.confidence * 100) : '?'}% | ${t.status} | published ${t.publishedAt?.slice(0, 10) || '?'}`);
|
|
68
|
-
if (t.description)
|
|
69
|
-
console.log(` ${t.description}`);
|
|
70
|
-
console.log('');
|
|
71
|
-
// Causal tree
|
|
72
|
-
if (data.causalTree?.nodes?.length) {
|
|
73
|
-
console.log(' Causal Tree');
|
|
74
|
-
for (const n of data.causalTree.nodes) {
|
|
75
|
-
const bar = '█'.repeat(Math.round((n.probability || 0) * 10)) + '░'.repeat(10 - Math.round((n.probability || 0) * 10));
|
|
76
|
-
console.log(` ${n.id} ${(n.label || '').slice(0, 35).padEnd(35)} ${Math.round((n.probability || 0) * 100)}% ${bar}`);
|
|
77
|
-
if (n.children) {
|
|
78
|
-
for (const c of n.children) {
|
|
79
|
-
const cbar = '█'.repeat(Math.round((c.probability || 0) * 10)) + '░'.repeat(10 - Math.round((c.probability || 0) * 10));
|
|
80
|
-
console.log(` ${c.id} ${(c.label || '').slice(0, 33).padEnd(33)} ${Math.round((c.probability || 0) * 100)}% ${cbar}`);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
console.log('');
|
|
85
|
-
}
|
|
86
|
-
// Implied returns
|
|
87
|
-
if (ir && ir.edges?.length > 0) {
|
|
88
|
-
console.log(` Implied Returns (equal-weight, since ${ir.trackedSince?.slice(0, 10) || '?'})`);
|
|
89
|
-
console.log(` Avg: ${ir.avgReturnPct > 0 ? '+' : ''}${ir.avgReturnPct}% | Win rate: ${ir.winRate}% (${ir.winners}W ${ir.losers}L)`);
|
|
90
|
-
console.log('');
|
|
91
|
-
for (const e of ir.edges.slice(0, 10)) {
|
|
92
|
-
const ret = e.returnPct > 0 ? `+${e.returnPct}%` : `${e.returnPct}%`;
|
|
93
|
-
console.log(` ${(e.market || '').slice(0, 35).padEnd(35)} ${e.entryPrice}¢ → ${e.currentPrice}¢ ${ret}`);
|
|
94
|
-
}
|
|
95
|
-
console.log('');
|
|
96
|
-
}
|
|
97
|
-
// Recent evaluations
|
|
98
|
-
if (data.confidenceHistory?.length > 0) {
|
|
99
|
-
console.log(' Recent Evaluations');
|
|
100
|
-
for (const h of data.confidenceHistory.slice(-5)) {
|
|
101
|
-
const d = h.delta > 0 ? `+${Math.round(h.delta * 100)}` : `${Math.round(h.delta * 100)}`;
|
|
102
|
-
console.log(` ${(h.evaluatedAt || '').slice(0, 16)} ${Math.round(h.confidence * 100)}% (${d}) ${(h.summary || '').slice(0, 60)}`);
|
|
103
|
-
}
|
|
104
|
-
console.log('');
|
|
105
|
-
}
|
|
106
|
-
// Top edges
|
|
107
|
-
if (data.edges?.length > 0) {
|
|
108
|
-
console.log(' Top Edges');
|
|
109
|
-
const sorted = [...data.edges].sort((a, b) => Math.abs(b.edge) - Math.abs(a.edge)).slice(0, 10);
|
|
110
|
-
for (const e of sorted) {
|
|
111
|
-
const liq = e.orderbook?.liquidityScore || '?';
|
|
112
|
-
console.log(` ${(e.market || '').slice(0, 35).padEnd(35)} ${e.marketPrice}¢ → ${e.thesisPrice}¢ edge ${e.edge > 0 ? '+' : ''}${e.edge} ${liq}`);
|
|
113
|
-
}
|
|
114
|
-
console.log('');
|
|
115
|
-
}
|
|
116
|
-
}
|
package/dist/commands/feed.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* sf feed — Evaluation history stream.
|
|
3
|
-
*
|
|
4
|
-
* Shows what the heartbeat engine has been thinking.
|
|
5
|
-
* One line per evaluation cycle, newest first.
|
|
6
|
-
*/
|
|
7
|
-
export declare function feedCommand(opts: {
|
|
8
|
-
hours?: string;
|
|
9
|
-
thesis?: string;
|
|
10
|
-
json?: boolean;
|
|
11
|
-
apiKey?: string;
|
|
12
|
-
apiUrl?: string;
|
|
13
|
-
}): Promise<void>;
|
package/dist/commands/feed.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* sf feed — Evaluation history stream.
|
|
4
|
-
*
|
|
5
|
-
* Shows what the heartbeat engine has been thinking.
|
|
6
|
-
* One line per evaluation cycle, newest first.
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.feedCommand = feedCommand;
|
|
10
|
-
const client_js_1 = require("../client.js");
|
|
11
|
-
const utils_js_1 = require("../utils.js");
|
|
12
|
-
async function feedCommand(opts) {
|
|
13
|
-
const client = new client_js_1.SFClient(opts.apiKey, opts.apiUrl);
|
|
14
|
-
const hours = parseInt(opts.hours || '24');
|
|
15
|
-
const data = await client.getFeed(hours, 200);
|
|
16
|
-
let feed = data.feed || [];
|
|
17
|
-
if (feed.length === 0) {
|
|
18
|
-
console.log(`${utils_js_1.c.dim}No evaluations in the last ${hours} hours.${utils_js_1.c.reset}`);
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
// Filter by thesis if specified
|
|
22
|
-
if (opts.thesis) {
|
|
23
|
-
feed = feed.filter((e) => e.thesisId.startsWith(opts.thesis) || e.thesisShortId === opts.thesis);
|
|
24
|
-
if (feed.length === 0) {
|
|
25
|
-
console.log(`${utils_js_1.c.dim}No evaluations for ${opts.thesis} in the last ${hours} hours.${utils_js_1.c.reset}`);
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
if (opts.json) {
|
|
30
|
-
console.log(JSON.stringify(feed, null, 2));
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
// Render feed
|
|
34
|
-
console.log();
|
|
35
|
-
console.log(`${utils_js_1.c.bold}${utils_js_1.c.cyan}Evaluation Feed${utils_js_1.c.reset}${utils_js_1.c.dim} — last ${hours}h, ${feed.length} cycles${utils_js_1.c.reset}`);
|
|
36
|
-
console.log(`${utils_js_1.c.dim}${'─'.repeat(75)}${utils_js_1.c.reset}`);
|
|
37
|
-
for (const entry of feed) {
|
|
38
|
-
const time = new Date(entry.evaluatedAt);
|
|
39
|
-
const timeStr = time.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
|
|
40
|
-
// Confidence + delta
|
|
41
|
-
const conf = Math.round(entry.confidence * 100);
|
|
42
|
-
const delta = Math.round(entry.delta * 100);
|
|
43
|
-
let deltaStr;
|
|
44
|
-
if (delta > 0) {
|
|
45
|
-
deltaStr = `${utils_js_1.c.green}+${delta}%${utils_js_1.c.reset}`;
|
|
46
|
-
}
|
|
47
|
-
else if (delta < 0) {
|
|
48
|
-
deltaStr = `${utils_js_1.c.red}${delta}%${utils_js_1.c.reset}`;
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
deltaStr = `${utils_js_1.c.dim}0%${utils_js_1.c.reset}`;
|
|
52
|
-
}
|
|
53
|
-
// Thesis ID (short)
|
|
54
|
-
const id = entry.thesisShortId || entry.thesisId?.slice(0, 8) || '?';
|
|
55
|
-
// Summary — truncate to fit one line
|
|
56
|
-
const summary = (entry.summary || 'No summary').replace(/\n/g, ' ').slice(0, 80);
|
|
57
|
-
// Node changes
|
|
58
|
-
const nodes = entry.updatedNodes || [];
|
|
59
|
-
const nodeStr = nodes.length > 0
|
|
60
|
-
? nodes.slice(0, 3).map((n) => `${n.nodeId}→${Math.round((n.newProb || 0) * 100)}%`).join(', ')
|
|
61
|
-
: '';
|
|
62
|
-
// Format line
|
|
63
|
-
console.log(`${utils_js_1.c.dim}[${timeStr}]${utils_js_1.c.reset} ` +
|
|
64
|
-
`${utils_js_1.c.cyan}${id}${utils_js_1.c.reset} ` +
|
|
65
|
-
`${conf}% (${deltaStr}) ` +
|
|
66
|
-
`${utils_js_1.c.dim}${summary}${utils_js_1.c.reset}`);
|
|
67
|
-
if (nodeStr) {
|
|
68
|
-
console.log(`${' '.repeat(9)} ${utils_js_1.c.dim}nodes: ${nodeStr}${utils_js_1.c.reset}`);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
console.log(`${utils_js_1.c.dim}${'─'.repeat(75)}${utils_js_1.c.reset}`);
|
|
72
|
-
console.log();
|
|
73
|
-
}
|
package/dist/commands/fills.d.ts
DELETED
package/dist/commands/fills.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fillsCommand = fillsCommand;
|
|
4
|
-
const kalshi_js_1 = require("../kalshi.js");
|
|
5
|
-
const utils_js_1 = require("../utils.js");
|
|
6
|
-
async function fillsCommand(opts) {
|
|
7
|
-
const result = await (0, kalshi_js_1.getFills)({ ticker: opts.ticker, limit: 50 });
|
|
8
|
-
if (!result)
|
|
9
|
-
throw new Error('Kalshi not configured. Run: sf setup --kalshi');
|
|
10
|
-
if (opts.json) {
|
|
11
|
-
console.log(JSON.stringify(result.fills, null, 2));
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
if (result.fills.length === 0) {
|
|
15
|
-
console.log(`${utils_js_1.c.dim}No fills.${utils_js_1.c.reset}`);
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
console.log(`${utils_js_1.c.bold}${utils_js_1.c.cyan}Recent Fills${utils_js_1.c.reset}`);
|
|
19
|
-
console.log(`${utils_js_1.c.dim}${'─'.repeat(80)}${utils_js_1.c.reset}`);
|
|
20
|
-
for (const f of result.fills) {
|
|
21
|
-
const price = f.yes_price_dollars ? `${parseFloat(f.yes_price_dollars) * 100}¢` : `${f.yes_price || '?'}¢`;
|
|
22
|
-
const side = f.side === 'yes' ? `${utils_js_1.c.green}YES${utils_js_1.c.reset}` : `${utils_js_1.c.red}NO${utils_js_1.c.reset}`;
|
|
23
|
-
const action = f.action || 'buy';
|
|
24
|
-
const count = f.count_fp || f.count || '?';
|
|
25
|
-
const time = f.created_time ? new Date(f.created_time).toLocaleString() : '';
|
|
26
|
-
console.log(` ${(f.ticker || '').padEnd(35)} ${action.padEnd(5)} ${side} ${price.padEnd(8)} x${count} ${utils_js_1.c.dim}${time}${utils_js_1.c.reset}`);
|
|
27
|
-
}
|
|
28
|
-
console.log(`\n${utils_js_1.c.dim}${result.fills.length} fill(s)${utils_js_1.c.reset}`);
|
|
29
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.forecastCommand = forecastCommand;
|
|
4
|
-
const kalshi_js_1 = require("../kalshi.js");
|
|
5
|
-
const utils_js_1 = require("../utils.js");
|
|
6
|
-
const KALSHI_API_BASE = 'https://api.elections.kalshi.com/trade-api/v2';
|
|
7
|
-
async function forecastCommand(eventTicker, opts) {
|
|
8
|
-
const days = parseInt(opts.days || '7');
|
|
9
|
-
// Get series ticker from event
|
|
10
|
-
const evtRes = await fetch(`${KALSHI_API_BASE}/events/${eventTicker}`, {
|
|
11
|
-
headers: { 'Accept': 'application/json' },
|
|
12
|
-
});
|
|
13
|
-
if (!evtRes.ok)
|
|
14
|
-
throw new Error(`Event not found: ${eventTicker}`);
|
|
15
|
-
const evtData = await evtRes.json();
|
|
16
|
-
const seriesTicker = evtData.event?.series_ticker;
|
|
17
|
-
if (!seriesTicker)
|
|
18
|
-
throw new Error(`No series_ticker for ${eventTicker}`);
|
|
19
|
-
// Align timestamps to midnight UTC — Kalshi API rejects unaligned/future timestamps
|
|
20
|
-
const todayMidnight = new Date();
|
|
21
|
-
todayMidnight.setUTCHours(0, 0, 0, 0);
|
|
22
|
-
const endTs = Math.floor(todayMidnight.getTime() / 1000);
|
|
23
|
-
const startTs = endTs - days * 86400;
|
|
24
|
-
const history = await (0, kalshi_js_1.getForecastHistory)({
|
|
25
|
-
seriesTicker,
|
|
26
|
-
eventTicker,
|
|
27
|
-
percentiles: [5000, 7500, 9000],
|
|
28
|
-
startTs,
|
|
29
|
-
endTs,
|
|
30
|
-
periodInterval: 1440,
|
|
31
|
-
});
|
|
32
|
-
if (!history || history.length === 0) {
|
|
33
|
-
console.log(`${utils_js_1.c.dim}No forecast data for ${eventTicker}${utils_js_1.c.reset}`);
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
if (opts.json) {
|
|
37
|
-
console.log(JSON.stringify(history, null, 2));
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
console.log(`${utils_js_1.c.bold}${utils_js_1.c.cyan}Forecast: ${evtData.event?.title || eventTicker}${utils_js_1.c.reset}`);
|
|
41
|
-
console.log(`${utils_js_1.c.dim}Series: ${seriesTicker} | ${days} days${utils_js_1.c.reset}`);
|
|
42
|
-
console.log();
|
|
43
|
-
console.log(`${utils_js_1.c.bold}${'Date'.padEnd(14)} ${'P50'.padEnd(12)} ${'P75'.padEnd(12)} P90${utils_js_1.c.reset}`);
|
|
44
|
-
console.log(`${utils_js_1.c.dim}${'─'.repeat(52)}${utils_js_1.c.reset}`);
|
|
45
|
-
for (const point of history) {
|
|
46
|
-
const date = new Date(point.end_period_ts * 1000).toISOString().slice(0, 10);
|
|
47
|
-
const pts = point.percentile_points || [];
|
|
48
|
-
const p50 = pts.find((p) => p.percentile === 5000)?.formatted_forecast || '-';
|
|
49
|
-
const p75 = pts.find((p) => p.percentile === 7500)?.formatted_forecast || '-';
|
|
50
|
-
const p90 = pts.find((p) => p.percentile === 9000)?.formatted_forecast || '-';
|
|
51
|
-
console.log(` ${date.padEnd(14)} ${p50.padEnd(12)} ${p75.padEnd(12)} ${p90}`);
|
|
52
|
-
}
|
|
53
|
-
}
|
package/dist/commands/get.d.ts
DELETED
package/dist/commands/get.js
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getCommand = getCommand;
|
|
4
|
-
const client_js_1 = require("../client.js");
|
|
5
|
-
const utils_js_1 = require("../utils.js");
|
|
6
|
-
async function getCommand(id, opts) {
|
|
7
|
-
const client = new client_js_1.SFClient(opts.apiKey, opts.apiUrl);
|
|
8
|
-
// GET /api/thesis/:id returns { ...thesisRow, positions: [] }
|
|
9
|
-
// Fields are spread at top-level (NOT nested under .thesis)
|
|
10
|
-
const data = await client.getThesis(id);
|
|
11
|
-
if (opts.json) {
|
|
12
|
-
console.log(JSON.stringify(data, null, 2));
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
// data is the flat thesis row + positions array
|
|
16
|
-
const t = data; // thesis fields are at top level
|
|
17
|
-
const positions = data.positions || [];
|
|
18
|
-
(0, utils_js_1.header)(`Thesis: ${(t.id || id).slice(0, 8)}`);
|
|
19
|
-
(0, utils_js_1.hr)();
|
|
20
|
-
console.log(`${utils_js_1.c.bold}Status:${utils_js_1.c.reset} ${t.status || '-'}`);
|
|
21
|
-
const conf = t.confidence ? (0, utils_js_1.pct)(parseFloat(t.confidence)) : '-';
|
|
22
|
-
console.log(`${utils_js_1.c.bold}Confidence:${utils_js_1.c.reset} ${conf}`);
|
|
23
|
-
const createdAt = t.createdAt instanceof Date ? t.createdAt.toISOString() : t.createdAt;
|
|
24
|
-
const updatedAt = t.updatedAt instanceof Date ? t.updatedAt.toISOString() : t.updatedAt;
|
|
25
|
-
console.log(`${utils_js_1.c.bold}Created:${utils_js_1.c.reset} ${(0, utils_js_1.shortDate)(createdAt)}`);
|
|
26
|
-
console.log(`${utils_js_1.c.bold}Updated:${utils_js_1.c.reset} ${(0, utils_js_1.shortDate)(updatedAt)}`);
|
|
27
|
-
if (t.title) {
|
|
28
|
-
console.log(`${utils_js_1.c.bold}Title:${utils_js_1.c.reset} ${t.title}`);
|
|
29
|
-
}
|
|
30
|
-
console.log(`${utils_js_1.c.bold}Thesis:${utils_js_1.c.reset} ${t.rawThesis || '-'}`);
|
|
31
|
-
if (t.webhookUrl) {
|
|
32
|
-
console.log(`${utils_js_1.c.bold}Webhook:${utils_js_1.c.reset} ${t.webhookUrl}`);
|
|
33
|
-
}
|
|
34
|
-
// Causal tree
|
|
35
|
-
const causalTree = t.causalTree;
|
|
36
|
-
if (causalTree && causalTree.nodes) {
|
|
37
|
-
(0, utils_js_1.header)('Causal Tree');
|
|
38
|
-
printNodes(causalTree.nodes, 0);
|
|
39
|
-
}
|
|
40
|
-
// Edge analysis
|
|
41
|
-
const edgeAnalysis = t.edgeAnalysis;
|
|
42
|
-
if (edgeAnalysis && edgeAnalysis.edges) {
|
|
43
|
-
(0, utils_js_1.header)('Edge Analysis');
|
|
44
|
-
console.log(`${utils_js_1.c.dim}Analyzed: ${(0, utils_js_1.shortDate)(edgeAnalysis.analyzedAt)}${utils_js_1.c.reset}`);
|
|
45
|
-
if (edgeAnalysis.lastRescanAt) {
|
|
46
|
-
console.log(`${utils_js_1.c.dim}Last rescan: ${(0, utils_js_1.shortDate)(edgeAnalysis.lastRescanAt)}${utils_js_1.c.reset}`);
|
|
47
|
-
}
|
|
48
|
-
for (const edge of edgeAnalysis.edges) {
|
|
49
|
-
const edgeSize = edge.edgeSize ?? 0;
|
|
50
|
-
const edgeColor = edgeSize > 10 ? utils_js_1.c.green : edgeSize > 0 ? utils_js_1.c.yellow : utils_js_1.c.red;
|
|
51
|
-
console.log(` ${edge.marketTitle || edge.marketId}` +
|
|
52
|
-
` ${utils_js_1.c.dim}${edge.venue}${utils_js_1.c.reset}` +
|
|
53
|
-
` price: ${(edge.marketPrice ?? 0).toFixed(0)}¢` +
|
|
54
|
-
` ${edgeColor}edge: ${edgeSize > 0 ? '+' : ''}${edgeSize.toFixed(1)}${utils_js_1.c.reset}`);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
// Positions
|
|
58
|
-
if (positions.length > 0) {
|
|
59
|
-
(0, utils_js_1.header)('Positions');
|
|
60
|
-
for (const p of positions) {
|
|
61
|
-
if (!p)
|
|
62
|
-
continue;
|
|
63
|
-
const statusIcon = p.status === 'open' ? utils_js_1.c.green + '●' : utils_js_1.c.dim + '○';
|
|
64
|
-
console.log(` ${statusIcon}${utils_js_1.c.reset} [${(p.id || '?').slice(0, 8)}] "${p.marketTitle || '?'}" ` +
|
|
65
|
-
`${p.direction || '?'}@${p.entryPrice || '?'}→${p.currentPrice || p.entryPrice || '?'} ` +
|
|
66
|
-
`${utils_js_1.c.dim}(${p.venue || '?'})${utils_js_1.c.reset}`);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
// Last evaluation
|
|
70
|
-
const lastEval = t.lastEvaluation;
|
|
71
|
-
if (lastEval) {
|
|
72
|
-
(0, utils_js_1.header)('Last Evaluation');
|
|
73
|
-
const evalAt = lastEval.evaluatedAt instanceof Date ? lastEval.evaluatedAt.toISOString() : lastEval.evaluatedAt;
|
|
74
|
-
console.log(`${utils_js_1.c.dim}${(0, utils_js_1.shortDate)(evalAt)} | model: ${lastEval.model || '-'}${utils_js_1.c.reset}`);
|
|
75
|
-
if (lastEval.confidenceDelta !== undefined) {
|
|
76
|
-
const d = lastEval.confidenceDelta;
|
|
77
|
-
const dColor = d > 0 ? utils_js_1.c.green : d < 0 ? utils_js_1.c.red : utils_js_1.c.dim;
|
|
78
|
-
console.log(`Confidence: ${(0, utils_js_1.pct)(lastEval.previousConfidence)} → ${(0, utils_js_1.pct)(lastEval.newConfidence)} ${dColor}(${(0, utils_js_1.delta)(d)})${utils_js_1.c.reset}`);
|
|
79
|
-
}
|
|
80
|
-
if (lastEval.summary) {
|
|
81
|
-
console.log(`\n${lastEval.summary}`);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
console.log('');
|
|
85
|
-
}
|
|
86
|
-
function printNodes(nodes, depth) {
|
|
87
|
-
for (const node of nodes) {
|
|
88
|
-
if (!node)
|
|
89
|
-
continue;
|
|
90
|
-
const indent = ' '.repeat(depth + 1);
|
|
91
|
-
const prob = node.probability !== undefined ? (0, utils_js_1.pct)(node.probability) : '-';
|
|
92
|
-
const imp = node.importance !== undefined ? ` imp:${node.importance}` : '';
|
|
93
|
-
console.log(`${indent}${utils_js_1.c.cyan}${node.id}${utils_js_1.c.reset} ${node.label} ${utils_js_1.c.dim}(${prob}${imp})${utils_js_1.c.reset}`);
|
|
94
|
-
if (node.children && node.children.length > 0) {
|
|
95
|
-
printNodes(node.children, depth + 1);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* sf heartbeat <thesisId> — View/update per-thesis heartbeat config & costs.
|
|
3
|
-
*
|
|
4
|
-
* Examples:
|
|
5
|
-
* sf heartbeat abc123 — show config + costs
|
|
6
|
-
* sf heartbeat abc123 --news-interval 30 — set news scan to 30 min
|
|
7
|
-
* sf heartbeat abc123 --model heavy — use heavy model for eval
|
|
8
|
-
* sf heartbeat abc123 --budget 5 — $5/month cap
|
|
9
|
-
* sf heartbeat abc123 --pause — pause heartbeat
|
|
10
|
-
* sf heartbeat abc123 --resume — resume heartbeat
|
|
11
|
-
*/
|
|
12
|
-
import type { SFClient } from '../client.js';
|
|
13
|
-
export declare function heartbeatCommand(sfClient: SFClient, thesisId: string, opts: {
|
|
14
|
-
newsInterval?: string;
|
|
15
|
-
xInterval?: string;
|
|
16
|
-
model?: string;
|
|
17
|
-
budget?: string;
|
|
18
|
-
pause?: boolean;
|
|
19
|
-
resume?: boolean;
|
|
20
|
-
}): Promise<void>;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* sf heartbeat <thesisId> — View/update per-thesis heartbeat config & costs.
|
|
4
|
-
*
|
|
5
|
-
* Examples:
|
|
6
|
-
* sf heartbeat abc123 — show config + costs
|
|
7
|
-
* sf heartbeat abc123 --news-interval 30 — set news scan to 30 min
|
|
8
|
-
* sf heartbeat abc123 --model heavy — use heavy model for eval
|
|
9
|
-
* sf heartbeat abc123 --budget 5 — $5/month cap
|
|
10
|
-
* sf heartbeat abc123 --pause — pause heartbeat
|
|
11
|
-
* sf heartbeat abc123 --resume — resume heartbeat
|
|
12
|
-
*/
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.heartbeatCommand = heartbeatCommand;
|
|
15
|
-
const utils_js_1 = require("../utils.js");
|
|
16
|
-
async function heartbeatCommand(sfClient, thesisId, opts) {
|
|
17
|
-
// Check if any update flags were passed
|
|
18
|
-
const hasUpdates = opts.newsInterval || opts.xInterval || opts.model || opts.budget !== undefined || opts.pause || opts.resume;
|
|
19
|
-
if (hasUpdates) {
|
|
20
|
-
const updates = {};
|
|
21
|
-
if (opts.newsInterval)
|
|
22
|
-
updates.newsIntervalMin = parseInt(opts.newsInterval, 10);
|
|
23
|
-
if (opts.xInterval)
|
|
24
|
-
updates.xIntervalMin = parseInt(opts.xInterval, 10);
|
|
25
|
-
if (opts.model)
|
|
26
|
-
updates.evalModelTier = opts.model;
|
|
27
|
-
if (opts.budget !== undefined)
|
|
28
|
-
updates.monthlyBudgetUsd = parseFloat(opts.budget);
|
|
29
|
-
if (opts.pause)
|
|
30
|
-
updates.paused = true;
|
|
31
|
-
if (opts.resume)
|
|
32
|
-
updates.paused = false;
|
|
33
|
-
try {
|
|
34
|
-
const result = await sfClient.updateHeartbeatConfig(thesisId, updates);
|
|
35
|
-
console.log(`\n ${utils_js_1.c.green}✓${utils_js_1.c.reset} Updated heartbeat config`);
|
|
36
|
-
console.log(` ${utils_js_1.c.dim}Updated fields: ${result.updated.join(', ')}${utils_js_1.c.reset}\n`);
|
|
37
|
-
}
|
|
38
|
-
catch (err) {
|
|
39
|
-
console.error(` ${utils_js_1.c.red}✗ ${err.message}${utils_js_1.c.reset}`);
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
// Always show current config
|
|
44
|
-
try {
|
|
45
|
-
const data = await sfClient.getHeartbeatConfig(thesisId);
|
|
46
|
-
const cfg = data.config;
|
|
47
|
-
const costs = data.costs;
|
|
48
|
-
console.log(`\n ${utils_js_1.c.bold}Heartbeat Config${utils_js_1.c.reset} ${utils_js_1.c.dim}(${thesisId.slice(0, 8)})${utils_js_1.c.reset}`);
|
|
49
|
-
console.log();
|
|
50
|
-
// Config
|
|
51
|
-
const statusIcon = cfg.paused ? `${utils_js_1.c.red}⏸ paused${utils_js_1.c.reset}` : `${utils_js_1.c.green}▶ active${utils_js_1.c.reset}`;
|
|
52
|
-
console.log(` Status ${statusIcon}`);
|
|
53
|
-
console.log(` News interval ${utils_js_1.c.cyan}${cfg.newsIntervalMin}${utils_js_1.c.reset} min ${utils_js_1.c.dim}(${cfg.newsIntervalMin === data.defaults.newsIntervalMin ? 'default' : 'custom'})${utils_js_1.c.reset}`);
|
|
54
|
-
console.log(` X interval ${utils_js_1.c.cyan}${cfg.xIntervalMin}${utils_js_1.c.reset} min ${utils_js_1.c.dim}(${cfg.xIntervalMin === data.defaults.xIntervalMin ? 'default' : 'custom'})${utils_js_1.c.reset}`);
|
|
55
|
-
console.log(` Eval model ${utils_js_1.c.cyan}${cfg.evalModelTier}${utils_js_1.c.reset} ${utils_js_1.c.dim}(${cfg.evalModelTier === data.defaults.evalModelTier ? 'default' : 'custom'})${utils_js_1.c.reset}`);
|
|
56
|
-
console.log(` Monthly budget ${cfg.monthlyBudgetUsd > 0 ? `${utils_js_1.c.cyan}$${cfg.monthlyBudgetUsd}${utils_js_1.c.reset}` : `${utils_js_1.c.dim}unlimited${utils_js_1.c.reset}`}`);
|
|
57
|
-
console.log();
|
|
58
|
-
// Costs
|
|
59
|
-
console.log(` ${utils_js_1.c.bold}This Month${utils_js_1.c.reset}`);
|
|
60
|
-
console.log(` Total cost ${utils_js_1.c.cyan}$${costs.monthlyTotal.toFixed(4)}${utils_js_1.c.reset}`);
|
|
61
|
-
console.log(` LLM calls ${costs.llmCalls}`);
|
|
62
|
-
console.log(` Search calls ${costs.searchCalls}`);
|
|
63
|
-
console.log(` Tokens ${utils_js_1.c.dim}${costs.inputTokens.toLocaleString()} in / ${costs.outputTokens.toLocaleString()} out${utils_js_1.c.reset}`);
|
|
64
|
-
if (costs.budgetRemaining !== null) {
|
|
65
|
-
const pct = cfg.monthlyBudgetUsd > 0 ? Math.round((costs.monthlyTotal / cfg.monthlyBudgetUsd) * 100) : 0;
|
|
66
|
-
console.log(` Budget used ${pct}% ${utils_js_1.c.dim}($${costs.budgetRemaining.toFixed(2)} remaining)${utils_js_1.c.reset}`);
|
|
67
|
-
}
|
|
68
|
-
console.log();
|
|
69
|
-
}
|
|
70
|
-
catch (err) {
|
|
71
|
-
console.error(` ${utils_js_1.c.red}✗ ${err.message}${utils_js_1.c.reset}`);
|
|
72
|
-
}
|
|
73
|
-
}
|
package/dist/commands/history.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.historyCommand = historyCommand;
|
|
4
|
-
const kalshi_js_1 = require("../kalshi.js");
|
|
5
|
-
const utils_js_1 = require("../utils.js");
|
|
6
|
-
async function historyCommand(ticker, opts) {
|
|
7
|
-
const market = await (0, kalshi_js_1.getHistoricalMarket)(ticker);
|
|
8
|
-
if (!market) {
|
|
9
|
-
console.log(`${utils_js_1.c.dim}No historical data for ${ticker}${utils_js_1.c.reset}`);
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
if (opts.json) {
|
|
13
|
-
console.log(JSON.stringify(market, null, 2));
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
console.log(`${utils_js_1.c.bold}${utils_js_1.c.cyan}${market.title || ticker}${utils_js_1.c.reset}`);
|
|
17
|
-
console.log(`${utils_js_1.c.dim}${'─'.repeat(60)}${utils_js_1.c.reset}`);
|
|
18
|
-
console.log(` Ticker: ${market.ticker || ticker}`);
|
|
19
|
-
console.log(` Event: ${market.event_ticker || '-'}`);
|
|
20
|
-
console.log(` Status: ${market.status || '-'}`);
|
|
21
|
-
console.log(` Result: ${market.result || market.market_result || '-'}`);
|
|
22
|
-
if (market.last_price_dollars) {
|
|
23
|
-
console.log(` Last Price: ${Math.round(parseFloat(market.last_price_dollars) * 100)}¢`);
|
|
24
|
-
}
|
|
25
|
-
if (market.settlement_value !== undefined) {
|
|
26
|
-
console.log(` Settlement: ${market.settlement_value}`);
|
|
27
|
-
}
|
|
28
|
-
if (market.volume) {
|
|
29
|
-
console.log(` Volume: ${market.volume}`);
|
|
30
|
-
}
|
|
31
|
-
if (market.open_interest) {
|
|
32
|
-
console.log(` Open Int: ${market.open_interest}`);
|
|
33
|
-
}
|
|
34
|
-
if (market.expiration_time) {
|
|
35
|
-
console.log(` Expired: ${market.expiration_time}`);
|
|
36
|
-
}
|
|
37
|
-
console.log();
|
|
38
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* sf liquidity — Market liquidity scanner by topic and horizon
|
|
3
|
-
*
|
|
4
|
-
* Scans known series, fetches public orderbooks, and displays
|
|
5
|
-
* spread/depth/slippage data grouped by topic and horizon.
|
|
6
|
-
*/
|
|
7
|
-
export declare function liquidityCommand(opts: {
|
|
8
|
-
topic?: string;
|
|
9
|
-
horizon?: string;
|
|
10
|
-
minDepth?: number;
|
|
11
|
-
json?: boolean;
|
|
12
|
-
all?: boolean;
|
|
13
|
-
venue?: string;
|
|
14
|
-
}): Promise<void>;
|