Repository navigation
Model PerformanceOptimizedYahooEODPortfolioDemo
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
This example searches for a portfolio using a user-defined performance objective. No single original paper has been established for this particular combination of information ratio, profit and drawdown, so it is documented as an application of the library rather than given an invented paper attribution.
The important idea is that a performance statistic can become an optimization target. Normalization coefficients and objective weights determine how conflicting goals are balanced; they are different from the final asset allocation weights. A search can improve its chosen score on the sample without discovering a relationship that persists afterward.
Read this tutorial as a lesson in assembling and evaluating a portfolio-search workflow. To draw an investment conclusion, use independent evaluation data, verify the cost and turnover assumptions, and inspect the actual account path as well as the objective score. The following implementation section identifies the concrete components used here.
This is an application-level search over weighted performance objectives, not a named single- publication model. The template combines information ratio, profit and drawdown with normalization coefficients. Those objective coefficients are not asset allocation weights, and optimizing a backtest statistic can overfit its sample.
Using this example. Weights several performance objectives in a PerformanceOptimizedYahooEODPortfolio template and runs the resulting strategy on Yahoo data. The coefficients normalize objectives with different units; their values are not portfolio allocation weights. Optimization and evaluation on shared history can overstate expected performance.
Model and publication. Related theory and the scope of this example are distinguished below.
Implementation in this tutorial. This is an application-level search over weighted performance objectives, not a named single- publication model. The template combines information ratio, profit and drawdown with normalization coefficients. Those objective coefficients are not asset allocation weights, and optimizing a backtest statistic can overfit its sample.
| 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 | 12.74 |
| Time limit seconds | 180 |
| Maximum Java heap | 1200m |
The original main returned successfully. Read the output and model assumptions before interpreting it.
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.portfoliooptimization.PerformanceOptimizedYahooEODPortfolioDemoThe 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.
09:14:15.012 [main] INFO t.n.algoquant.util.config.AQConfig,194 - looking up configuration file: config.default.xml
09:14:15.021 [main] INFO t.n.algoquant.util.config.AQConfig,194 - looking up configuration file: config/config.default.xml
09:14:15.022 [main] INFO t.n.algoquant.util.config.AQConfig,209 - loading config file: file:/home/runner/work/algoquant-examples/algoquant-examples/target/model-results/PerformanceOptimizedYahooEODPortfolioDemo/work/config/config.default.xml
09:14:15.368 [main] INFO t.n.algoquant.util.config.AQConfig,95 - current directory: /home/runner/work/algoquant-examples/algoquant-examples/target/model-results/PerformanceOptimizedYahooEODPortfolioDemo/work
09:14:15.368 [main] INFO t.n.algoquant.util.config.AQConfig,169 - current config:
09:14:15.401 [main] INFO t.n.algoquant.util.config.AQConfig,11 - nm.license: /home/runner/work/algoquant-examples/algoquant-examples/license/nm.lic
09:14:15.408 [main] INFO t.n.algoquant.util.config.AQConfig,11 - DATA_FOLDER: ./test-data
09:14:15.408 [main] INFO t.n.algoquant.util.config.AQConfig,11 - DATA_GAINCAPITAL: ${DATA_FOLDER}/processed/gaincapital/extracted-from-raw-arrange-by-dates
09:14:15.408 [main] INFO t.n.algoquant.util.config.AQConfig,11 - DATA_BLOOMBERG: ${DATA_FOLDER}/processed/bloomberg
09:14:15.409 [main] INFO t.n.algoquant.util.config.AQConfig,11 - DATA_YAHOO: ${DATA_FOLDER}/yahoo
09:14:15.409 [main] INFO t.n.algoquant.util.config.AQConfig,11 - DATA_SGX: ${DATA_FOLDER}/raw/sgx
09:14:15.409 [main] INFO t.n.algoquant.util.config.AQConfig,11 - DATA_HOLIDAYS: ./log/holidays
09:14:15.410 [main] INFO t.n.algoquant.util.config.AQConfig,11 - DATA_COMPUSTAT_HK: ${DATA_FOLDER}/[database configuration redacted]/hk
09:14:15.410 [main] INFO t.n.algoquant.util.config.AQConfig,11 - PDF_OUTPUT_FOLDER: ./log/
09:14:15.414 [main] INFO t.n.algoquant.util.config.AQConfig,11 - PDF_PLOT_WIDTH: 800
09:14:15.415 [main] INFO t.n.algoquant.util.config.AQConfig,11 - PDF_PLOT_HEIGHT: 600
09:14:16.798 [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:14:16.801 [main] INFO t.n.a.d.h.yahoo.YahooEODCacheFactory,196 - reading Yahoo! data for 0019.HK from the Internet from 2008-01-01T00:00 to 2015-01-01T16:00
09:14:17.049 [main] INFO t.n.a.d.h.y.YahooEODCsvZipFileWriter,30 - writing csv.zip file ./log/Yahoo/0019.HK.csv.zip
09:14:17.144 [main] INFO t.n.a.d.h.y.YahooEODCsvZipFileWriter,81 - finished writing ./log/Yahoo/0019.HK.csv.zip
09:14:17.153 [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:14:17.154 [main] INFO t.n.a.d.h.yahoo.YahooEODCacheFactory,196 - reading Yahoo! data for 0483.HK from the Internet from 2008-01-01T00:00 to 2015-01-01T16:00
09:14:17.337 [main] INFO t.n.a.d.h.y.YahooEODCsvZipFileWriter,30 - writing csv.zip file ./log/Yahoo/0483.HK.csv.zip
09:14:17.381 [main] INFO t.n.a.d.h.y.YahooEODCsvZipFileWriter,81 - finished writing ./log/Yahoo/0483.HK.csv.zip
09:14:17.382 [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:14:17.382 [main] INFO t.n.a.d.h.yahoo.YahooEODCacheFactory,196 - reading Yahoo! data for 0321.HK from the Internet from 2008-01-01T00:00 to 2015-01-01T16:00
09:14:17.522 [main] INFO t.n.a.d.h.y.YahooEODCsvZipFileWriter,30 - writing csv.zip file ./log/Yahoo/0321.HK.csv.zip
09:14:17.555 [main] INFO t.n.a.d.h.y.YahooEODCsvZipFileWriter,81 - finished writing ./log/Yahoo/0321.HK.csv.zip
09:14:17.559 [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:14:17.559 [main] INFO t.n.a.d.h.yahoo.YahooEODCacheFactory,196 - reading Yahoo! data for 0005.HK from the Internet from 2008-01-01T00:00 to 2015-01-01T16:00
09:14:17.696 [main] INFO t.n.a.d.h.y.YahooEODCsvZipFileWriter,30 - writing csv.zip file ./log/Yahoo/0005.HK.csv.zip
09:14:17.748 [main] INFO t.n.a.d.h.y.YahooEODCsvZipFileWriter,81 - finished writing ./log/Yahoo/0005.HK.csv.zip
09:14:26.102 [main] INFO t.n.a.d.m.p.PerformanceOptimizedYahooEODPortfolioDemo,130 - weights = {0019.HK @ HKEX=0.0, 0483.HK @ HKEX=0.9999999999998817, 0321.HK @ HKEX=1.1847930208946107E-13, 0005.HK @ HKEX=0.0}
09:14:26.453 [main] INFO t.n.a.d.m.p.PerformanceOptimizedYahooEODPortfolioDemo,135 - f(x) = 1.773461272818996
09:14:26.616 [main] INFO t.n.a.d.m.p.PerformanceOptimizedYahooEODPortfolioDemo,153 - Performance Report:
Product Max Drawdown Information Ratio For Periods Profit Loss
0005.HK 0.0 NaN 0.0
0019.HK 0.0 NaN 0.0
0321.HK 0.0 NaN 0.0
0483.HK 194.42151196335908 0.21516919414457455 139.28964896919206
Total 194.42151196335908 0.18291732198476826 139.28964896919206
Execution caveat: Main returned, but the log contains exceptions, failed operations or undefined values. This records process completion only; inspect the diagnostic below before treating any output as a valid backtest.
09:14:17.748 [main] INFO t.n.a.d.h.y.YahooEODCsvZipFileWriter,81 - finished writing ./log/Yahoo/0005.HK.csv.zip
09:14:26.102 [main] INFO t.n.a.d.m.p.PerformanceOptimizedYahooEODPortfolioDemo,130 - weights = {0019.HK @ HKEX=0.0, 0483.HK @ HKEX=0.9999999999998817, 0321.HK @ HKEX=1.1847930208946107E-13, 0005.HK @ HKEX=0.0}
09:14:26.453 [main] INFO t.n.a.d.m.p.PerformanceOptimizedYahooEODPortfolioDemo,135 - f(x) = 1.773461272818996
09:14:26.616 [main] INFO t.n.a.d.m.p.PerformanceOptimizedYahooEODPortfolioDemo,153 - Performance Report:
Product Max Drawdown Information Ratio For Periods Profit Loss
0005.HK 0.0 NaN 0.0
0019.HK 0.0 NaN 0.0
0321.HK 0.0 NaN 0.0
0483.HK 194.42151196335908 0.21516919414457455 139.28964896919206
Total 194.42151196335908 0.18291732198476826 139.28964896919206
DEMO_RUNNER_MAIN_RETURNED
DEMO_RUNNER_CHARTS 0
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.

Download PerformanceOptimizedYahooEODPortfolioDemo.zip contains stdout, stderr, the execution record, checksums and any exported CSV/chart files.
| Export | Bytes |
|---|---|
files/derived-charts/charts.json |
521 |
files/derived-charts/derived-01.csv |
573 |
files/derived-charts/derived-01.png |
104459 |
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.