Building a Synthetic Experiment Recorder: Keeping Success and Failure Distinct
Saving only numbers from successful experiments makes failed runs disappear. Conversely, filling every failure with a result of zero confuses “could not calculate” with “calculated zero.”
This article explains a small public example connecting input → calculation → status record → report. quant-records-v1 is a separate implementation published on October 7, 2026, not a reconstruction of the original September records. Its inputs are synthetic numbers; it includes no actual ETF data, model training, or return calculations.
Two inputs separate success from failure
The actual JSON for the successful input is:
{ "SYN_A": 0.6, "SYN_B": 0.45, "SYN_C": 0.7}The setting is {"threshold": 0.55}. Assets at or above the threshold receive equal weights: 0.5 each for A and C, and zero for B. These numbers were chosen to illustrate the recording path, not estimated by a model.
The successful result is shown below. Input file, expected result file
{ "cash_weight": 0.0, "weights": { "SYN_A": 0.5, "SYN_B": 0.0, "SYN_C": 0.5 }}The failed input is {"SYN_A": 1.2}. It falls outside the allowed range from 0 to 1 and raises a ValueError. The failure record contains the following fields, and no result.json is created.
{ "error_type": "ValueError", "reason": "probabilities must be nonempty and within [0, 1]", "status": "FAILED"}This is the complete expected-failure file. The actual record.json also includes fields such as run ID, timestamps, and hashes. The key distinction is that failure is not converted into 100% cash or a zero return. Holding cash because no asset qualifies under a valid input is a legitimate calculation result.
One directory per run
Each run directory contains the following files.
| File | Purpose | Present in the failure example? |
|---|---|---|
inputs.json | Inputs used in the calculation | Yes |
config.json | Threshold and other settings | Yes |
record.json | Run ID, UTC times, versions, hashes, status, and error | Yes |
result.json | Calculated asset and cash weights | No |
report.md | Report generated from saved status and results | Yes |
record.json initially stores RUNNING. It changes to SUCCEEDED after a successful calculation or FAILED when an input-validation error handled by this example occurs. The report rereads the saved record.json and, for successful runs, result.json. This structure reduces the use of separate paths for in-memory results and report content.
The complete flow is in run_case and report_from_files in experiment.py. Each run directory uses a new UUID, so identical inputs are still saved in different directories.
Run the public example
Download the complete ZIP into an empty working directory. It uses Python 3.9+ syntax and the standard library. For a new installation, choose a supported Python 3 release.
curl -fLO https://forge-fate.com/examples/quant-records-v1.zippython3 -m zipfile -e quant-records-v1.zip .cd quant-records-v1python3 -m unittest -vpython3 experiment.py demo --out my-runspython3 experiment.py verify --out my-runsThe package has 10 unit tests. On success they end with OK; demo and verify produce output in this form:
checks PASS (9 checks)success: SYN_A=0.5, SYN_B=0.0, SYN_C=0.5, cash_weight=0.0failure: FAILED / ValueError / no result.jsonevidence: my-runs/verification.jsonTen is the unit-test count; nine is the number of checks applied to the saved run set. If my-runs already exists, demo fails instead of overwriting it. Use a new output-directory name for another run.
demo creates a baseline success and baseline failure, then rereads each one's saved inputs and settings to replay them. The output therefore contains four UUID directories and verification.json. There is no need to memorize directory names: the runs section of verification.json identifies each run.
Read the recording boundary precisely
The failure preserved in this example is a valid JSON input containing 1.20 that fails calculation-input validation. This tool does not guarantee a record for every possible failure.
Malformed JSON or non-finite numbers can be rejected while reading or serializing. Disk errors or forced termination can leave incomplete directories or a RUNNING status. Atomic multi-file storage and recovery from an interrupted step are not implemented.
SHA-256 values for code, inputs, and settings allow comparison of the bytes used. They do not guarantee accurate inputs or economically meaningful results, and they are not signatures that prevent someone from changing files and hashes together.
After recording comes comparison
The example lets readers inspect how success and failure remain distinct and how their states connect to saved inputs. The actual execution environments and published verification scope are recorded in validation.json.
The next article examines which files should match and which values should change when the same inputs are replayed.
Report an error or share feedback
Open a draft with this article’s title and URL. Review the message and recipient before sending.
Open email draftIf no email app opens, copy these details into your usual email service.
Related posts
Quant & Data Research Quant AI Series Review: Actual Baseline Results and Questions Still Unanswered
Review the published ETF baseline results and distinguish them from unexecuted ML comparisons and unmeasured AI productivity effects.
Quant & Data Research A Safe Way to Do Quant Research with LLMs: From Questions to Verification and Research Records
Review research-memo claims using synthetic prices and fixed rules; distinguish signal and holding returns and record checks, corrections, and unknowns.