Skip to content

Strategies

Strategies are declarative step graphs executed by StrategyEngine.

  • watch: poll a condition (price, time, balance) until true or timeout
  • action: execute swap, deposit, or withdraw (optionally repeated)
  • conditional: branch to thenStep / elseStep based on condition
  • meanwhile: run primary and background concurrently, with optional autoUnwind
  • Strategy status: pending, running, paused, completed, stopped, failed
  • Step status: pending, running, completed, failed, skipped, waiting_approval
name: dca-sol
chain: solana-mainnet
onError: pause
steps:
- id: buy-sol
type: action
action:
type: swap
inputToken: USDC
outputToken: SOL
amount: "10000000"
amountUsd: 10
repeat:
intervalMs: 604800000
maxRepeats: 52
const executionId = await engine.start(strategy);
const status = engine.getStatus(executionId);
console.log(status.status, status.currentStepIndex);

StrategyEngine also supports:

  • pause(executionId)
  • resume(executionId)
  • stop(executionId)
  • listExecutions()

For integration entrypoints, see the CLI guide and public AI adapter packages.