kraken-alert-patterns
Price alerts, threshold monitoring, and notification triggers for agents.
Example driver: drive a time-based dollar-cost-averaging hypothesis into a recorded session.
Claude Code
$ npx -y skills add krakenfx/kraken-cli --skill recipe-playground-dca --agent claude-code
Codex
$ npx skills add krakenfx/kraken-cli --skill recipe-playground-dca -a codex -y
Cursor
$ npx skills add krakenfx/kraken-cli --skill recipe-playground-dca -a cursor -y
Gemini CLI
$ npx skills add krakenfx/kraken-cli --skill recipe-playground-dca -a gemini-cli -y
GitHub Copilot
$ npx skills add krakenfx/kraken-cli --skill recipe-playground-dca -a github-copilot -y
OpenCode
$ npx skills add krakenfx/kraken-cli --skill recipe-playground-dca -a opencode -y
Windsurf
$ npx skills add krakenfx/kraken-cli --skill recipe-playground-dca -a windsurf -y
name: recipe-playground-dca
version: 1.0.0
description: "Example driver: drive a time-based dollar-cost-averaging hypothesis into a recorded session."
metadata:
openclaw:
category: "recipe"
domain: "sessions"
requires:
bins: ["kraken"]
skills: ["kraken-playground", "kraken-dca-strategy"]> **PREREQUISITE:** Load `kraken-playground` and `kraken-dca-strategy` to run this recipe. > **This recipe is an example, not a boundary.** Adapt the steps to your hypothesis, or write your own driver (see `kraken-playground` → Driving Your Own Hypothesis).
Test a dollar-cost-averaging hypothesis on live prices with no real money. Buy on a fixed cadence, optionally only when price dips below a short-term average, and record every buy, skip, and average cost into one session for later replay and P&L.
Use this skill for:
This recipe records a session inside a paper workspace. With that workspace named on every session and order call and checked each round (see Hard Rules), it never places a live order. Paper results may overstate live performance: fees and slippage are simulated and there are no partial fills (see `kraken-paper-strategy`).
Pacing is external. `/loop` owns the schedule and fires one round per interval (see `kraken-playground` → Pacing). One decision per interval, paced from outside, so the session is interventional over the window (see `kraken-playground` → Running over a Window).
Every number that gates a buy or skip goes in `--strategy-params`, not only in prose reasons. That is what makes two sessions comparable knob-for-knob:
Natural language:
Dollar-cost-average into Bitcoin over 10 hours. Buy $100 every hour if the price dips more than 0.10% below the 1-hour SMA. Record all buys, skips, and average cost. At the end, show P&L.
Work inside a paper workspace (create one once: `kraken workspace create dca --capital 10000 --mode paper`). Every session and order command below names it with `--workspace dca`. An exported `KRAKEN_WORKSPACE` does not reach a later shell, such as a `/loop` fire, and without a workspace `kraken order buy` trades the real account.
kraken --workspace dca session start \
--symbols BTC/USD --channels ticker,trade --to duckdb,jsonl \
--label dca-btc-$(date +%Y%m%d-%H%M%S) \
--strategy recipe-playground-dca \
--strategy-params '{"dollars_per_buy":100,"rounds":10,"interval_s":3600,"dip_threshold_pct":-0.10}' \
-o json 2>/dev/null &
# The session_started stdout line carries the id: {"type":"session_started","session":"s<n>",...}Print the session id to the user right after starting, and again in the final report — it is the handle for resuming the `/loop`, checking `kraken session show`, and locating the artifacts.
`/loop` owns the pacing. Set its interval to `interval_s` and it fires each round on cadence (late under jitter, never early). Parse the interval from the user's request: "every hour" to `1h`, "every 30 minutes" to `30m`, "twice a day" to `12h`.
**The scheduler floor is 60 seconds** (`/loop`, cron, and `ScheduleWakeup` all clamp to a one-minute minimum). `interval_s` must be `>= 60`; a sub-minute cadence is impossible — clamp to `60` and tell the user if they ask for less.
/loop 1h "Run one DCA round for session s<n> in workspace dca per recipe-playground-dca"
Do not re-add an elapsed-time gate inside the round. `/loop` already enforces the spacing.
On each firing: stop if the session is complete, otherwise READ, THINK, ACT.
Check the last completed round against `rounds`. The round cursor lives in the session's typed state cell (`kraken session state get/set`) — not in the decision log, whose reasons stay free narrative (keep writing "round N" in them for the post-mortem story, but nothing parses it). Reading the cursor is O(1) however long the session runs, and a typo'd field refuses at `set` instead of silently steering the loop:
ROUNDS=10 # the `rounds` you set in --strategy-params
SESSION_ID=s1 # from the session_started line
# The buys below are simulated only while dca is a paper workspace.
[ "$(kraken workspace show dca -o json 2>/dev/null | jq -r '.mode')" = paper ] \
|| { echo "workspace dca is missing or not paper; no round runs" >&2; exit 1; }
# The typed cursor is the loop's memory: unset reads as round 0, but a failed
# read must end the firing rather than restart at round 1.
STATE=$(kraken --workspace dca session state get --session "$SESSION_ID" -o json 2>/dev/null) || exit 1
LAST_ROUND=$(echo "$STATE" | jq '.cursor.round // 0')
if [ "${LAST_ROUND:-0}" -ge "$ROUNDS" ]; then
kraken --workspace dca session stop -o json 2>/dev/null
exit 0
fi
ROUND=$((LAST_ROUND + 1))
# CLAIM the round BEFORE acting: a crash after the claim skips one buy
# (harmless); the reverse order would redo the round and buy twice. `set`
# replaces the whole cursor — carry every field your strategy tracks.
kraken --workspace dca session state set --round "$ROUND" -o json 2>/dev/null || exit 1READ: price and the short-term average. Mind the response shapes: the ticker is keyed by Kraken's INTERNAL pair name (`XXBTZUSD`, not `BTC/USD`), so read the price through the value (`.[].last_price`). The ohlc rows live under `.candles`; read that array directly — the sibling `last` cursor would poison naive iteration of the object.
PRICE=$(kr
Trade on Kraken from your terminal, or let your AI agent trade for you. One install covers crypto, tokenized U.S. stocks and ETFs (for non-U.S. customers), forex, and futures. Every command can answer in JSON.
Price alerts, threshold monitoring, and notification triggers for agents.
Progress from manual trading to full agent autonomy with controlled risk at each level.
Capture the spot-futures price spread with delta-neutral basis trades.
Dollar cost averaging with scheduled buys and performance tracking.
Discover staking strategies, allocate funds, and track earn positions.
Handle order failures, network errors, and duplicate submissions safely.
Complete, populate and fill out 3-statement financial model templates (Income Statement, Balance Sheet, Cash Flow Statement) .…
Complete, populate and fill out 3-statement financial model templates (Income Statement, Balance Sheet, Cash Flow Statement) .…