Skip to content

BTC Dip Buy Walkthrough

This example (examples/btc-dip-buy) is a docs-first strategy lifecycle demo.

Terminal window
npx tsx examples/btc-dip-buy/demo.ts
  1. Load YAML strategy
  2. Parse and validate with parseStrategyFromYaml
  3. Start StrategyEngine
  4. Observe watch, action, and conditional step transitions
  5. Print final execution state
import { readFile } from 'node:fs/promises';
import { parseStrategyFromYaml, type Strategy } from '@stendar/core';
const strategyYaml = await readFile('./strategy.yaml', 'utf8');
const strategy: Strategy = parseStrategyFromYaml(strategyYaml);

The demo uses a mocked runtime to keep iteration local and deterministic.

  • strategy:started
  • strategy:step_started
  • strategy:step_completed
  • strategy:completed

When adapting this to live execution, swap in real runtime adapters/providers as shown in First strategy.