WU Trading Library 0.2.0
A backtesting and trading strategy library
Loading...
Searching...
No Matches
WU_Runner Struct Reference

WU_Runner is a backtest runner that processes data from multiple readers, updates a strategy, and executes trades in a portfolio. More...

#include <runners.h>

Data Fields

WU_Portfolio portfolio
WU_Strategy strategy
WU_Reader * readers
int num_readers
void(* run )(struct WU_Runner_ *runner, bool verbose)

Detailed Description

WU_Runner is a backtest runner that processes data from multiple readers, updates a strategy, and executes trades in a portfolio.

Key features:

  • Supports both single-input and multi-input strategies
  • Validates reader count matches strategy input requirements
  • Validates and converts data types automatically (e.g., Candle → Single)
  • Synchronizes data from multiple readers sequentially (lockstep)
  • No fixed limits on number of inputs (heap-allocated)

Usage: // Single-input strategy (e.g., crossover on SPY) WU_Reader readers[] = {spy_reader}; WU_Runner runner = wu_runner_new(portfolio, strategy, readers);

// Multi-input strategy (e.g., pairs trading on SPY/QQQ) WU_Reader readers[] = {spy_reader, qqq_reader}; WU_Runner runner = wu_runner_new(portfolio, strategy, readers);

wu_runner_exec(runner, verbose); wu_runner_free(runner);

Definition at line 32 of file runners.h.

Field Documentation

◆ num_readers

int WU_Runner::num_readers

Definition at line 36 of file runners.h.

◆ portfolio

WU_Portfolio WU_Runner::portfolio

Definition at line 33 of file runners.h.

◆ readers

WU_Reader* WU_Runner::readers

Definition at line 35 of file runners.h.

◆ run

void(* WU_Runner::run) (struct WU_Runner_ *runner, bool verbose)

Definition at line 37 of file runners.h.

◆ strategy

WU_Strategy WU_Runner::strategy

Definition at line 34 of file runners.h.


The documentation for this struct was generated from the following file: