smart-dca-bot
Coinbase 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.
AI-assisted dollar-cost averaging (DCA) bot for Coinbase Advanced Trade with three modes:
single_assetportfolioopportunity_scanner
All trades execute locally and directly against Coinbase APIs.
When to Use
- run smart dca on coinbase
- optimize recurring crypto buys
- rebalance dca portfolio allocations
- scan for dca opportunities with approval controls
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 execution strategies:vwap_optimizedmomentum_dipspread_optimizedtime_weightedsimple
- Mode 2 (
portfolio) with target allocations and drift-aware DCA - Mode 3 (
opportunity_scanner) with signals:oversold_rsivolume_spikemean_reversionnew_listinglearn_earn
- Coinbase-specific route selection (
ASSET-USDvsASSET-USDC) - Optional staking context and post-buy staking hints
- First-run Seren API key auto-registration (
SEREN_API_KEY) - Optional SerenDB persistence (
SERENDB_URL) - JSONL audit logs in
logs/ - Cost-basis lot tracking in
state/cost_basis_lots.json - Dry-run default, explicit live opt-in
Setup
- Copy
.env.exampleto.envand set credentials. - Copy
config.example.jsontoconfig.json. - Install dependencies:
pip install -r requirements.txt
- (Optional) initialize SerenDB schema:
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": falseinconfig.json python scripts/agent.py --config config.json --allow-live --accept-risk-disclaimer
- set
Workflow Summary
- Validate config and risk policy caps.
- Ensure
SEREN_API_KEY(validate existing or auto-register). - Build market snapshots and select execution route (
USDvsUSDC). - Compute strategy decision and risk-gate execution.
- Execute locally to Coinbase (or simulate in dry-run).
- Persist runs, snapshots, signals, and cost-basis lots.
- Emit structured audit logs.
Trade Execution Contract
When the user says sell, close, exit, unwind, or flatten, stop new DCA entries immediately, cancel tracked pending Coinbase 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_KEYand Coinbase API credentials are loaded. - Verify the selected route, balances, and cash reserve support the requested notional.
- Verify Python dependencies from
requirements.txtare 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, Coinbase credentials, and Python dependencies from requirements.txt are installed and loaded. SERENDB_URL is optional, but if exchange credentials are missing or the Coinbase 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 Coinbase 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 automation software, not an advisor.
- RISK OF LOSS: Crypto trading can lose principal and more in volatile markets.
- NO GUARANTEES: Optimization logic may not outperform naive scheduled DCA.
- LOCAL EXECUTION ONLY: Trades run locally and directly against Coinbase.
- API KEY SECURITY: Coinbase credentials remain local and are never sent to Seren.
- STAKING RISK: APY varies and staking may involve lockup/slashing risk.
- REGULATORY/TAX: You are responsible for legal/tax compliance in your jurisdiction.
- NO AFFILIATION: This skill is not affiliated with or endorsed by Coinbase.
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": "coinbase-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.
More from serenorg/seren-skills
polymarket-bot
Autonomous trading agent for Polymarket prediction markets using Seren ecosystem
9polymarket-maker-rebate-bot
Provide two-sided liquidity on Polymarket with rebate-aware quoting, inventory controls, and dry-run-first execution for binary markets.
6saas-short-trader
Alpaca-branded SaaS short trader with MCP-native execution: scores AI disruption risk, builds capped short baskets, and tracks paper/live PnL in SerenDB.
2high-throughput-paired-basis-maker
Run a paired-market basis strategy on Polymarket with mandatory backtest-first gating before trade intents.
2seren-bounty
Work with Seren Bounty affiliate bounties: customers create and fund verifier-backed bounties; agents join to receive a referral_code and accrue earnings as qualifying events are verified; a release sweep pays matured earnings out of escrow.
2budget-tracker
Compare actual Wells Fargo spending against user-defined monthly budgets per category, calculate variance, and track budget adherence over time.
1