Recipe Playground Dca Triggered logo

Recipe Playground Dca Triggered

Organization
krakenfx
recipe-playground-dca-triggered

Example driver: dip-triggered dollar-cost-averaging on a live WebSocket stream, recorded to a session.

Overview

Publisherkrakenfx
Repositorykraken-cli
Skill namerecipe-playground-dca-triggered
Stars
754
Forks
104
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by krakenfx on GitHub. Read the source before you install it.

Installation

Install the Recipe Playground Dca Triggered AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/krakenfx/kraken-cli/tree/main/skills/recipe-playground-dca-triggered
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/krakenfx/kraken-cli.git /tmp/kraken-cli
mkdir -p .claude/skills
cp -r /tmp/kraken-cli/skills/recipe-playground-dca-triggered .claude/skills/recipe-playground-dca-triggered
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Recipe Playground Dca Triggered in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Recipe Playground Dca Triggered on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Recipe Playground Dca Triggered is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Playground: DCA (Dip-Triggered)

PREREQUISITE: Load kraken-playground, kraken-dca-strategy, and kraken-ws-streaming 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).

Buy the instant price dips below a short-term average, not on a fixed clock. A WebSocket ticker stream drives the loop and every qualifying tick is a candidate buy, rate-limited so buys stay spaced. Record every buy and skip into one session for later replay and P&L.

Use this skill for:

  • catching an intra-interval dip that a time-based sampler would miss
  • event-driven DCA where the trigger is a price condition, not a clock
  • recording a streamed decision loop for replay

Important

This recipe records a session. 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).

The stream is the loop, not /loop. A while read over a stream is a long-lived process that holds state (the reference average, the last-buy time) in memory across events. This is a deliberate exception to the stateless-round model (see kraken-playground → Running over a Window); keep the session short and the state minimal.

The stream is blind during reconnect gaps. The CLI reconnects with paced exponential backoff (up to 12 attempts per stream lifecycle, see kraken-ws-streaming), and any dip inside that window is missed. The recorder tolerates gaps; a decision loop does not.

Params

Every number that gates a buy goes in --strategy-params:

  • dollars_per_buy: quote currency deployed per triggered buy
  • dip_threshold_pct: buy when price is at least this far below the short-term average
  • min_spacing_s: minimum seconds between buys; the rate limit on the trigger. Enforce it from the typed cursor: kraken session state set --last-action-at <now> after each buy, and skip the trigger while now - .cursor.last_action_at < min_spacing_s (kraken session state get)
  • max_buys: session length in buys; stop after this many
  • sma_refresh_s: how often to refresh the reference average from REST

Quick Start

Natural language:

Dollar-cost-average into Bitcoin. Watch the live price and buy $100 whenever
it dips more than 0.10% below the 1-hour SMA, but no more than once every
20 minutes, up to 10 buys. Record all buys and skips. At the end, show P&L.

Start the Session

Work inside a paper workspace (create one once: kraken workspace create dcatrig --capital 10000 --mode paper), then:

bash
export KRAKEN_WORKSPACE=dcatrig

kraken session start \
  --symbols BTC/USD --channels ticker,trade --to duckdb,jsonl \
  --label dcatrig-btc-$(date +%Y%m%d-%H%M%S) \
  --strategy recipe-playground-dca-triggered \
  --strategy-params '{"dollars_per_buy":100,"dip_threshold_pct":-0.10,"min_spacing_s":1200,"max_buys":10,"sma_refresh_s":300}' \
  -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 checking kraken session show and locating the artifacts.

Stream and Decide

Subscribe to the ticker with the BBO trigger to cut noise, and act on each tick. Hold the reference average and the last-buy time in the loop; refresh the average from REST every sma_refresh_s, not on the tick rate.

Bind the gating numbers to the same --strategy-params you recorded, so the loop runs the hypothesis you started — never hardcode them into the arithmetic:

bash
DOLLARS_PER_BUY=100
DIP_THRESHOLD_PCT=-0.10
MIN_SPACING_S=1200
MAX_BUYS=10
SMA_REFRESH_S=300

# True 1h SMA: last twelve 5-minute closes. (--interval 60 would average the
# whole returned window — a multi-day mean, not 1h.)
SMA=$(kraken ohlc BTCUSD --interval 5 -o json 2>/dev/null | jq '[.candles[-12:][].close] | add/length')
SMA_TS=$(date +%s)
LAST_BUY=0
BUYS=0

kraken ws ticker BTC/USD --event-trigger bbo -o json 2>/dev/null | while read -r line; do
  PRICE=$(echo "$line" | jq -r '.data[0].last // empty'); [ -z "$PRICE" ] && continue
  NOW=$(date +%s)

  # Refresh SMA on its own cadence, not per tick
  if [ $((NOW - SMA_TS)) -ge $SMA_REFRESH_S ]; then
    SMA=$(kraken ohlc BTCUSD --interval 5 -o json 2>/dev/null | jq '[.candles[-12:][].close] | add/length')
    SMA_TS=$NOW
  fi

  # Fail loud, never fabricate: a broken READ must not gate a buy or write a reason.
  if [ -z "$PRICE" ] || [ -z "$SMA" ]; then
    kraken session note --kind alert --symbol BTC/USD \
      --reason "tick skipped: READ failed (price='$PRICE' sma='$SMA')" -o json 2>/dev/null
    continue
  fi
  VS_SMA=$(echo "scale=6; (($PRICE - $SMA) / $SMA) * 100" | bc -l)

  # THINK: dip tripped AND rate limit satisfied?
  if (( $(echo "$VS_SMA <= $DIP_THRESHOLD_PCT" | bc -l) )) && [ $((NOW - LAST_BUY)) -ge $MIN_SPACING_S ]; then
    VOL=$(echo "scale=8; $DOLLARS_PER_BUY / $PRICE" | bc -l)
    kraken order buy BTC/USD "$VOL" --type market \
      --reason "dip-triggered buy: BTC/USD at $PRICE is ${VS_SMA}% below 1h SMA $SMA (threshold ${DIP_THRESHOLD_PCT}%); deploying \$$DOLLARS_PER_BUY" \
      -o json 2>/dev/null
    LAST_BUY=$NOW
    BUYS=$((BUYS + 1))
    [ $BUYS -ge $MAX_BUYS ] && break
  fi
done

kraken session stop -o json 2>/dev/null

Notes on the decision:

  • min_spacing_s is a real rate limit on the trigger, not the sampling bookkeeping the time-gated recipe removed. It stops a sustained dip from firing on every tick.
  • Refresh the average on sma_refresh_s. Recomputing it per tick burns REST calls for a number that barely moves.
  • Log skips sparingly. A stream produces many non-qualifying ticks; noting each one floods the decision log. Note only meaningful events (a dip that was rate-limited, a wide spread), never every tick.

Stop and Review

bash
kraken session show -o json 2>/dev/null | jq '.summary'

kraken session decisions --session s<n> -o json 2>/dev/null \
  | jq -c '.decisions[] | {kind, symbol, reason}'

Report:

  • buys placed vs max_buys, and time between them
  • average fill cost vs window mean
  • how many dips were caught vs rate-limited
  • P&L, and whether the dip threshold and spacing fit the tape

Hard Rules

  • This recipe records a session. It never places a live order.
  • The stream is the loop. Do not also wrap it in /loop; that is two clocks on one decision.
  • Treat stream output as NDJSON, one object per line. Never parse it as a single document (see kraken-ws-streaming).
  • The loop is blind during reconnect gaps. Keep the session short and accept that dips inside a backoff window are missed.
  • Rate-limit buys with min_spacing_s so a sustained dip does not fire on every tick.
  • Keep every gating number in --strategy-params and the arithmetic in jq/bc.
  • The session directory (decisions.jsonl and the DuckDB/JSONL sinks) is owned by the CLI recorder. The agent only reads it, and only for the stop-time summary. Never write, edit, mkdir, or append inside it — every buy goes through kraken paper buy, so the recorder stays the single writer.
  • If you hit a mismatch between what you are trying to do and the CLI's interface or responses — including a mismatch between this skill and the installed CLI version's contract — feel free to submit feedback with kraken feedback.

Frequently asked questions

What does the Recipe Playground Dca Triggered AI skill do?

Example driver: dip-triggered dollar-cost-averaging on a live WebSocket stream, recorded to a session.

Why use Recipe Playground Dca Triggered on TypingMind?

Because you install it once and use it with any model. Recipe Playground Dca Triggered is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Recipe Playground Dca Triggered in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/krakenfx/kraken-cli/tree/main/skills/recipe-playground-dca-triggered. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Recipe Playground Dca Triggered?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Recipe Playground Dca Triggered?

As many as you like. As long as a model supports skills, you can use Recipe Playground Dca Triggered with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Recipe Playground Dca Triggered AI skill free?

Yes. It is published on GitHub by krakenfx under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇