Skip to content

Model TutorialStrategyDemo

github-actions[bot] edited this page Oct 18, 2026 · 8 revisions

TutorialStrategyDemo — AlgoQuant usage tutorial

Wiki home · Tutorials · Execution records

These examples are tutorials that teach how to use AlgoQuant. Their numerical results are incidental and irrelevant to their teaching purpose. Use them to learn API calls, simulation setup, data flow and reporting. The technical examples use synthetic quick-mode data. Read a result here as an illustration of a library call, not as investment evidence.

Tutorials and quantitative model references · Pinned source · Javadoc

Strategy introduction

This is an event-driven API lesson rather than a model attributed to a research paper. Its purpose is to show how market data reaches a strategy, how the strategy creates orders and how the simulator records executions and performance.

A complete backtest requires more than a signal formula: data timing, order sizing, fills, account valuation and reporting must agree. Following those components in a small example helps explain how to call the library before introducing a more elaborate statistical model.

The selected rule is instructional. Neither a completed simulator run nor an exported chart validates the rule as an investment strategy. Use the source and observed output to learn the execution lifecycle and identify which assumptions a future production strategy would need to make explicit.

How this demo connects to the idea

This is an event-handling lesson rather than a published econometric model. Price direction selects a fixed signed-unit target and the existing position determines the incremental order. See TutorialStrategy for equal-price behavior and the companion demo for monthly sampling.

What this example teaches

Demonstrates how to set up the simulator to simulate the tutorial strategy, TutorialStrategy.

Using this example. End-to-end wiring for TutorialStrategy: Yahoo history is sampled monthly, wrapped in OrderBookCaches and passed to SimpleSimulatorBuilder. Initial capital is set to the first sampled price, while the strategy still targets one unit. Registered yearly measures use annual return periods even though the strategy receives monthly observations.

Model and publication. No single original research publication is claimed for this library/example policy.

Implementation in this tutorial. This is an event-handling lesson rather than a published econometric model. Price direction selects a fixed signed-unit target and the existing position determines the incremental order. See TutorialStrategy for equal-price behavior and the companion demo for monthly sampling.

Verified execution record

Item Value
Status completed
Run 39114360151
UTC publication 2026-10-18 11:43 UTC
Source commit 355aa9242fc2a247b256aecc8406cbb409aa5ff3
Data mode original main defaults
Exit code 0
Elapsed seconds 3.65
Time limit seconds 180
Maximum Java heap 1200m

The original main returned successfully. Read the output and model assumptions before interpreting it.

Reproduce the calculation

Follow the repository setup for JDK 8, Maven credentials and an external NM license. From the repository root:

mvn -U -Dmaven.test.skip=true clean package
mvn exec:java -Dexec.mainClass=tech.nmfin.algoquant.demo.model.tutorial.TutorialStrategyDemo

The automated run uses scripts/ModelDemoRunner.java to initialize the external license before the unchanged main, save JFreeChart windows as PNGs, and exit after main returns. It uses an isolated working directory with the repository datasets/configuration linked in. Running directly may leave desktop windows open.

Observed output


09:12:37.185 [main] INFO  t.n.algoquant.util.config.AQConfig,194 - looking up configuration file: config.default.xml
09:12:37.191 [main] INFO  t.n.algoquant.util.config.AQConfig,194 - looking up configuration file: config/config.default.xml
09:12:37.192 [main] INFO  t.n.algoquant.util.config.AQConfig,209 - loading config file: file:/home/runner/work/algoquant-examples/algoquant-examples/target/model-results/TutorialStrategyDemo/work/config/config.default.xml


09:12:37.377 [main] INFO  t.n.algoquant.util.config.AQConfig,95 - current directory: /home/runner/work/algoquant-examples/algoquant-examples/target/model-results/TutorialStrategyDemo/work
09:12:37.377 [main] INFO  t.n.algoquant.util.config.AQConfig,169 - current config:
09:12:37.388 [main] INFO  t.n.algoquant.util.config.AQConfig,11 - nm.license: /home/runner/work/algoquant-examples/algoquant-examples/license/nm.lic
09:12:37.388 [main] INFO  t.n.algoquant.util.config.AQConfig,11 - DATA_FOLDER: ./test-data
09:12:37.388 [main] INFO  t.n.algoquant.util.config.AQConfig,11 - DATA_GAINCAPITAL: ${DATA_FOLDER}/processed/gaincapital/extracted-from-raw-arrange-by-dates
09:12:37.389 [main] INFO  t.n.algoquant.util.config.AQConfig,11 - DATA_BLOOMBERG: ${DATA_FOLDER}/processed/bloomberg
09:12:37.389 [main] INFO  t.n.algoquant.util.config.AQConfig,11 - DATA_YAHOO: ${DATA_FOLDER}/yahoo
09:12:37.389 [main] INFO  t.n.algoquant.util.config.AQConfig,11 - DATA_SGX: ${DATA_FOLDER}/raw/sgx
09:12:37.389 [main] INFO  t.n.algoquant.util.config.AQConfig,11 - DATA_HOLIDAYS: ./log/holidays
09:12:37.390 [main] INFO  t.n.algoquant.util.config.AQConfig,11 - DATA_COMPUSTAT_HK: ${DATA_FOLDER}/[database configuration redacted]/hk
09:12:37.390 [main] INFO  t.n.algoquant.util.config.AQConfig,11 - PDF_OUTPUT_FOLDER: ./log/
09:12:37.390 [main] INFO  t.n.algoquant.util.config.AQConfig,11 - PDF_PLOT_WIDTH: 800
09:12:37.390 [main] INFO  t.n.algoquant.util.config.AQConfig,11 - PDF_PLOT_HEIGHT: 600
09:12:38.490 [main] INFO  t.n.a.d.h.yahoo.YahooEODCacheFactory,237 - failed to load from file, reason: no data read from file; load from web
09:12:38.490 [main] INFO  t.n.a.d.h.yahoo.YahooEODCacheFactory,196 - reading Yahoo! data for ^HSI from the Internet from 2000-01-01T00:00 to 2012-01-01T16:00
09:12:38.681 [main] INFO  t.n.a.d.h.y.YahooEODCsvZipFileWriter,30 - writing csv.zip file ./log/Yahoo/^HSI.csv.zip
09:12:38.739 [main] INFO  t.n.a.d.h.y.YahooEODCsvZipFileWriter,81 - finished writing ./log/Yahoo/^HSI.csv.zip
09:12:39.331 [main] INFO  t.n.a.d.m.t.TutorialStrategyDemo,134 - report = Performance Report:
Product	Profit Loss	Information Ratio For Periods	Omega For Periods
^HSI	19853.2607421875	0.5442994541313131	4.05182187620248
Total	19853.2607421875	0.5647991796134995	3.9432123012583498

Charts from this run

Chart 1

Reported performance statistics

Products and aggregate shown exactly as reported; P/L is monetary, not percent. Currency conventions belong to the demo.

Derived from stdout.log using the precision available in that file. Download plotted data. Undefined or malformed cells are omitted, never replaced by zero.

Chart 2

Downloadable evidence

Download TutorialStrategyDemo.zip contains stdout, stderr, the execution record, checksums and any exported CSV/chart files.

Export Bytes
files/charts/chart-01.png 103983
files/derived-charts/charts.json 521
files/derived-charts/derived-01.csv 293
files/derived-charts/derived-01.png 84476

Interpreting the result

Read the reported units: optimizer weights, model-fit coefficients, forecast correlations and simulated P/L are different outputs. Synthetic runs demonstrate the API rather than historical market returns. Inspect undefined values and open positions instead of replacing them with zero. Chart exports visualize exactly this run.

For model assumptions, original publications and adaptation limits, use the literature guide.

Clone this wiki locally