Skip to main content

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.

QuoteEngine is the SimpleFunctions automated quoting workflow. It maintains bid/ask quotes for a prediction-market contract, adjusts around mid-price movement, applies inventory and exposure limits, and can run in paper mode before live execution. Use this page for operational setup. Use Real-Time Data API when you want to build your own market-making system from raw orderbooks, trades, candles, and movers.
QuoteEngine can place and cancel real orders when trading credentials and live execution are enabled. Start with --paper, inspect status, and keep limits small until the behavior is understood.

Mental model

ComponentRole
QuoteOne configured market-making instruction for a ticker or Polymarket token.
QuoteEngineLocal daemon that refreshes market data, computes quote levels, places/cancels orders, and tracks state.
SpreadBase distance between bid and ask, in cents. Wider spread reduces adverse-selection risk but lowers fill rate.
Inventory skewMoves quotes away from inventory you already hold, so the engine does not keep adding the same exposure.
BiasManual or thesis-driven directional lean, in cents. Positive bias is bullish; negative bias is bearish.
FadeTemporary spread widening after a fill, then decay back toward the configured spread.
Paper modeSimulated fills from live data. No live orders. Use for onboarding and dry runs.

First safe run

Start with paper mode and tight limits:
sf quote create KXRATECUT-26DEC31 \
  --paper \
  --spread 3 \
  --size 5 \
  --max-long 25 \
  --max-short 25 \
  --max-exposure 20 \
  --stop-loss 5 \
  --layers 1
Inspect the configured quote:
sf quote list --json
sf quoteengine status --json
Start the engine in the foreground while testing:
sf quoteengine start
After the behavior is understood, run it as a daemon:
sf quoteengine start --daemon
sf quoteengine status --json
Stop the engine and cancel active quote orders:
sf quoteengine stop

Quote creation flags

sf quote create <ticker> [options]
FlagUse
--paperSimulate fills from live data instead of placing live orders.
--spread <n>Base spread in cents. Default is 2.
--size <n>Contracts per side per layer. Default is 5.
--threshold <n>Requote when mid moves more than n cents.
--max-long <n>Max YES contracts.
--max-short <n>Max NO contracts.
--max-exposure <n>Max dollar exposure.
--stop-loss <n>Stop if P&L is below -n dollars.
--no-skewDisable inventory skew. Use only when you are intentionally running symmetric quotes.
--bias <n>Manual bias in cents, from -10 to 10.
--bias-mode <mode>manual, thesis, or off.
--thesis-id <id>Use a specific thesis for auto-bias.
--thesis-autoAuto-pick the best matching thesis for this ticker.
--min-spread <n>Minimum allowed spread in cents.
--max-spread <n>Maximum allowed spread in cents.
--fade <n>Widen spread by n cents after fill.
--fade-decay <n>Seconds for fill fade to decay. Default is 30.
--layers <n>Quote layers per side. Default is 1.
--layer-spacing <n>Cents between layers. Default is 1.
--requote-delay <ms>Debounce requotes.
--venue <name>Force kalshi or polymarket; otherwise inferred from ticker shape.

Bias patterns

Use --bias-mode off or omit bias for neutral quoting:
sf quote create KXRATECUT-26DEC31 --paper --spread 3 --size 5
Use manual bias when an external model or operator has a directional view:
sf quote create KXRATECUT-26DEC31 \
  --paper \
  --spread 3 \
  --size 5 \
  --bias-mode manual \
  --bias 2
Use thesis bias when the quote should lean with a SimpleFunctions thesis:
sf quote create KXRATECUT-26DEC31 \
  --paper \
  --spread 3 \
  --size 5 \
  --bias-mode thesis \
  --thesis-id <thesis-id>
Use --thesis-auto only when you are comfortable with automatic thesis matching:
sf quote create KXRATECUT-26DEC31 \
  --paper \
  --spread 3 \
  --size 5 \
  --bias-mode thesis \
  --thesis-auto

Operational loop

A production-style loop should be explicit:
1

Discover and inspect

sf discover --quality --json
sf inspect <ticker> --json
sf book <ticker>
2

Create a paper quote

sf quote create <ticker> --paper --spread 3 --size 5 --max-exposure 20 --stop-loss 5
3

Run and observe

sf quoteengine start
sf quoteengine status --json
sf quote list --json
4

Adjust or pause

sf quote pause <quoteId>
sf quote resume <quoteId>
sf quote cancel <quoteId>
5

Stop cleanly

sf quoteengine stop

Agent integration

For an external agent, separate research from execution:
sf agent --plain \
  --new \
  --allow read,user_data,research \
  --deny trade,runtime,fs \
  --once "Find candidate markets for paper market making. Return tickers, liquidity, spread, and risks. Do not create quotes."
Then require a human or policy service to approve the quote command. A safe generated command should include --paper, --max-exposure, --stop-loss, and small size limits. If Claude Code or Codex is driving the workflow, give it this boundary:
Allowed: sf discover, sf inspect, sf book, sf quote list, sf quoteengine status.
Approval required: sf quote create, sf quote pause, sf quote resume, sf quote cancel, sf quoteengine start, sf quoteengine stop.
Never unattended: live quote creation without --paper.

Live execution checklist

Before removing --paper:
  1. sf status --json shows expected auth and exchange configuration.
  2. sf quoteengine status --json is understood and clean.
  3. The quote has explicit --max-long, --max-short, --max-exposure, and --stop-loss.
  4. The spread is wider than the minimum tick noise you observed in paper mode.
  5. The operator knows how to run sf quoteengine stop.
  6. A separate process monitors fills, P&L, stale books, and exchange status.

Real-Time Data API

Raw market data for custom quoting, replay, and research systems.

Trade intents

Declarative execution workflow for non-market-making trades.

Headless agent

Let Claude Code, Codex, cron, or CI drive sf safely.

Risk gates

Portfolio and execution risk controls.