Complete technical specification, forensic justification, and verification manifest for the 4 core algorithmic guardrails deployed to AWS EC2.
Core Mandate: Enforce a mandatory 20-minute cooldown on any specific option strike if 2 consecutive stop-outs occur on that strike while the market is classified in RANGE or CHOPPY regime.
Forensic Problem Solved: During sideways compression or auction chop, repetitive re-entries on the exact same ATM strike (e.g., 25100 CE) suffer continuous theta decay and whip whipsaws. Other non-cooldown strikes remain tradeable if directional momentum emerges.
Key Verification: Tested in test_chop_cooldown_and_displacement.py: 1 loss does not trigger lockout; 2 consecutive losses locks the strike for 20m; trades on other strikes are allowed; profit resets the streak.
Core Mandate: Prohibit re-entering the exact same option strike within 45 minutes unless NIFTY underlying spot has displaced at least 25.0 index points from the previous entry level.
Forensic Problem Solved: Prevents "churning" at the same price consolidation shelf. If spot has only moved 8โ12 points, market structure has not fundamentally reset; re-entering the same contract results in overlapping risk without edge.
Key Verification: Tested in test_chop_cooldown_and_displacement.py: Sub-25pt re-entry in 15m is blocked; 28pt re-entry is approved; 50m elapsed re-entry is approved.
Core Mandate: Protect active FYERS session tokens with authenticated encryption, tamper-resistant HMAC-SHA256 signatures, CSPRNG nonces, and automatic integrity verification with seamless auto-reconnect on startup.
Architecture Details:
nonce + ciphertext and SHA-256 payload checksum. Any bit flip raises TokenVaultIntegrityError.hashlib, hmac, os, json).tokens/account_1.json and transparently upgrades it to encrypted tokens/token_vault.enc on first boot.Key Verification: Tested in test_token_vault.py: 100% test pass on round-trip encryption, HMAC tamper detection, checksum validation, and legacy migration.
Core Mandate: Mandate high volume node alignment (Point of Control / POC) on all mid-morning (10:00 - 11:30 IST) Fair Value Gap retest entries. Retests lacking POC confluence are strictly rejected.
Forensic Problem Solved: Mid-morning (10:00 - 11:30 IST) is the European open preparation and institutional rebalancing period. Low-volume FVGs formed in vacuum moves frequently fail without institutional auction consensus. Requiring POC alignment guarantees high-volume acceptance.
Key Verification: Tested in test_fvg_poc_confluence.py: Mid-morning retest without POC rejected; aligned retest approved with +0.10 bonus; early/afternoon trades permitted.
| Test Suite Module | Coverage Target | Test Cases | Local Status | AWS EC2 Status |
|---|---|---|---|---|
test_token_vault.py |
Persistent Encrypted Token Vault & Auth Integration | 4 Tests | PASSED (100%) | PASSED (100%) |
test_chop_cooldown_and_displacement.py |
Chop Cooldown (20m) & Strike Re-Entry Displacement (45m / 25pts) | 4 Tests | PASSED (100%) | PASSED (100%) |
test_fvg_poc_confluence.py |
Mid-Morning Volume Profile POC Confluence (10:00 - 11:30 IST) | 3 Tests | PASSED (100%) | PASSED (100%) |
test_risk_manager.py |
Full Risk Engine Circuit Breakers & Invariant Gating | 22 Tests | PASSED (100%) | PASSED (100%) |
test_fyers_auth.py |
FYERS OAuth2 Flow, Header Signing & File Caching | 7 Tests | PASSED (100%) | PASSED (100%) |
test_fvg_retest_strategy.py |
Core Fair Value Gap Retest Price Action & Invalidation | 4 Tests | PASSED (100%) | PASSED (100%) |
Live Production Deployment Confirmed: All files uploaded to ubuntu@13.207.146.76:/home/ubuntu/AntigravityTradeSetup/. Service nifty-runner.service restarted successfully (Main PID: 323389). Automated EOD forensics archiver executed clean end-of-market audit, and dashboard REST API is healthy.