WhaleRider
One language. Every signal.
Define cross-domain trading strategies in YAML, compile them into fixed
.wr artifacts, and run the same artifacts in simulation or live trading.
WhaleRider by Rocksoldi
WhaleRider is a strategy compiler and deterministic trading runtime. Its YAML language can combine technical, fundamental, market breadth, insider, and economic data in one strategy definition.
YAML source -> .wr artifact -> Simulation / Live
The compiler validates the declaration and creates a fixed execution plan. When the runtime receives the same inputs, the strategy produces the same decisions.
Why compile strategies?
- Validate the complete strategy before execution.
- Keep trading logic in a versioned, portable artifact.
- Use the same artifact in simulation and live trading.
- Trace each decision from its YAML declaration to the resulting trade.
- Separate strategy logic, risk policy, and execution context.
Workflow
| Step |
Action |
Result |
| 01 |
Define |
Write strategy logic, risk, and execution settings in YAML. |
| 02 |
Compile |
Validate the YAML and produce a .wr artifact. |
| 03 |
Run |
Use the artifact in simulation or live execution. |
| 04 |
Inspect |
Query runs, trades, performance, and risk from the CLI. |
Core files
| Component |
YAML file |
Purpose |
| Trade plan |
*.trade-plan.yaml |
Indicators, signals, entry and exit criteria, universe, and position risk. |
| Risk policy |
*.risk-policy.yaml |
Account-level investment, margin, commission, and trade-risk limits. |
| Strategy |
*.strategy.yaml |
Composition of a trade plan and risk policy. |
| Simulation |
*.simulation.yaml |
Historical period, starting capital, and strategy execution context. |
Strategy composition
A WhaleRider strategy is composed of two independently defined components:
- Trade plan — defines what and when to trade: universe, indicators, signals, entry and exit criteria, and trade-level exits.
- Risk policy — defines how the account may allocate capital: margin, maximum position value, and maximum risk per position.
Trade plan (.wr) ─┐
├─> Strategy (.wr) ─> Simulation / Live
Risk policy (.wr) ─┘
The trade plan and risk policy are compiled and deployed separately. Their deployed IDs are then linked by a strategy definition.
Risk policy
This medium-risk policy allows a position to use at most 50% of account value and risk at most 2% of account value.
NAME: MEDIUM_RISK
INITIAL_MARGIN_RATE: 0.5
MAINTENANCE_MARGIN_RATE: 0.25
MAX_POSITION_VALUE_PCT: 50
MAX_POSITION_RISK_PCT: 2
Strategy
The strategy connects one deployed risk policy to one deployed trade plan.
NAME: MEDIUM_RISK_EMA_CROSSOVER
RISK_POLICY_ID: <RISK_POLICY_ID>
TRADE_PLAN_ID: <TRADE_PLAN_ID>
Open the risk policy · Open the strategy definition
Quick start
1. Install the VS Code extension
The extension provides completion, schema validation, and diagnostics for WhaleRider YAML files.
- Open Extensions in VS Code.
- Search for WhaleRider DSL.
- Select WhaleRider DSL and click Install.
2. Install the CLI
Windows PowerShell
irm https://cli.whalerider.org | iex
Linux
curl -s https://cli.whalerider.org/install-wr.sh | tr -d '\r' | bash
Verify the installation:
wr --version
3. Compile locally
Compilation does not require an access profile.
wr compile --file ema-crossover.trade-plan.yaml
The command validates the YAML and creates a compiled .wr artifact.
Trade plan example
This long-only EMA crossover is a small complete trade plan. It enters when the 20-day EMA is above the 50-day EMA and exits when that relationship reverses.
# EMA Crossover
#
# A small long-only trend strategy.
# Enter when the fast EMA moves above the slow EMA.
# Exit when the fast EMA moves below the slow EMA.
NAME: EMA_CROSSOVER
SIDE: LONG
RISK:
ATR_INTERVAL: DAY
ATR_LOOKBACK: 14
STOP_LOSS_ATR: 2
TAKE_PROFIT_ATR: 4
HOLDING_MAX_PERIOD: 120D
UNIVERSE:
MARKET_INDICES:
- SP500
MIN_MKT_CAP: 5000000000
MIN_AVG_VOLUME: 1000000
INDICATORS:
- NAME: EMA20
DOMAIN: CANDLE
INTERVAL: DAY
MEASUREMENT: Close
STEPS:
- TYPE: EMA
LOOKBACK: 20
- NAME: EMA50
DOMAIN: CANDLE
INTERVAL: DAY
MEASUREMENT: Close
STEPS:
- TYPE: EMA
LOOKBACK: 50
SIGNALS:
- NAME: TREND_UP
IS: EMA20 > EMA50
- NAME: TREND_DOWN
IS: EMA20 < EMA50
CRITERIA:
ENTER:
IF: TREND_UP
EXIT:
IF: TREND_DOWN
Open the complete EMA crossover file
Strategy examples
The examples progress from a basic technical rule to multi-domain strategies and ordered state machines.
| Order |
Example |
Difficulty |
Domains |
What it demonstrates |
| 01 |
EMA crossover |
Simple |
Technical |
Daily indicators, signals, risk, and direct entry/exit criteria. |
| 02 |
Breadth recovery |
Intermediate |
Technical + breadth |
A sequential recovery state machine with an abort path. |
| 03 |
Quality value |
Advanced |
Fundamentals + technical |
Valuation, profitability, debt, liquidity, and a long-term trend filter. |
| 04 |
Insider conviction |
Advanced |
Insiders + economy + technical |
Insider accumulation, macro conditions, and price trend in one strategy. |
[!NOTE]
These examples demonstrate the WhaleRider language. They are research starting points, not investment advice or a guarantee of returns.
CLI reference
Setup
wr --version
wr profile set --name <NAME> --access-key <ACCESS_KEY>
wr profile use --name <NAME>
wr profile list
Profiles are required for platform operations. Local compilation does not require a profile.
Compile and deploy artifacts
wr compile --file <NAME>.trade-plan.yaml
wr compile --file <NAME>.risk-policy.yaml
wr compile --file <NAME>.strategy.yaml
wr deploy --file <NAME>.<COMPONENT>.wr
Run and inspect simulations
wr simulation run --simulation-id <SIMULATION_ID>
wr simulation run get --simulation-run-id <RUN_ID>
wr simulation run list --table
wr simulation run performance get --simulation-run-id <RUN_ID> --group-interval ALL --table
Inspect deployed definitions and trades
wr strategy list --table
wr trade-plan list --table
wr broker-account config list --table
wr trade list --broker-account-id <ACCOUNT_ID> --skip 0 --limit 20 --table
Use wr help to list commands, or wr help <command> for command-specific options.
VS Code authoring
WhaleRider DSL helps author:
- nested entry and exit criteria;
- indicator measurements, intervals, lookbacks, and transforms;
- named signals and expressions;
- ATR-based risk settings; and
- market universes and ticker filters.

Deterministic execution
.yaml defines intent.
.wr defines execution.
Compilation creates a fixed strategy artifact with no hidden script state. That artifact is the unit deployed to each supported runtime.
For more detail, read Strategies are compiled programs.
Questions or access requests: whalerider@rocksoldi.com
WhaleRider by Rocksoldi.