Borrowing it
Nothing to install: this file belongs to DoRmAmMu1997/My-Algo-Trading-Code. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/DoRmAmMu1997/My-Algo-Trading-Code/main/CLAUDE.mdgit clone --depth 1 https://github.com/DoRmAmMu1997/My-Algo-Trading-CodeWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/instructions/dormammu1997/my-algo-trading-code/claude-md)<a href="https://agentmods.dev/instructions/dormammu1997/my-algo-trading-code/claude-md"><img src="https://agentmods.dev/badge/instructions/dormammu1997/my-algo-trading-code/claude-md.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.04754 | $0.04754 |
| Opus 5 | $0.02377 | $0.02377 |
| Sonnet 5 | $0.00951 | $0.00951 |
| Haiku 4.5 | $0.00475 | $0.00475 |
Grade A, and why
My-Algo-Trading-Code CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
This is a copy
92% identical to My-Algo-Trading-Code AGENTS.md — 10 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.
How it starts
The opening of the file, as written. The whole thing — 226 lines — stays where its author put it; the contents beside it link to each section on GitHub.
CLAUDE.md — My-Algo-Trading-Code
Before doing any work in this repo, invoke the
anthropic-skills:using-superpowersskill (it surfaces any other relevant skills) and theanthropic-skills:karpathy-guidelinesskill, then follow them: simplicity first, surgical changes, surface tradeoffs, and verify before claiming done. This is live-money trading code — bias toward caution.
What this project is
A NIFTY index-options, multi-strategy trading system. The flow is: fetch 1-minute OHLC history from the DhanHQ API → backtest strategies on it → run a multithreaded "front test" whose approximately 27-strategy core roster and independently opt-in agents execute together — on paper by default, and live through a real broker when explicitly enabled. Running live since May 2026; daily per-strategy results are tracked in a Google Sheet.
Architecture (runtime)
One process, cooperating threads:
CentralMarketDataFetcher(one thread) polls DhanHQ and writes into a lock-guardedSharedMarketDataStore(1-min OHLC + LTPs). SettingMARKET_DATA_SOURCE=WEBSOCKET(fails closed to REST on any other value; needs the paid Dhan Data API subscription) swaps inWebSocketMarketDataFetcher: Dhan marketfeed ticks build the bars/LTPs (pure helpers inDependencies/tick_bar_builder.py), with REST kept for warmup and a once-per-minute true-up against official candles.- Approximately 27 core strategy worker threads read that store and decide trades: the
AtmSingleLegStrategyWorkerfamily (Renko / EMA / Heikin-Ashi / Profit-Shooter / Goldmine / Money-Machine / CPR / CPR Algo 3 (multi-instrument: spot + ITM CE + ITM PE) / Opening-Strike + 13 ported TradingBot strategies + the Regime Adaptive router), two hedged-puts workers, one Delta-0.2 hedged-spread worker, and one long-strangle worker (time-based dual-leg BUY of OTM1 CE+PE, with momentum re-entry). Regime Adaptive (ported from the MIT-licensedworkratananmol-hub/nifty-options-paper-trading-bot) is one worker that switches RULE on ADX: opening-range breakout when trending, VWAP fade when ranging, no trade when ADX is missing. Its two candidate rules live inSignal Generators/Regime Adaptive Strategy/regime_candidates.pyas library code with NO worker of their own — deliberately, so the router and a candidate can never take the same signal twice. Read that folder'sREGIME_PORTING_NOTES.mdbefore enabling it live: the feed carries no volume so its VWAP is an equal-weight proxy. It is also the first user of the shared bid/ask spread gate (<PREFIX>_MAX_SPREAD_PCT, default 0 = off for every other strategy):_spread_gate_allows_entryreadstop_bid_price/top_ask_priceoff the/optionchainresponse and refuses an entry wider than the cap in paper AND live, while an unreadable quote refuses LIVE only. The source's VIX and breadth vetoes remain unimplemented — absent by choice, not for want of data (the source runs on Dhan too). An optional, opt-in CPR Codex AI Agent is an independent five-minute SRSI/VWAP worker. It freezes completed-bar context behind four frozen no-argument MCP tools; Codex judges regime, setup, and premise exits, while the host owns deterministic entry/risk gates and execution. It is disabled by default, live-disabled by default, and uses the normal global-plus-strategy double gate. Accepted SIDEWAYS setups sell naked current-expiry ATM premium (bullish PE, bearish CE); TRENDING setups retain the existing option buys and expiry. Spot stops trigger exits but cannot guarantee fills. Ordinary CPR, CPR Algo 3, Regime Adaptive, and CPR AI may coexist with independent positions and P&L. Another optional, opt-in worker is LLM-driven: the SL Hunting AI Agent (a Claude agent viaclaude-agent-sdk) — off by default (SL_HUNTING_ENABLED), it decides once per completed 1-min bar (with BankNIFTY cross-confirmation, fetched per bar like CPR Algo 3, and dynamic ~₹2500 risk-based sizing) and acts through the same ATMenter_position/exit_position; its deps are lazily imported so a missing dep just disables it. Every NIFTY entry is mechanically MIRRORED with an equal-lot BankNIFTY ATM leg (SL_HUNTING_BNF_MIRROR, default true) — NOTE: the mirror roughly DOUBLES the basket's rupee risk beyondSL_HUNTING_RISK_BUDGET(operator-accepted; the daily max-loss kill-switch still caps the day): the legs are TIED for hard risk (stop/target, max-loss, 15:15 square-off close both) but the agent evaluates each leg's premise INDEPENDENTLY and can cut one alone via the EXITexit_legselector (NIFTY|BNF|BOTH). Entry stays NIFTY-only (the mirror copies it). It stops opening NEW positions after 10:30 (SL_HUNTING_NO_NEW_ENTRY_HOUR/_MINUTE, default 10:30) — not a square-off (exits + the 15:15 square-off still run; when flat past the cutoff it skips the LLM call entirely). After a target, stop, or premise-invalidating exit,SL_HUNTING_POST_EXIT_COOLDOWN_MINUTESblocks re-entry from the moment the WHOLE NIFTY/BankNIFTY basket is confirmed flat; a lone or partly closed leg does not run the timer down, exits never wait for it, and corrupt guard state rejects new LIVE entries. It can also learn from its own trades (v3): a per-trade journal feeds an off-loop reflection coach (sl_hunting_coach.py) that proposes lessons; the operator promotes approved ones intolessons.json, injected into the prompt only whenSL_HUNTING_LESSONS_ENABLED(human-gated, paper-first, off by default). Its knowledge also carries a curated BankNIFTY live-trading layer (v3a, knowledge-only): aBNF_SPECIFICsection (triple-index BNF+NIFTY+Sensex read, BankNIFTY as the "major index", expiry-day priority, round-number magnets) that is advisory context for the cross-index read — execution stays NIFTY-only — plus general lessons merged into the existing sections (distilled from Intraday Hunter videos; provenance insl_hunting_doc.md). With both optional agents enabled, the configured roster can reach approximately 29 workers, but enable and virtual-trading gates keep the running roster configuration-dependent. - Each entry/exit is published to a
queue.Queueconsumed by a singleTelegramMessageWorker(best-effort alerts; never blocks trading). That samepublish_trade_eventchoke point also mirrors every event into the crash-durable session state (Dependencies/session_state.py,SESSION_STATE_*, on by default): an atomically-written JSON file holding each closed trade's P&L immediately, plus every OPEN position — entry fill price, stop, target, quantity, contract ids and last cached LTP — snapshotted every 30s from the supervisor thread. Before a replacement run writes anything, it archives the exact prior file and carries same-day realized P&L into every matching worker so a restart cannot reset a daily max-loss budget. It exists because the Sheet is written ONCE at a clean end-of-day, so a mid-session crash (2026-08-10's machine hang) otherwise loses the whole day's books. Resuming OPEN exposure remains opt-in (SESSION_STATE_RESUME_ENABLED, default false) and deliberately narrow — today's date, an unclean shutdown, PAPER, single-leg only; live positions are never restored because the broker account is the authority there. Seedocs/adr/0012. - Real orders go through ONE shared, lock-guarded broker session via a broker-agnostic
execution_client(see Broker layer). On a clean end-of-day, per-strategy P&L is written to a Google Sheet with separate PAPER/LIVE/MIXED row labels. All behaviour is driven by a single.env— nothing is hard-coded per run.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 3d ago Changed · +1 lines · +14 tokens per session 159e406783a6
- 7d ago First seen · 225 lines · 4,740 tokens per session scan A 83277b6ece39
My-Algo-Trading-Code CLAUDE.md is an instructions file published in the GitHub repository DoRmAmMu1997/My-Algo-Trading-Code (12 stars, last pushed 2d ago), licensed MIT. It adds 4,754 tokens to every session, about $0.0238 per session on Opus 5. A static security scan graded it A with 0 findings. It is 92% identical to My-Algo-Trading-Code AGENTS.md, differing in 10 lines, and is treated as a copy.
Other instructions, from other repositories
codex AGENTS.md
AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.
vscode buildNext.instructions.md
Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).
next.js AGENTS.md
AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.
langchain AGENTS.md
AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.
vscode oss-third-party-notices.instructions.md
Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).
spec-kit AGENTS.md
AGENTS.md instructions for github/spec-kit, covering agents.md, about spec kit and specify, quickstart — add a new integration in 5 steps, integration architecture and integrationmanifest — file tracking.