Four-dimensional audit endpoints: lookahead leak detection, evidence integrity, replay consistency, sandbox isolation—ensure backtest realism
Backtest Internal Audit provides standalone REST APIs for four-dimensional strategy backtest auditing: lookahead bias detection, evidence integrity verification, replay consistency comparison, and sandbox isolation validation. All endpoints are free and open, 100 requests per IP per day, no API key required.
Base URL: https://app.xuanduzhixuan.com/audit/
Auth: No API key required
Rate limit: 100 requests per IP per day (UTC)
Response: JSON with ok/status/passed fields
Check feature time, event time, train/test purge and embargo temporal constraints.
# Example: Check temporal rules for two rows
curl -X POST https://app.xuanduzhixuan.com/audit/lookahead \
-H 'Content-Type: application/json' \
-d '{
"rows": [
{"event_time":"2024-01-15T16:00:00+00:00","feature_time":"2024-01-10T16:00:00+00:00",
"train_id":"fold1","test_id":"fold1","split":"train","label_end":"2024-01-20T16:00:00+00:00"},
{"event_time":"2024-02-01T16:00:00+00:00","feature_time":"2024-01-28T16:00:00+00:00",
"train_id":"fold1","test_id":"fold1","split":"test","label_end":"2024-02-05T16:00:00+00:00"}
],
"embargo": 86400,
"min_lag": 0
}'
# Response example (passed)
{"ok":true,"status":"passed","passed":true,"feature_status":"passed","purge_status":"passed","violations":[],"purge_embargo_violations":[]}
Verify SHA256 hash and read-only attributes of evidence files. Upload file content (base64) or declare hashes only.
# Example: Upload content and verify (file <256KB)
DIGEST=$(echo -n 'backtest_result' | sha256sum | awk '{print $1}')
B64=$(echo -n 'backtest_result' | base64 -w0)
curl -X POST https://app.xuanduzhixuan.com/audit/evidence \
-H 'Content-Type: application/json' \
-d "{\"expected_sha256\":\"$DIGEST\",\"content_b64\":\"$B64\",\"file_mode\":\"0444\",\"parent_mode\":\"0555\"}"
# Response example (passed)
{"ok":true,"status":"passed","sha256":"...","findings":[],"scope":"digest_and_declared_read_only_modes"}
Compare output hashes from two runs, verify input coverage. Upload content or declare hashes.
# Example: Two runs produce identical hashes, inputs verified
HASH="abc123..."
curl -X POST https://app.xuanduzhixuan.com/audit/replay \
-H 'Content-Type: application/json' \
-d '{
"run_a": {"sha256":"'$HASH'"},
"run_b": {"sha256":"'$HASH'"},
"inputs": [
{"name":"prices.csv","sha256":"def456...","expected_sha256":"def456..."}
]
}'
# Response example (passed)
{"ok":true,"status":"passed","dual_run_match":true,"status_reason":"outputs match and all input hashes verified"}
Verify production launcher correctly denies probe access to host paths. Two-step flow: get nonce challenge → run probe → submit results.
# Step 1: Get nonce and probe code
curl -X POST https://app.xuanduzhixuan.com/audit/sandbox/challenge
# Response:
# {"ok":true,"nonce":"abc123...","probe_py":"...","expires_in":600}
# Step 2: Save probe_py as probe.py, run via production launcher
# Example: bwrap --ro-bind /usr /usr --ro-bind /lib /lib --tmpfs /tmp -- python3 probe.py /etc/shadow <nonce>
# Step 3: Submit probe results
curl -X POST https://app.xuanduzhixuan.com/audit/sandbox \
-H 'Content-Type: application/json' \
-d '{
"nonce": "abc123...",
"target_path": "/etc/shadow",
"launcher": ["bwrap","--ro-bind","/usr","/usr","--"],
"exit_code": 0,
"stdout": "AUDIT_PROBE:inaccessible:abc123..."
}'
# Response example (passed — sandbox successfully denied access)
{"ok":true,"status":"passed","inaccessible":true,"nonce_verified":true}
import requests
BASE = 'https://app.xuanduzhixuan.com/audit/'
# Lookahead detection
resp = requests.post(BASE + 'lookahead', json={
'rows': [
{'event_time':'2024-01-15T16:00:00+00:00','feature_time':'2024-01-10T16:00:00+00:00',
'train_id':'f1','test_id':'f1','split':'train','label_end':'2024-01-20T16:00:00+00:00'}
]
})
print(resp.json()) # {'ok':True,'status':'passed',...}
# Evidence integrity (declare hash only)
resp = requests.post(BASE + 'evidence', json={
'expected_sha256': 'abc123...',
'sha256': 'abc123...',
'file_mode': '0444',
'parent_mode': '0555'
})
print(resp.json()['status']) # 'passed' or 'failed'
# Replay consistency
resp = requests.post(BASE + 'replay', json={
'run_a': {'sha256':'def456...'},
'run_b': {'sha256':'def456...'},
'inputs': [{'name':'data.csv','sha256':'ghi789...','expected_sha256':'ghi789...'}]
})
print(resp.json()['dual_run_match']) # True
A: Completely free, no API key required. 100 requests per IP per day, suitable for strategy development and academic research.
A: No. Audit endpoints never read caller-named server paths or execute caller-supplied commands. Evidence/replay endpoints audit uploaded bytes or caller-declared digests; sandbox endpoint verifies a nonce-bound probe transcript that the caller produced by running the probe through their own production launcher.
A: Audit APIs check known temporal constraints and data-flow rules, but cannot completely rule out all subtle leakage scenarios. A 'passed' result means no violations were found within the checked scope; 'not_checked' means incomplete coverage; 'failed' confirms violations. Recommend combining with code review and manual inspection.
A: Audit API is currently a free public service with no paid tier for increased limits. For large-scale use (>100/day), contact support to discuss custom arrangements.
Disclaimer: This tool is a data audit utility. Results are for reference only and do not constitute investment advice. Backtest validation should combine code review, manual inspection, and risk management.