@spfunctions/cli 1.7.2 → 1.7.4
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/commands/markets.d.ts +9 -0
- package/dist/commands/markets.js +34 -0
- package/dist/index.js +11 -1
- package/package.json +1 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* sf markets
|
|
4
|
+
*
|
|
5
|
+
* Traditional market snapshot via Databento (SPY, VIX, TLT, Gold, Oil).
|
|
6
|
+
* No auth required — calls public endpoint.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.marketsCommand = marketsCommand;
|
|
10
|
+
const BASE_URL = 'https://simplefunctions.dev';
|
|
11
|
+
async function marketsCommand(opts) {
|
|
12
|
+
const res = await fetch(`${BASE_URL}/api/public/markets`);
|
|
13
|
+
if (!res.ok) {
|
|
14
|
+
console.error(` Error: ${res.status} ${await res.text()}`);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const data = await res.json();
|
|
18
|
+
if (opts?.json) {
|
|
19
|
+
console.log(JSON.stringify(data, null, 2));
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
console.log(`\n \x1b[1mTraditional Markets\x1b[22m \x1b[2m${data.snapshotAt?.slice(0, 10) || ''}\x1b[22m\n`);
|
|
23
|
+
if (!data.markets?.length) {
|
|
24
|
+
console.log(' No data available.\n');
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
for (const m of data.markets) {
|
|
28
|
+
const arrow = m.changePct >= 0 ? '\x1b[32m▲\x1b[39m' : '\x1b[31m▼\x1b[39m';
|
|
29
|
+
const chg = m.changePct >= 0 ? `\x1b[32m+${m.changePct}%\x1b[39m` : `\x1b[31m${m.changePct}%\x1b[39m`;
|
|
30
|
+
const price = `$${m.price.toFixed(2)}`;
|
|
31
|
+
console.log(` ${arrow} ${m.symbol.padEnd(5)} ${price.padStart(10)} ${chg.padStart(16)} ${m.name}`);
|
|
32
|
+
}
|
|
33
|
+
console.log();
|
|
34
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -58,6 +58,7 @@ const prompt_js_1 = require("./commands/prompt.js");
|
|
|
58
58
|
const augment_js_1 = require("./commands/augment.js");
|
|
59
59
|
const telegram_js_1 = require("./commands/telegram.js");
|
|
60
60
|
const query_js_1 = require("./commands/query.js");
|
|
61
|
+
const markets_js_1 = require("./commands/markets.js");
|
|
61
62
|
const utils_js_1 = require("./utils.js");
|
|
62
63
|
// ── Apply ~/.sf/config.json to process.env BEFORE any command ────────────────
|
|
63
64
|
// This means client.ts, kalshi.ts, agent.ts keep reading process.env and just work.
|
|
@@ -86,6 +87,7 @@ const GROUPED_HELP = `
|
|
|
86
87
|
|
|
87
88
|
\x1b[1mSearch\x1b[22m
|
|
88
89
|
\x1b[36mquery\x1b[39m "question" LLM-enhanced market knowledge search \x1b[2m(no auth)\x1b[22m
|
|
90
|
+
\x1b[36mmarkets\x1b[39m Traditional markets: SPY, VIX, bonds, gold, oil \x1b[2m(no auth)\x1b[22m
|
|
89
91
|
|
|
90
92
|
\x1b[1mMarkets\x1b[22m
|
|
91
93
|
\x1b[36mscan\x1b[39m "keywords" Search Kalshi + Polymarket
|
|
@@ -221,7 +223,7 @@ async function interactiveEntry() {
|
|
|
221
223
|
console.log();
|
|
222
224
|
}
|
|
223
225
|
// ── Pre-action guard: check configuration ────────────────────────────────────
|
|
224
|
-
const NO_CONFIG_COMMANDS = new Set(['setup', 'help', 'scan', 'explore', 'query', 'context', 'milestones', 'forecast', 'settlements', 'balance', 'orders', 'fills', 'schedule', 'announcements', 'history', 'liquidity', 'book', 'prompt', 'sf']);
|
|
226
|
+
const NO_CONFIG_COMMANDS = new Set(['setup', 'help', 'scan', 'explore', 'query', 'context', 'markets', 'milestones', 'forecast', 'settlements', 'balance', 'orders', 'fills', 'schedule', 'announcements', 'history', 'liquidity', 'book', 'prompt', 'sf']);
|
|
225
227
|
program.hook('preAction', (thisCommand, actionCommand) => {
|
|
226
228
|
const cmdName = actionCommand.name();
|
|
227
229
|
if (NO_CONFIG_COMMANDS.has(cmdName))
|
|
@@ -625,6 +627,14 @@ program
|
|
|
625
627
|
const g = cmd.optsWithGlobals();
|
|
626
628
|
await run(() => (0, augment_js_1.augmentCommand)(thesisId, { dryRun: opts.dryRun, json: opts.json, apiKey: g.apiKey, apiUrl: g.apiUrl }));
|
|
627
629
|
});
|
|
630
|
+
// ── sf markets ───────────────────────────────────────────────────────────────
|
|
631
|
+
program
|
|
632
|
+
.command('markets')
|
|
633
|
+
.description('Traditional market snapshot — SPY, VIX, Treasury, Gold, Oil (no auth)')
|
|
634
|
+
.option('--json', 'JSON output')
|
|
635
|
+
.action(async (opts) => {
|
|
636
|
+
await run(() => (0, markets_js_1.marketsCommand)({ json: opts.json }));
|
|
637
|
+
});
|
|
628
638
|
// ── sf query "question" ──────────────────────────────────────────────────────
|
|
629
639
|
program
|
|
630
640
|
.command('query <question>')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spfunctions/cli",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.4",
|
|
4
4
|
"description": "Prediction market intelligence CLI. Causal thesis model, 24/7 Kalshi/Polymarket scan, live orderbook, edge detection. Interactive agent mode with tool calling.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"sf": "./dist/index.js"
|