Kalshi CLI
Use the local kalshi CLI for bounded Kalshi series and market research, keyword discovery, fixed-point portfolio and candlestick reads, order reconciliation, and explicitly confirm…
bobashopcashier
@bobashopcashier
Install
$ openclaw skills install @bobashopcashier/kalshi-cliKalshi CLI
Use the compiled kalshi binary or go run ./cmd/kalshi from this repository.
Required workflow
- If the command is not already known from the same cached registry/binary version, run
kalshi commands list --fields registry_version,commands.name,commands.output_contract_version,commands.summary --compactonce and cache the result byregistry_versionfor the task. - Before constructing unfamiliar parameters, run
kalshi commands describe <command.name> --fields command.name,command.output_contract_version,command.summary,command.effect,command.params_schema --compact. Addcommand.response_schema,command.docs_urlonly when response semantics or upstream documentation are needed. - Prefer one strict
--paramsJSON object for generated calls. Convenience flags are safe but must not duplicate fields in--params. - Add the narrowest useful
--fieldsselection to reads. Add every field the task cannot proceed without to--require-fields; this makes the path present and non-null in every returned record. Paths are item-relative for collection commands and data-root-relative otherwise. Discover allowed paths and constraints offline withkalshi commands describe <command.name> --fields command.response_schema.x-projectable-fields,command.response_schema.x-projected-field-contracts --compact. - Set explicit
--max-pages,--max-items, and--max-byteswhen the defaults do not fit the task. Never emulate an unbounded--allloop. - Parse
schema_version,output_contract_version,ok, stableerror.code,effect, andmeta.truncation. Do not scrape prose. - Treat a non-empty
meta.pagination.next_cursorplus truncation reasons as an explicit continuation decision.
markets.search is a bounded local substring match over documented /markets
pages, not an upstream full-text or relevance-ranked search. A zero-match result
is complete only when its cursor is empty and truncation is false.
portfolio.pnl exposes Kalshi's upstream-reported realized P&L, exposure, and
fees. It does not estimate unrealized P&L, subtract fees, or combine market and
event aggregates. Current and archived candlesticks have separate commands and
field contracts; do not substitute one when the other returns not found.
Authentication
Never place an API private key in argv, --params, output, logs, or prompts. Configure KALSHI_CREDENTIALS_FILE, or configure KALSHI_API_KEY_ID plus KALSHI_PRIVATE_KEY_FILE. Credential and PEM files must be mode 0600 or stricter.
orderbook.get is anonymous by default because current Kalshi public-data guidance and observed behavior allow it, despite the current endpoint schema also declaring authentication. If the server requires authentication, repeat with --authenticated and a configured credential source.
Writes
Never call orders.create or orders.cancel directly on first construction.
- Supply an explicit environment and a write policy. Prefer demo unless the operator explicitly requested production.
- For create, supply a caller-stable
client_order_id, count/notional policy caps, and complete params. - Add
--dry-run. This performs no credential loading, DNS, HTTP, or mutation. - Review the canonical plan and its effect/policy metadata.
- Repeat the identical command without
--dry-runand pass the exactconfirmation_digestto--confirm. - If a write returns
mutation_status: "unknown", do not blindly retry and do not switch client IDs. Runorders.reconcilefor creates ororders.getfor cancels.
--write-policy demo-only permits demo writes; allow is necessary for production. The default is deny. CLI flags may state finite count and notional caps; they are part of the confirmation digest.
Output
Prefer compact JSON for model consumption. Use NDJSON only for external line-oriented processors; it is atomically buffered and repeats the envelope for each collection item, so it is usually more token-expensive. NDJSON's final summary record contains authoritative pagination/truncation metadata. Strings are sanitized so C0/C1 terminal controls, ANSI escapes, invalid UTF-8, and bidi controls appear as visible Unicode escape text.
Projection happens before sanitization and byte accounting. If the result still exceeds --max-bytes, the command fails atomically with OUTPUT_LIMIT; add or narrow fields, or increase the cap. Never treat an output-limit error as a partial page or continue from a cursor copied from error text.
Commands may declare x-default-fields for their canonical v1 view. An
explicit --fields overrides that default; continue to use --require-fields
for every optional value the task cannot proceed without.
Required response fields are validated before projection. Treat UPSTREAM_SCHEMA_MISMATCH as a contract failure, inspect error.details.missing_fields, type_mismatches, format_mismatches, value_mismatches, and unexpected_fields, and do not guess a renamed field. Optional fields selected only with --fields are emitted as null when absent; use --require-fields whenever null would make the task fail later.
Branch on stable error codes and exit categories documented in README.md. A network error is retryable only for reads. Writes are never automatically retried.
Read commands automatically handle bounded HTTP 429 retries within --timeout. Inspect meta.retry when present for attempts, completed retries, exhaustion, and the final server delay. A final UPSTREAM_REJECTED with HTTP 429 and retryable: true means the per-process retry budget was exhausted; back off before starting another CLI process. Rate-limited attempts do not count as fetched pagination pages.
Top skills in this category
Polymarket Agent
@andretutaResearch Polymarket markets, whale flow and smart money; optionally trade a Polygon wallet behind deterministic risk guard-rails.
Agent Browser
@matrixyHeadless browser automation CLI optimized for AI agents with accessibility tree snapshots and ref-based element selection
Find Skills Skill
@fangkelvinSearch and discover OpenClaw skills from various sources. Use when: user wants to find available skills, search for specific functionality, or discover new s...
Planning with files
@othmanadiManus-style persistent file-based planning for AI coding agents: keeps task_plan.md, findings.md, and progress.md on disk so work survives context loss and /clear. Use when asked to plan out, break down, or organize a multi-step project, research task, or any work requiring 5+ tool calls. Supports a
AnySearch
@anysearch-aiUnified real-time search engine skill for AI agents. Supports general web search, vertical domain search, parallel batch search, and full-page content extraction.