What this interpreter can do with AADC and the Tracer, measured: installed packages and versions, platform,
licence (one sentence naming the edition the engine runs as and what it permits; tell the user), an engine
self-test (record, replay, reverse: dz/dx = 6 at x = 3), a tracing self-test (one traced QuantLib call must
attribute leaves to QuantLib's C++), and findings with the pip command that fixes each.
Call it first; call it again after installing anything.
Takes no parameters.
Run a Python script with tracing on and keep the record (tape) it leaves. The script needs no changes: it runs
in its own directory with AADC_TRACE=1, so every calculation through aadc types or an AADC-built library such as
aadc-quantlib-tracing is recorded with its source coordinates. Returns tape_id, the script's stdout and stderr,
the engine's census (frozen branch sites, outputs) and stats. A script that records itself and ends with
f.save_tape() writes to AADC_TRACE_OUT; mark its first line with 'mode=explicit'.
outputs: optional AADC_TRACE_OUTPUTS entries, e.g. ['value=123.45'] or ['pricer.py:42'], to name the program's
results on the tape. python: another interpreter to run under (the one where the user's packages live).
This runs the user's own code on the user's own machine; it is not a sandbox.
Parametersargspathrequiredpythonoutputsworkdirtimeout_s
Ask the tape one question in the engine's own grammar and get its text answer plus the parsed header.
Verbs: 'stats' | 'leaves [kind=input|constant] [by=leaf] [limit=N]' | 'branches order=margin [limit=N]' |
'sites [file=NAME] [limit=N]' | 'at FILE:LINE [context=N]' (source with the recorded values; hash=ok means the
file shown is the one compiled) | 'find value=X' (where a printed number was computed) | 'origin #N' (the formula
behind a value) | 'uses #N' | 'cone #N' (which leaves can move a value, by derivative or only by a branch) |
'source root=COMPILED=LOCAL' (map compiled paths to a local source tree) | 'replay ...' (prefer the replay tool).
Ids are #N from earlier answers. A malformed request answers status=error in the header, never an exception.
Parametersrequestrequiredtape_idrequiredmax_lines
Re-evaluate the tape at new inputs without re-running the model. assignments: '#12=101' or '#12=101,#15=0.21'
(leaf ids from 'leaves kind=input' or 'leaves by=leaf'); out: the output id from 'find value=<printed price>'.
survives=true: the recorded path holds and value is exact (equal to a fresh run to the last digit).
survives=false: WITHHELD; flipped names the decision (file:line, decided true -> false) and unchecked the
conversions the tape cannot check. There is no value to quote in that case. A tape read back from a file keeps
no operand for a counted conversion, so on most QuantLib tapes a replay is withheld with unchecked naming the
line (often errorfunction.cpp:200); say so and re-run the script at the new inputs for the price.
path_recorded=true returns the recorded path's value labelled as such, for comparison only.
Parametersoutrequiredtape_idrequiredassignmentsrequiredpath_recorded
Map the compiled source prefix recorded on the tape (for aadc-quantlib-tracing 1.41 it is
/project/work/QLAADC/ql) to a local directory holding that source, so 'at FILE:LINE' and 'origin' can show the
code. Later answers say hash=ok when the local file is the one the library was compiled from and hash=MISMATCH
when it is not; a mismatch is reported, never silent. Remembered for this tape.
Parameterstape_idrequiredlocal_dirrequiredcompiled_prefixrequired
Register an existing .tape file written earlier (by trace_script, by a script's own save_tape(), or downloaded
from a report) and return its tape_id and stats.
Parameterspathrequired
The tapes this server holds: id, file, size, the script that produced each, and the source roots applied.
Takes no parameters.
Run a Python script that records itself (aadc.Functions, start_recording with marked inputs, stop_recording)
and keep its process alive, so later questions are answered by the object that recorded. Returns session_id, the
script's stdout, which Functions object was kept, and its stats. Why: a record read back from a file cannot
re-check a counted conversion, so 'replay' on it is often withheld; in the recording process the same replay is
exact (the same digits as pricing again). Use it for what-ifs and sensitivities on a script with marked inputs;
for an unmodified script use trace_script. The script's save_tape() to AADC_TRACE_OUT also registers a tape.
Idle sessions close themselves after AADC_MCP_SESSION_IDLE_S seconds (default 1800). This runs the user's own
code on the user's own machine.
Parametersargspathrequiredpythontimeout_s
The same question grammar as inspect_tape (stats, leaves, branches, sites, at, find, origin, uses, cone,
source), answered by the live recording of an open_session.
Parametersrequestrequiredmax_linessession_idrequired
Replay the live recording at new inputs. assignments: '#0=101' (leaf ids from ask_session 'leaves kind=input
by=leaf'); out: the id marked OUTPUT from 'find value=<printed price>'. survives=true means the recorded path holds
and value is exact to the last digit; survives=false is WITHHELD with the decision named (flipped) and no value.
Parametersoutrequiredsession_idrequiredassignmentsrequiredpath_recorded
End a live session and free its process.
Parameterssession_idrequired
The live sessions this server holds: id, script, start time, questions answered.
Takes no parameters.
Bundled scripts to start from: plain AADC (any platform), and unmodified QuantLib pricers that
aadc-quantlib-tracing records (Linux x86-64, macOS arm64). mode=auto scripts are traced as they are; mode=explicit scripts
record themselves and print sensitivities. Each is a starting point to copy and edit.
Takes no parameters.
The source of one bundled example, to read, copy or adapt.
Parametersnamerequired
Copy one bundled example into the server's working folder, run it with tracing on and return its tape_id,
its printed output and the tape's stats. Then question the tape with inspect_tape and replay.
Parametersnamerequiredtimeout_s