Repository navigation
Model EconomicModelStrategyDemo
All quantitative model results · Pinned source · Javadoc
Eugene F. Fama and Kenneth R. French, Common risk factors in the returns on stocks and bonds (1993) investigates whether a small set of common risk factors explains shared variation in stock and bond returns. The familiar equity factors are market excess return, size (SMB) and book-to-market value (HML); the paper also considers bond-market factors.
A factor model separates exposure to common factors from the residual specific to each asset. For portfolio construction, this can explain why apparently different assets still carry similar risks. Estimated factor loadings are not automatically return forecasts or profitable trade signals.
This is related context, not a claim that the demo recreates Fama–French portfolios or replicates the 1993 empirical study. The economic and fundamental demos choose their own inputs and estimators. The original publication abstract and Kenneth French's factor definitions were checked; the full article was not independently reviewed.
FactorExcessBenchmark, FactorSMB and FactorHML feed EconomicFactorModel, which estimates exposures/premia over the configured trailing window. FactorStrategy then uses a chosen optimizer and diversification layer to rebalance. Factor measurement, database construction and reporting dates must be consistent; financial statement availability dates matter. The code’s factor implementations, universe and optimizer choices define this experiment.
A demo on running a fundamental factor model trading strategy.
Using this example. Builds a FactorStrategy using economic factors and a rolling data window, then schedules rebalancing and registers account measures. This example needs the configured Compustat/filesystem or SQL data source; public Yahoo prices alone do not supply its factor data. Keep calibration data earlier than the trade decisions when changing windows.
Model and publication. Fama–French is background for the market/size/value factor vocabulary. The linked author documentation defines SMB and HML; this application is not a reproduction of the original stock-and-bond empirical study.
Implementation in this tutorial. FactorExcessBenchmark, FactorSMB and FactorHML feed EconomicFactorModel, which estimates exposures/premia over the configured trailing window. FactorStrategy then uses a chosen optimizer and diversification layer to rebalance. Factor measurement, database construction and reporting dates must be consistent; financial statement availability dates matter. The code’s factor implementations, universe and optimizer choices define this experiment.
| Item | Value |
|---|---|
| Status | resource-limit |
| Run | 39114360151 |
| UTC publication | 2026-10-18 09:18 UTC |
| Source commit | 355aa9242fc2a247b256aecc8406cbb409aa5ff3 |
| Data mode | original main defaults |
| Exit code | 1 |
| Elapsed seconds | 65.95 |
| Time limit seconds | 180 |
| Maximum Java heap | 1200m |
The original calculation exceeded the per-demo memory allocation.
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.factormodel.EconomicModelStrategyDemoThe 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.
This is an incomplete or blocked run. Output below is diagnostic or partial, not a verified strategy result.
09:12:32.355 [main] INFO t.n.algoquant.util.config.AQConfig,194 - looking up configuration file: config.default.xml
09:12:32.358 [main] INFO t.n.algoquant.util.config.AQConfig,194 - looking up configuration file: config/config.default.xml
09:12:32.358 [main] INFO t.n.algoquant.util.config.AQConfig,209 - loading config file: file:/home/runner/work/algoquant-examples/algoquant-examples/target/model-results/EconomicModelStrategyDemo/work/config/config.default.xml
09:12:32.625 [main] INFO t.n.algoquant.util.config.AQConfig,95 - current directory: /home/runner/work/algoquant-examples/algoquant-examples/target/model-results/EconomicModelStrategyDemo/work
09:12:32.625 [main] INFO t.n.algoquant.util.config.AQConfig,169 - current config:
09:12:32.633 [main] INFO t.n.algoquant.util.config.AQConfig,11 - nm.license: /home/runner/work/algoquant-examples/algoquant-examples/license/nm.lic
09:12:32.634 [main] INFO t.n.algoquant.util.config.AQConfig,11 - DATA_FOLDER: ./test-data
09:12:32.634 [main] INFO t.n.algoquant.util.config.AQConfig,11 - DATA_GAINCAPITAL: ${DATA_FOLDER}/processed/gaincapital/extracted-from-raw-arrange-by-dates
09:12:32.634 [main] INFO t.n.algoquant.util.config.AQConfig,11 - DATA_BLOOMBERG: ${DATA_FOLDER}/processed/bloomberg
09:12:32.634 [main] INFO t.n.algoquant.util.config.AQConfig,11 - DATA_YAHOO: ${DATA_FOLDER}/yahoo
09:12:32.634 [main] INFO t.n.algoquant.util.config.AQConfig,11 - DATA_SGX: ${DATA_FOLDER}/raw/sgx
09:12:32.635 [main] INFO t.n.algoquant.util.config.AQConfig,11 - DATA_HOLIDAYS: ./log/holidays
09:12:32.635 [main] INFO t.n.algoquant.util.config.AQConfig,11 - DATA_COMPUSTAT_HK: ${DATA_FOLDER}/[database configuration redacted]/hk
09:12:32.635 [main] INFO t.n.algoquant.util.config.AQConfig,11 - PDF_OUTPUT_FOLDER: ./log/
09:12:32.635 [main] INFO t.n.algoquant.util.config.AQConfig,11 - PDF_PLOT_WIDTH: 800
09:12:32.635 [main] INFO t.n.algoquant.util.config.AQConfig,11 - PDF_PLOT_HEIGHT: 600
09:12:32.647 [main] INFO t.n.a.d.h.c.z.CompustatZipCompanyData,232 - reading the company file: /home/runner/work/algoquant-examples/algoquant-examples/target/model-results/EconomicModelStrategyDemo/work/./test-data/[database configuration redacted]/hk/company.csv.zip
09:12:32.795 [main] INFO t.n.a.d.h.c.z.CompustatZipAccountingData,196 - reading the company accounting file: /home/runner/work/algoquant-examples/algoquant-examples/target/model-results/EconomicModelStrategyDemo/work/./test-data/[database configuration redacted]/hk/monthlyAccounting.1995.2010.csv.zip
09:12:34.128 [main] INFO t.n.a.d.h.c.z.CompustatZipTradingData,173 - reading the daily return file: /home/runner/work/algoquant-examples/algoquant-examples/target/model-results/EconomicModelStrategyDemo/work/./test-data/[database configuration redacted]/hk/dailyReturn.1995.2011.csv.zip
java.lang.OutOfMemoryError: GC overhead limit exceeded
at java.time.format.DateTimeFormatter.parseUnresolved0(DateTimeFormatter.java:2008)
at java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:1939)
at java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:1851)
at java.time.LocalDate.parse(LocalDate.java:400)
at tech.nmfin.algoquant.data.historicaldata.[database configuration redacted].CompustatTradingData.parse(abb:200)
at tech.nmfin.algoquant.data.historicaldata.[database configuration redacted].zip.CompustatZipTradingData.load(wo:227)
at tech.nmfin.algoquant.data.historicaldata.[database configuration redacted].zip.CompustatZipTradingData.load(wo:169)
at tech.nmfin.algoquant.data.historicaldata.[database configuration redacted].zip.CompustatZipCompanyDB.<init>(imb:95)
at tech.nmfin.algoquant.data.historicaldata.[database configuration redacted].zip.CompustatZipCompanyDB.<init>(imb:26)
at tech.nmfin.algoquant.execution.datatype.product.stock.market.db.MarketDB_HK_Compustat.<init>(xz:152)
at tech.nmfin.algoquant.demo.model.factormodel.EconomicModelStrategyDemo.getMarketDB(EconomicModelStrategyDemo.java:356)
at tech.nmfin.algoquant.demo.model.factormodel.EconomicModelStrategyDemo.run(EconomicModelStrategyDemo.java:206)
at tech.nmfin.algoquant.demo.model.factormodel.EconomicModelStrategyDemo.main(EconomicModelStrategyDemo.java:188)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at ModelDemoRunner.main(ModelDemoRunner.java:38)
DEMO_RUNNER_FAILURE java.lang.OutOfMemoryError
java.lang.OutOfMemoryError: GC overhead limit exceeded
Download EconomicModelStrategyDemo.zip contains stdout, stderr, the execution record, checksums and any exported CSV/chart files.
Use the first relevant exception and the source configuration to resolve the prerequisite or code issue, then rerun. A missing dataset requires the correct original schema and period; substituting synthetic values would be a different experiment. A timeout establishes only that this bounded attempt did not finish.
For model assumptions, original publications and adaptation limits, use the literature guide.