# Records the swaption in swaption.py (same folder) with the AADC Tracer and prints the
# price and the two counts quoted on matlogica.com/products/aadc-tracer.
#
#   pip install "aadc-quantlib-tracing==1.41.*"
#   python swaption_trace.py
#
# Measured 8 and 9 October 2026 (aadc-quantlib-tracing 1.41.0, aadc 2.22.2, Python 3.11,
# Linux x86-64): 16912.75857915684, then 111, then 59.
import aadc
from aadc_quantlib_tracing import QuantLib as ql
from swaption import price

f = aadc.Functions()
f.start_recording(trace=True, trace_inputs_as_random=True)
npv = price(ql)
f.stop_recording()

print(npv)                                                            # 16912.75857915684
print(len({(l["file"], l["line"]) for l in f.traced_leaves()}))      # 111 constant sites
print(len({(w["file"], w["line"]) for w in f.passive_warnings()}))   # 59 frozen-branch sites
