Repository navigation
Model GMA12Demo
All model results · Pinned source · Javadoc
Demonstrates Acar's framework of a trend following strategy. We first fit the Acar's model with some real price data. Then we compute the properties of the model, e.g., the expected P&L for playing the GMA(1, 2) strategy.
Using this example. Loads Yahoo prices, fits a Knight-Satchell-Tran model and evaluates GMA(1,2) trend-following properties. The output describes the fitted model; it is not automatically the return of a fully invested trading account.
Model and publication. Knight–Satchell–Tran is the fitted return-model reference. Acar–Satchell is related moving- average analysis, not a claim that its switching-Gaussian derivation is identical to this GMA12 implementation; both originals were unavailable in full during this audit.
Implementation in this tutorial. Convert Yahoo adjusted closes to log returns, call KnightSatchellTran1995MLE.fitModel, then construct GMA12. PrHoldingTime(1) and ERRLong() are model-derived quantities, not realized Sharpe ratios or total portfolio returns. Fitting an asymmetric return law does not by itself establish stable out-of-sample trend profitability.
| Item | Value |
|---|---|
| Status | completed |
| Run | 39114006111 |
| UTC publication | 2026-10-18 09:11 UTC |
| Source commit | 0097e73c040bdaaddac570e2fe694d9836b676ee |
| Data mode | original main defaults |
| Exit code | 0 |
| Elapsed seconds | 3.54 |
| 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.kst1995.GMA12DemoThe 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:07:18,299 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
09:07:18,300 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
09:07:18,307 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [jar:file:/home/runner/work/algoquant-examples/algoquant-examples/target/lib/algoquant-dist-3.3.0-SNAPSHOT.jar!/logback.xml]
09:07:18,353 |-INFO in ch.qos.logback.core.joran.spi.ConfigurationWatchList@33a10788 - URL [jar:file:/home/runner/work/algoquant-examples/algoquant-examples/target/lib/algoquant-dist-3.3.0-SNAPSHOT.jar!/logback.xml] is not of type file
09:07:18,446 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
09:07:18,447 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
09:07:18,459 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
09:07:18,473 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
09:07:18,524 |-INFO in ch.qos.logback.core.joran.action.TimestampAction - Using current interpretation time, i.e. now, as time reference.
09:07:18,525 |-INFO in ch.qos.logback.core.joran.action.TimestampAction - Adding property to the context with key="bySecond" and value="2026.10.18,09.07.18" to the LOCAL scope
09:07:18,525 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender]
09:07:18,528 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [FILE1]
09:07:18,535 |-INFO in ch.qos.logback.core.rolling.FixedWindowRollingPolicy@7006c658 - Will use zip compression
09:07:18,536 |-WARN in ch.qos.logback.core.rolling.FixedWindowRollingPolicy@7006c658 - Large window sizes are not allowed.
09:07:18,536 |-WARN in ch.qos.logback.core.rolling.FixedWindowRollingPolicy@7006c658 - MaxIndex reduced to 21
09:07:18,539 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
09:07:18,540 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[FILE1] - Active log file name: log/algoquant.2026.10.18,09.07.18.log
09:07:18,540 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[FILE1] - File property is set to [log/algoquant.2026.10.18,09.07.18.log]
09:07:18,541 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to DEBUG
09:07:18,541 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ROOT]
09:07:18,541 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [FILE1] to Logger[ROOT]
09:07:18,541 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
09:07:18,542 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@34033bd0 - Registering current configuration as safe fallback point
09:07:18.666 [main] INFO t.n.algoquant.util.config.AQConfig,194 - looking up configuration file: config.default.xml
09:07:18.670 [main] INFO t.n.algoquant.util.config.AQConfig,194 - looking up configuration file: config/config.default.xml
09:07:18.671 [main] INFO t.n.algoquant.util.config.AQConfig,209 - loading config file: file:/home/runner/work/algoquant-examples/algoquant-examples/target/model-results/GMA12Demo/work/config/config.default.xml
09:07:19.003 [main] INFO t.n.algoquant.util.config.AQConfig,148 - 09:07:18,299 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
09:07:18,300 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
09:07:18,307 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [jar:file:/home/runner/work/algoquant-examples/algoquant-examples/target/lib/algoquant-dist-3.3.0-SNAPSHOT.jar!/logback.xml]
09:07:18,353 |-INFO in ch.qos.logback.core.joran.spi.ConfigurationWatchList@33a10788 - URL [jar:file:/home/runner/work/algoquant-examples/algoquant-examples/target/lib/algoquant-dist-3.3.0-SNAPSHOT.jar!/logback.xml] is not of type file
09:07:18,446 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
09:07:18,447 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
09:07:18,459 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
09:07:18,473 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
09:07:18,524 |-INFO in ch.qos.logback.core.joran.action.TimestampAction - Using current interpretation time, i.e. now, as time reference.
09:07:18,525 |-INFO in ch.qos.logback.core.joran.action.TimestampAction - Adding property to the context with key="bySecond" and value="2026.10.18,09.07.18" to the LOCAL scope
09:07:18,525 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender]
09:07:18,528 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [FILE1]
09:07:18,535 |-INFO in ch.qos.logback.core.rolling.FixedWindowRollingPolicy@7006c658 - Will use zip compression
09:07:18,536 |-WARN in ch.qos.logback.core.rolling.FixedWindowRollingPolicy@7006c658 - Large window sizes are not allowed.
09:07:18,536 |-WARN in ch.qos.logback.core.rolling.FixedWindowRollingPolicy@7006c658 - MaxIndex reduced to 21
09:07:18,539 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
09:07:18,540 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[FILE1] - Active log file name: log/algoquant.2026.10.18,09.07.18.log
09:07:18,540 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[FILE1] - File property is set to [log/algoquant.2026.10.18,09.07.18.log]
09:07:18,541 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to DEBUG
09:07:18,541 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ROOT]
09:07:18,541 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [FILE1] to Logger[ROOT]
09:07:18,541 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
09:07:18,542 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@34033bd0 - Registering current configuration as safe fallback point
09:07:19.003 [main] INFO t.n.algoquant.util.config.AQConfig,95 - current directory: /home/runner/work/algoquant-examples/algoquant-examples/target/model-results/GMA12Demo/work
09:07:19.004 [main] INFO t.n.algoquant.util.config.AQConfig,169 - current config:
09:07:19.043 [main] INFO t.n.algoquant.util.config.AQConfig,11 - nm.license: /home/runner/work/algoquant-examples/algoquant-examples/license/nm.lic
09:07:19.044 [main] INFO t.n.algoquant.util.config.AQConfig,11 - DATA_FOLDER: ./test-data
09:07:19.044 [main] INFO t.n.algoquant.util.config.AQConfig,11 - DATA_GAINCAPITAL: ${DATA_FOLDER}/processed/gaincapital/extracted-from-raw-arrange-by-dates
09:07:19.045 [main] INFO t.n.algoquant.util.config.AQConfig,11 - DATA_BLOOMBERG: ${DATA_FOLDER}/processed/bloomberg
09:07:19.045 [main] INFO t.n.algoquant.util.config.AQConfig,11 - DATA_YAHOO: ${DATA_FOLDER}/yahoo
09:07:19.045 [main] INFO t.n.algoquant.util.config.AQConfig,11 - DATA_SGX: ${DATA_FOLDER}/raw/sgx
09:07:19.045 [main] INFO t.n.algoquant.util.config.AQConfig,11 - DATA_HOLIDAYS: ./log/holidays
09:07:19.048 [main] INFO t.n.algoquant.util.config.AQConfig,11 - DATA_COMPUSTAT_HK: ${DATA_FOLDER}/[database configuration redacted]/hk
09:07:19.049 [main] INFO t.n.algoquant.util.config.AQConfig,11 - PDF_OUTPUT_FOLDER: ./log/
09:07:19.049 [main] INFO t.n.algoquant.util.config.AQConfig,11 - PDF_PLOT_WIDTH: 800
09:07:19.049 [main] INFO t.n.algoquant.util.config.AQConfig,11 - PDF_PLOT_HEIGHT: 600
09:07:20.208 [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:07:20.209 [main] INFO t.n.a.d.h.yahoo.YahooEODCacheFactory,196 - reading Yahoo! data for ^HSI from the Internet from 2009-01-01T00:00 to 2010-12-31T16:00
09:07:20.306 [main] INFO t.n.a.d.h.y.YahooEODCsvZipFileWriter,30 - writing csv.zip file ./log/Yahoo/^HSI.csv.zip
09:07:20.343 [main] INFO t.n.a.d.h.y.YahooEODCsvZipFileWriter,81 - finished writing ./log/Yahoo/^HSI.csv.zip
09:07:21.196 [main] INFO t.n.a.demo.model.kst1995.GMA12Demo,100 - state 0: q = 0.200000, alpha0 = 1.126335, rate0 = 129.452917; state 1: p = 0.868545, alpha1 = 2.682338, rate1 = 119.911951; mu: -0.017136
09:07:21.197 [main] INFO t.n.a.demo.model.kst1995.GMA12Demo,103 - the probability of holding time = 1: 0.11290322580645161
09:07:21.197 [main] INFO t.n.a.demo.model.kst1995.GMA12Demo,107 - the expected pnl for a long position: 0.13909597851782685
Download GMA12Demo.zip contains stdout, stderr, the execution record, checksums and any exported CSV/chart files.
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.