Manage running strategy daemons — start, stop, monitor, promote. Triggers on run strategy, start daemon, stop strategy, check running, promote to production, strategy status.
Manage defi-flow strategy daemons. Start strategies as background processes, monitor their health, and promote from dry-run to production.
IMPORTANT: Always pass --registry-dir /app/.defi-flow to every defi-flow daemon command. This directory is volume-mounted and persists across container restarts. Strategies registered here will auto-resume on redeploy.
defi-flow ps --registry-dir /app/.defi-flow
Output shows name, mode (dry-run/live), network, PID, TVL, uptime, and status (running/crashed).
# Create directories
mkdir -p /app/.defi-flow/logs /app/.defi-flow/state
# Start as daemon on mainnet
nohup defi-flow run /app/strategies/<name>.json \
--state-file /app/.defi-flow/state/<name>.state.json \
--log-file /app/.defi-flow/logs/<name>.log \
--network mainnet \
--registry-dir /app/.defi-flow \
> /app/.defi-flow/logs/<name>.log 2>&1 &
# Verify it registered
defi-flow ps --registry-dir /app/.defi-flow
The run command self-registers in the daemon registry with its PID, mode, and paths.
# Last 50 lines
defi-flow logs <name> --registry-dir /app/.defi-flow
# Follow live output
defi-flow logs <name> -f --registry-dir /app/.defi-flow
# Last 200 lines
defi-flow logs <name> -n 200 --registry-dir /app/.defi-flow
defi-flow stop <name> --registry-dir /app/.defi-flow
Sends SIGTERM for graceful shutdown (state is saved), then deregisters from the registry.
# Check all daemons
defi-flow ps --registry-dir /app/.defi-flow
# For each "crashed" entry, investigate:
defi-flow logs <name> -n 100 --registry-dir /app/.defi-flow
# Restart crashed strategies
defi-flow query /app/strategies/<name>.json \
--state-file /app/.defi-flow/state/<name>.state.json
Returns JSON with per-venue breakdown, wallet token balances, and cumulative metrics. Use this to verify a strategy is actually deployed and has TVL > 0.
--network mainnet. The default is testnet which won't execute real trades. Every defi-flow run command MUST include --network mainnet.defi-flow ps regularly — restart crashed daemons.--log-file so defi-flow logs works.--state-file.defi-flow query 60s after starting a daemon to confirm TVL > 0. If TVL is 0, check logs and fix.| Issue | Fix |
|---|---|
defi-flow ps shows "crashed" | Check logs: defi-flow logs <name> -n 100. Restart if transient. |
| PID alive but no state updates | Check last_tick in state file. May be stuck — stop and restart. |
| Strategy shows $0 TVL | Deploy phase may have failed. Check logs for "Deploy phase" errors. Run defi-flow query to verify on-chain. |
| Can't stop — PID stale | defi-flow stop <name> handles stale PIDs (cleans registry). |
| Strategy deployed but no trades | Check --network mainnet was used. Default is testnet! |