@spfunctions/cli 1.1.8 → 1.1.9

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.
@@ -717,8 +717,18 @@ async function agentCommand(thesisId, opts) {
717
717
  }
718
718
  }
719
719
  cachedPositions = positions;
720
+ const formatted = positions.map((p) => ({
721
+ ticker: p.ticker,
722
+ side: p.side,
723
+ quantity: p.quantity,
724
+ avg_price: `${p.average_price_paid}¢`,
725
+ current_price: `${p.current_value}¢`,
726
+ unrealized_pnl: `$${(p.unrealized_pnl / 100).toFixed(2)}`,
727
+ total_cost: `$${(p.total_cost / 100).toFixed(2)}`,
728
+ realized_pnl: `$${(p.realized_pnl / 100).toFixed(2)}`,
729
+ }));
720
730
  return {
721
- content: [{ type: 'text', text: JSON.stringify(positions, null, 2) }],
731
+ content: [{ type: 'text', text: JSON.stringify(formatted, null, 2) }],
722
732
  details: {},
723
733
  };
724
734
  },
@@ -1195,6 +1205,7 @@ Short-term markets (weekly/monthly contracts) settle into hard data that calibra
1195
1205
  - If a causal tree node probability seriously contradicts the market price, point it out.
1196
1206
  - Use Chinese if the user writes in Chinese, English if they write in English.
1197
1207
  - For any question about prices, positions, or P&L, ALWAYS call a tool to get fresh data first. Never answer price-related questions using the cached data in this system prompt.
1208
+ - Prices are in cents (e.g. 35¢). P&L, cost, and balance are in dollars (e.g. $90.66). Tool outputs are pre-formatted with units — do not re-convert.
1198
1209
  - Align tables. Be precise with numbers to the cent.
1199
1210
 
1200
1211
  ## Strategy rules
@@ -2137,7 +2148,14 @@ async function runPlainTextAgent(params) {
2137
2148
  pos.unrealized_pnl = Math.round((livePrice - pos.average_price_paid) * pos.quantity);
2138
2149
  }
2139
2150
  }
2140
- return { content: [{ type: 'text', text: JSON.stringify(positions, null, 2) }], details: {} };
2151
+ const formatted = positions.map((p) => ({
2152
+ ticker: p.ticker, side: p.side, quantity: p.quantity,
2153
+ avg_price: `${p.average_price_paid}¢`, current_price: `${p.current_value}¢`,
2154
+ unrealized_pnl: `$${(p.unrealized_pnl / 100).toFixed(2)}`,
2155
+ total_cost: `$${(p.total_cost / 100).toFixed(2)}`,
2156
+ realized_pnl: `$${(p.realized_pnl / 100).toFixed(2)}`,
2157
+ }));
2158
+ return { content: [{ type: 'text', text: JSON.stringify(formatted, null, 2) }], details: {} };
2141
2159
  },
2142
2160
  },
2143
2161
  {
@@ -2309,7 +2327,7 @@ ${edgesSummary}
2309
2327
 
2310
2328
  ${ctx.lastEvaluation?.summary ? `Latest evaluation: ${ctx.lastEvaluation.summary.slice(0, 300)}` : ''}
2311
2329
 
2312
- Rules: Be concise. Use tools when needed. Don't ask "anything else?".`;
2330
+ Rules: Be concise. Use tools when needed. Don't ask "anything else?". Prices are in cents (e.g. 35¢). P&L, cost, and balance are in dollars (e.g. $90.66). Tool outputs are pre-formatted with units — do not re-convert.`;
2313
2331
  // ── Create agent ──────────────────────────────────────────────────────────
2314
2332
  const agent = new Agent({
2315
2333
  initialState: { systemPrompt, model, tools, thinkingLevel: 'off' },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spfunctions/cli",
3
- "version": "1.1.8",
3
+ "version": "1.1.9",
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"