@spfunctions/cli 1.4.3 → 1.4.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/agent.js +12 -3
- package/package.json +1 -1
package/dist/commands/agent.js
CHANGED
|
@@ -1283,7 +1283,7 @@ When the conversation produces a concrete trade idea (specific contract, directi
|
|
|
1283
1283
|
- Extract hard conditions (specific prices in cents) into entryBelow/stopLoss/takeProfit.
|
|
1284
1284
|
- Put fuzzy conditions into softConditions (e.g. "only if n3 > 60%", "spread < 3¢").
|
|
1285
1285
|
- Put the full reasoning into rationale.
|
|
1286
|
-
- After creating, confirm the strategy details
|
|
1286
|
+
- After creating, confirm the strategy details.
|
|
1287
1287
|
- If the user says "change the stop loss on T150 to 30", use update_strategy.
|
|
1288
1288
|
|
|
1289
1289
|
## Trading status
|
|
@@ -2615,7 +2615,7 @@ async function runPlainTextAgent(params) {
|
|
|
2615
2615
|
tools.push({
|
|
2616
2616
|
name: 'place_order',
|
|
2617
2617
|
label: 'Place Order',
|
|
2618
|
-
description: 'Place a buy or sell order on Kalshi.
|
|
2618
|
+
description: 'Place a buy or sell order on Kalshi. Shows preview and asks for confirmation.',
|
|
2619
2619
|
parameters: Type.Object({
|
|
2620
2620
|
ticker: Type.String({ description: 'Market ticker e.g. KXWTIMAX-26DEC31-T135' }),
|
|
2621
2621
|
side: Type.String({ description: 'yes or no' }),
|
|
@@ -2626,9 +2626,18 @@ async function runPlainTextAgent(params) {
|
|
|
2626
2626
|
}),
|
|
2627
2627
|
execute: async (_id, p) => {
|
|
2628
2628
|
const { createOrder } = await import('../kalshi.js');
|
|
2629
|
+
const readline = await import('readline');
|
|
2629
2630
|
const priceCents = p.price_cents ? Math.round(Number(p.price_cents)) : undefined;
|
|
2630
2631
|
const maxCost = ((priceCents || 99) * p.count / 100).toFixed(2);
|
|
2631
|
-
|
|
2632
|
+
const preview = ` Order: ${p.action.toUpperCase()} ${p.count}x ${p.ticker} ${p.side.toUpperCase()} @ ${priceCents ? priceCents + '\u00A2' : 'market'} (max $${maxCost})`;
|
|
2633
|
+
process.stderr.write(preview + '\n');
|
|
2634
|
+
// Confirm in plain mode via readline
|
|
2635
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stderr });
|
|
2636
|
+
const answer = await new Promise(resolve => rl.question(' Execute? (y/n) ', resolve));
|
|
2637
|
+
rl.close();
|
|
2638
|
+
if (!answer.toLowerCase().startsWith('y')) {
|
|
2639
|
+
return { content: [{ type: 'text', text: 'Order cancelled by user.' }], details: {} };
|
|
2640
|
+
}
|
|
2632
2641
|
try {
|
|
2633
2642
|
const result = await createOrder({
|
|
2634
2643
|
ticker: p.ticker,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spfunctions/cli",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.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"
|