Documentation Index
Fetch the complete documentation index at: https://docs.simplefunctions.dev/llms.txt
Use this file to discover all available pages before exploring further.
This recipe is the SDK-only baseline: collect context, rank candidates deterministically, and hand a compact packet to a human or model layer. It does not trade.
Install
npm init -y
npm install @spfunctions/sdk@1.0.0
export SF_API_KEY="sf_..."
Script
import { writeFile } from "node:fs/promises"
import { SimpleFunctions } from "@spfunctions/sdk"
const sf = new SimpleFunctions({
baseUrl: "https://simplefunctions.dev",
apiKey: process.env.SF_API_KEY,
})
const world = await sf.world.get()
const screen = await sf.intelligence.screen({
venue: "kalshi",
volMin: 100,
sort: "volume",
order: "desc",
limit: 12,
nextActions: false,
})
const inspected = []
for (const market of screen.markets.slice(0, 5)) {
inspected.push(await sf.markets.get(market.ticker, { nextActions: false }))
}
const ranked = inspected
.map(market => ({
ticker: market.ticker,
title: market.title,
price: market.price,
bestBid: market.bestBid,
bestAsk: market.bestAsk,
spread: market.spread,
volume24h: market.volume24h,
closeTime: market.closeTime,
score:
Math.log10(1 + Number(market.volume24h ?? 0)) * 20 -
Number(market.spread ?? 10) * 4,
}))
.sort((a, b) => b.score - a.score)
const packet = {
generatedAt: new Date().toISOString(),
worldAsOf: world.asOf,
regime: world.regime?.label,
candidates: ranked.slice(0, 5),
}
await writeFile("research-packet.json", JSON.stringify(packet, null, 2))
console.log(JSON.stringify(packet, null, 2))
Production notes
- Keep the scoring deterministic before adding a model.
- Use
nextActions: false when you want compact machine packets.
- Inspect before acting on any ticker from a screener.
- Store
world.asOf and the source request ids with downstream decisions.
Next steps
SDK quickstart
Install and first calls.
Agent market monitor
Add a model loop after the deterministic screen.