Skip to content

2. Run the protocol yourself

You need the package installed and a database built (Get started), and a signal file (page 1).

The command

aa run-protocol --signal gpa.csv \
    --acronym GPA --signal-name "Gross Profitability" \
    --authors "Your Name and Coauthor Name" --paper-title "Your Paper"

It runs on the database of your project folder, from any folder. Expect about two hours on a 16-core machine; on a remote machine start it with nohup ... > protocol.log 2>&1 & or in a tmux session.

Option What it does
--acronym GPA Names the output files and labels the report. Default: the name of the CSV's signal column
--signal-name "..." The signal's name in the report's title and text. Default: the acronym
--authors "A and B" The report's author line; separate several with and. Default: blank
--paper-title "..." Stored with the run; not printed in the report
--email Stored with the run; not printed in the report
--time-period 197501 202112 Fixes the evaluation window. Default: from the signal's first month with values to the last month of the database
--convention dollar The size of the two legs after a trade: dollar (default; $1 each) or capital. Gross returns are the same; trading costs differ
--n-jobs N Worker processes. Default: cores − 1, capped by the machine's memory
--out-dir PATH Where the outputs go. Default: Scratch/Assay/ in the project folder
--no-pdf Write the .tex and the figures; do not compile them

aa run-protocol --help lists the rest. Names go into the LaTeX as given, so write &, % or _ with a backslash (\&).

From Python

import assayinganomalies as aa

info = {
    "authors": "Your Name",
    "paper_title": "Your Paper",
    "signal_name": "Gross Profitability",
    "acronym": "GPA",
}
result = aa.test_signal("gpa.csv", info, out_dir="Assay")
print(result.tex_path)        # Assay/tex/GPA.tex

This writes the same files, except that it does not compile the PDF: run latexmk -pdf GPA.tex in Assay/tex/.

What a run writes

In the output folder, for the acronym GPA:

File Content
tex/GPA.tex, tex/GPA_figure*.pdf The report's source and its eight figures
tex/GPA.pdf The report, if LaTeX is installed
GPA_Results.pkl Every result of the run, for further work in Python (a large file: hundreds of MB or more)
GPA_manifest.json What determines the numbers: package version, database, sample, inputs, settings and seeds
comb_strats_<method>.pkl The six combination strategies, saved as each finishes

Reproducing a run

A report is determined by the package version, the database and the seeds, and the manifest records all three. The database in turn is determined by the day of the WRDS download, the sample, the Chen-Zimmerman release and the trading-cost inputs, which its own manifest (Data/aa.manifest.json) records. Two things to pin for a paper:

aa set-params --sample-end 2025
aa set-params --cz-release-version 2026.10

WRDS revises its data, so a database built on another day can differ in a few observations. Tutorial, chapter 20 covers the manifests.

If a run stops

  • Killed, with no Python error: the machine ran out of memory. Lower the number of workers (--n-jobs 4) or the memory budget (aa set-params --memory-budget-gb 50), and run again with the same --out-dir: the combination strategies that finished are reused.
  • No PDF: LaTeX or latexmk is missing. The .tex and figures are complete; compile them on another machine or on Overleaf.

Next: Read the report.