@spfunctions/cli 1.4.0 → 1.4.1
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/performance.js +7 -3
- package/dist/kalshi.js +2 -2
- package/package.json +1 -1
|
@@ -48,8 +48,8 @@ async function performanceCommand(opts) {
|
|
|
48
48
|
continue;
|
|
49
49
|
const side = fill.side || 'yes';
|
|
50
50
|
const action = fill.action || 'buy';
|
|
51
|
-
const count = fill.count || 0;
|
|
52
|
-
const yesPrice = fill.
|
|
51
|
+
const count = Math.round(parseFloat(fill.count_fp || fill.count || '0'));
|
|
52
|
+
const yesPrice = Math.round(parseFloat(fill.yes_price_dollars || '0') * 100); // dollars string → cents int
|
|
53
53
|
// Determine direction: buy yes = +count, sell yes = -count
|
|
54
54
|
let delta = count;
|
|
55
55
|
if (action === 'sell')
|
|
@@ -105,7 +105,11 @@ async function performanceCommand(opts) {
|
|
|
105
105
|
const priceByDate = new Map();
|
|
106
106
|
for (const candle of (mc.candlesticks || [])) {
|
|
107
107
|
// close_dollars is a string like "0.4800"
|
|
108
|
-
|
|
108
|
+
// price object may be empty; use midpoint of yes_bid.close and yes_ask.close
|
|
109
|
+
const bidClose = parseFloat(candle.yes_bid?.close_dollars || '0');
|
|
110
|
+
const askClose = parseFloat(candle.yes_ask?.close_dollars || '0');
|
|
111
|
+
const mid = bidClose > 0 && askClose > 0 ? (bidClose + askClose) / 2 : bidClose || askClose;
|
|
112
|
+
const closeDollars = parseFloat(candle.price?.close_dollars || '0') || mid;
|
|
109
113
|
const closeCents = Math.round(closeDollars * 100);
|
|
110
114
|
const ts = candle.end_period_ts || candle.period_end_ts || candle.ts;
|
|
111
115
|
if (ts) {
|
package/dist/kalshi.js
CHANGED
|
@@ -481,12 +481,12 @@ async function getBatchCandlesticks(params) {
|
|
|
481
481
|
return [];
|
|
482
482
|
try {
|
|
483
483
|
const searchParams = new URLSearchParams();
|
|
484
|
-
searchParams.set('
|
|
484
|
+
searchParams.set('market_tickers', params.tickers.join(','));
|
|
485
485
|
searchParams.set('start_ts', params.startTs.toString());
|
|
486
486
|
searchParams.set('end_ts', params.endTs.toString());
|
|
487
487
|
searchParams.set('period_interval', (params.periodInterval ?? 1440).toString());
|
|
488
488
|
const data = await kalshiAuthGet(`/markets/candlesticks?${searchParams.toString()}`);
|
|
489
|
-
return data.
|
|
489
|
+
return data.markets || [];
|
|
490
490
|
}
|
|
491
491
|
catch (err) {
|
|
492
492
|
console.warn('[Kalshi] Failed to fetch candlesticks:', err);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spfunctions/cli",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1",
|
|
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"
|