| name | smart-dca-bot |
| description | AI-optimized Kraken DCA bot with single-asset, portfolio, and scanner modes using local direct execution and strict safety controls. |
Kraken Smart DCA Bot
For Claude: How to Use This Skill
Skill instructions are preloaded in context when this skill is active. Do not perform filesystem searches or tool-driven exploration to rediscover them; use the guidance below directly.
Windows / Seren Desktop Python Runtime
Seren Desktop bundles Python on Windows and prepends the bundled runtime to child-process PATH. When running from Seren Desktop on Windows, use the documented python3 ... commands as written; they resolve to Seren Desktop's bundled python3.exe even when system Python is not installed. Do not translate python3 to python, do not invoke the Microsoft Store Python stub, and do not ask the user to install system Python just to run this skill from Seren Desktop. If a snippet includes Unix virtualenv activation such as source .venv/bin/activate, skip that prefix inside Windows Desktop and run the same command beginning with python3 .... Outside Seren Desktop, use an installed Python 3.11+ interpreter or a project .venv.
AI-assisted dollar-cost averaging (DCA) bot for Kraken with three modes:
single_asset
portfolio
scanner
All trades are executed locally and directly against Kraken REST APIs.
When to Use
- run smart dca on kraken
- optimize recurring crypto buys
- rebalance dca portfolio allocations
- scan for dca opportunities on kraken
On Invoke
Immediately run a dry-run DCA cycle without asking. Do not present a menu of modes or strategies. Execute:
cd ~/.config/seren/skills/smart-dca-bot && source .venv/bin/activate && python3 scripts/agent.py --config config.json --accept-risk-disclaimer
Display the full dry-run results to the user. Only after results are displayed, present available next steps (live mode, strategy changes). If the user explicitly requests a specific mode in their invocation message, run that mode instead.
What This Skill Provides
- Mode 1 (
single_asset) with 5 strategies:
vwap_optimized
momentum_dip
spread_optimized
time_weighted
simple
- Mode 2 (
portfolio) with target allocations and drift detection
- Mode 3 (
scanner) with four signal families:
oversold_rsi
volume_spike
mean_reversion
new_listing
- scanner allocations default to
portfolio.allocations unless scanner.base_allocations is provided
- scanner approval actions:
pending (default), approve, modify, skip
- Direct Kraken API integration (no Seren trading proxy)
- Seren API key resolution from Seren Desktop
API_KEY, shell SEREN_API_KEY, or the skill .env
- Optional SerenDB schema + persistence (
SERENDB_URL)
- JSONL audit logging (
logs/*.jsonl)
- Cost-basis lot tracking (
state/cost_basis_lots.json)
- Dry-run mode by default
- Cron/webhook support (
run_agent_server.py, setup_cron.py)
API Key Setup
Before running this skill, check for an existing Seren API key in this order:
- Seren Desktop auth — if the skill is running inside Seren Desktop, the runtime injects
API_KEY automatically. Check: echo $API_KEY. If set, no further action is needed.
- Existing
.env file — check if SEREN_API_KEY is already set in the skill's .env file. If set, no further action is needed.
- Shell environment — check if
SEREN_API_KEY is exported in the current shell. If set, no further action is needed.
If none of the above are set, stop and ask the user to create or provide a Seren API key. Write it to the skill's .env file:
SEREN_API_KEY=<the-returned-key>
Verify:
curl -sS "https://api.serendb.com/auth/me" \
-H "Authorization: Bearer $SEREN_API_KEY"
Do not attempt unauthenticated auto-registration. Dry-run and setup should fail with a clear SEREN_API_KEY setup message instead of calling a key-creation endpoint.
Reference: https://docs.serendb.com/skills.md
Setup
- Copy
.env.example to .env and fill credentials.
- Copy
config.example.json to config.json.
- Install dependencies:
pip install -r requirements.txt
- Initialize SerenDB schema (optional, requires
SERENDB_URL):
python scripts/setup_serendb.py
- Run dry mode:
python scripts/agent.py --config config.json --accept-risk-disclaimer
- Run live mode (explicit opt-in only):
- set
"dry_run": false in config.json
python scripts/agent.py --config config.json --allow-live --accept-risk-disclaimer
Workflow Summary
- Validate config and policy caps.
- Ensure
SEREN_API_KEY or Seren Desktop API_KEY is present and valid.
- Build DCA window and market snapshot(s).
- Select strategy decision and risk-gate execution.
- Execute locally to Kraken (or simulate in dry-run).
- Persist runs, snapshots, scanner signals, and cost-basis lots.
- Emit JSONL audit events.
Trade Execution Contract
When the user says sell, close, exit, unwind, or flatten, stop new DCA entries immediately, cancel tracked pending Kraken orders, and ask only the minimum clarifying question needed if the user also wants held spot inventory liquidated.
Pre-Trade Checklist
Before any live run --allow-live --accept-risk-disclaimer or loop --allow-live --accept-risk-disclaimer execution:
- Verify
SEREN_API_KEY and Kraken API credentials are loaded.
- Verify the requested notional, balances, and cash reserve fit the account.
- Verify Python dependencies from
requirements.txt are installed and the venue client can load.
- If any credential, dependency, or balance probe fails, stop here and fail closed instead of placing orders.
Dependency Validation
Dependency validation is required before live trading. Verify SEREN_API_KEY, Kraken credentials, and Python dependencies from requirements.txt are installed and loaded. SERENDB_URL is optional, but if exchange credentials are missing or the Kraken client cannot be initialized, the runtime must stop with an error instead of submitting orders.
Emergency Exit Path
To stop trading immediately, run python scripts/agent.py stop-trading --config config.json. The stop-trading path cancels tracked pending Kraken orders without asking for an extra live confirmation, writes the remaining local state to disk, and leaves held spot positions untouched until the operator chooses how to liquidate them.
Required Disclaimers
IMPORTANT DISCLAIMERS — READ BEFORE USING
-
NOT FINANCIAL ADVICE: This skill is a software tool, not a financial advisor.
It does not provide investment, financial, tax, or legal advice. All trading
decisions are made by you. Consult a licensed financial advisor before investing.
-
RISK OF LOSS: Cryptocurrency trading involves substantial risk of loss. Prices
can decline significantly. You may lose some or all of your invested capital.
Only invest money you can afford to lose entirely.
-
NO GUARANTEES: Past performance does not guarantee future results. The
optimization algorithms attempt to improve execution timing but cannot guarantee
better prices than naive DCA. Market conditions may render optimizations
ineffective.
-
LOCAL EXECUTION ONLY: All trades are executed locally on your machine, directly
to the Kraken API using your personal API credentials. No trades flow through
Seren Gateway or any third-party intermediary. SerenAI does not have access to
your Kraken account, funds, or trading activity.
-
API KEY SECURITY: Your Kraken API keys are stored locally in your .env file and
are never transmitted to SerenAI servers. You are responsible for securing your
API credentials. Use IP whitelisting and withdrawal restrictions on Kraken.
-
EXCHANGE RISK: This skill depends on Kraken's API availability. Exchange
outages, maintenance windows, or API changes may affect execution. The skill
includes fallback logic but cannot guarantee execution during exchange issues.
-
TAX IMPLICATIONS: Each DCA purchase creates a taxable lot in many jurisdictions.
You are responsible for tracking cost basis and reporting to tax authorities.
The cost_basis_lots table is provided for convenience but is not tax advice.
-
REGULATORY COMPLIANCE: Cryptocurrency regulations vary by jurisdiction. You are
responsible for ensuring compliance with all applicable laws and regulations in
your jurisdiction.
-
SOFTWARE PROVIDED AS-IS: This skill is provided "as is" without warranty of any
kind. The authors and SerenAI are not liable for any losses, damages, or costs
arising from the use of this software.
Seren-Cron Integration
Use seren-cron to run this skill on a schedule — no terminal windows to keep open, no daemons, no permanent computer changes required. Seren-cron is a cloud scheduler that calls your local trigger server on a cron schedule.
Requirements: Seren Desktop login or a valid SEREN_API_KEY.
Step 1 — Check seren-cron is available
Before scheduling, verify the publisher is reachable using mcp__seren__call_publisher:
publisher: seren-cron
path: /health
method: GET
If this call fails, stop here and tell the user:
"The seren-cron service could not be reached. Please send this error to hello@serendb.com for support."
Step 2 — Review active cron jobs (always do this first)
Always check for existing scheduled jobs before creating a new one. A user may have forgotten a live job is already running.
publisher: seren-cron
path: /jobs
method: GET
If jobs for this skill already exist, show them to the user and ask:
"You have [N] active cron job(s) for this skill. Would you like to:
- Keep them running (recommended if intentional)
- Stop all and create a new schedule
- Cancel"
Do not create a duplicate cron job without explicit user confirmation.
Step 3 — Start the local trigger server
Start the webhook server that seren-cron will call on each scheduled tick:
SEREN_API_KEY="$SEREN_API_KEY" python3 scripts/run_agent_server.py --config config.json --port 8080
This process runs in your terminal session. When you close the terminal, it stops — that is expected and correct. Seren-cron handles the scheduling; your local server handles execution.
Step 4 — Create the cron schedule
With the server running, create the scheduled job:
publisher: seren-cron
path: /jobs
method: POST
body: {
"name": "kraken-smart-dca-live",
"url": "http://localhost:8080/run",
"method": "POST",
"cron_expression": "0 */6 * * *",
"timezone": "UTC",
"enabled": true,
"timeout_seconds": 60
}
Save the returned job_id — you need it to pause, resume, or delete the job later.
Step 5 — Manage the schedule
List all active jobs:
publisher: seren-cron, path: /jobs, method: GET
Pause:
publisher: seren-cron, path: /jobs/{job_id}/pause, method: POST
Resume:
publisher: seren-cron, path: /jobs/{job_id}/resume, method: POST
Stop permanently:
publisher: seren-cron, path: /jobs/{job_id}, method: DELETE
Insufficient Funds Guard
If a live trade or cycle fails because the trading balance or SerenBucks balance is too low to execute, immediately pause the cron job:
publisher: seren-cron, path: /jobs/{job_id}/pause, method: POST
Then tell the user:
"Automated trading has been paused: insufficient funds detected. Please top up your balance before resuming the schedule."
Never allow the cron to keep firing when there are no funds available to trade.