{"id":"2079569980346204574","url":"https://x.com/milesdeutscher/status/2079569980346204574","text":"","author":{"name":"Miles Deutscher","username":"milesdeutscher","avatarUrl":"https://pbs.twimg.com/profile_images/2043255869513601025/wFHeLjZX_200x200.jpg"},"createdAt":"Tue Jul 21 14:11:34 +0000 2026","engagement":{"replies":19,"retweets":48,"likes":341,"views":255198},"article":{"title":"Building A Quant Trading Strategy With Claude Code (GARCH Method)","previewText":"This is not something you will find anywhere else on 𝕏.\nI recently used Claude Code to build and automate a legitimate quant desk trading strategy - and it's genuinely insane.\nThis quant strategy is","coverImageUrl":"https://pbs.twimg.com/media/HNtB129aoAAF-qX.jpg","content":"This is not something you will find anywhere else on 𝕏.\n\nI recently used Claude Code to build and automate a legitimate quant desk trading strategy - and it's genuinely insane.\n\nThis quant strategy is backtested on 15+ years of price data across the Nasdaq, Bitcoin, and more, and is one of the most used trading strategies by real quant desks. \n\nIt's called the GARCH model, and the economist behind the calculation won a Nobel Prize for it in 2003 - it's that powerful.\n\nIn this article, I'm revealing the entire process for how I automated this insane quant trading strategy using Claude Code.\n\nTo give back to the trading community, I open-sourced the GitHub repo, which contains the entire methodology behind this trading strategy - including a reusable Claude Skill, full TradingView installation instructions, & more. \n\nIn Section V (Installing & Testing the Claude Skill) you'll find the GitHub link you can use now to run this strategy for yourself in the live markets.\n\nTable of Contents \n\nI: wtf is a quant?\n\nII: Building Quant Models 101\n\nIII: The GARCH Model\n\nIV: Calculating Real Positions \n\nV: Installing & Testing the Claude Skill\n\nVI: Importing Into TradingView \n\nI truly believe this is one of my best finance x AI articles ever - be sure to bookmark this so you don't lose it. \n\n## I: wtf is a quant?\n\nOk. Before we dive into the actual strategy, we need to define what a \"quant\" is because the word gets thrown around constantly, and nobody explains what it actually means.  \n\nQuant is short for quantitative analyst. \n\nIn short, these are people who typically come out of advanced mathematics, physics, or computer science, and funds recruit them on some of the highest salaries in all of finance.  \n\nAs a quant, their job is to build financial models that represent a market view and turn that view into a trading system with real constraints attached.  \n\nAn example: Say your market view is \"the market is getting dangerous, I should be more careful.\"  \n\nThat is simply an opinion. \n\nA quant cannot trade an opinion, so they break it into pieces that can be measured. How dangerous, exactly? Measure it against the last year of data. How much more careful should we be? Divide the risk you can tolerate by the risk the market is currently paying out. What if I am wrong? \n\nIn short, a quant's job is to build quantitative *measurable* models and systems based on different market variables.\n\n![wtf is a quant?](https://pbs.twimg.com/media/HNtSP3MaoAAYQgr.jpg)\n\n## II: Building Quant Models 101\n\nMost retail traders open a chart and see price (where it has been, where it might go) - and their entire read is directional.\n\nA quant opens the same chart and reads a completely different set of variables. \n\nQuants are not looking to predict price direction, instead, they are often looking at:\n\n- Volatility\n\n- Value at risk\n\n- Position sizing\n\n- Exposure\n\n- Expected moves\n\nThen, they compress all of these various variables into a single score/calculation. \n\nFor the sake of this article, I'm going to call this the \"violence\" score - but I am aware that things are more nuanced than that. \n\nFor example:\n\nMarch 2020 S&P500 (-34% market crash)\n\n![March 2020 crash](https://pbs.twimg.com/media/HNtbmXzbQAAsYcy.jpg)\n\nFTX Collapse 2022 $BTC (-25% in a single week)\n\n![FTX collapse](https://pbs.twimg.com/media/HNtbtDubAAAi-gx.jpg)\n\nThese are two examples of pretty \"violent\" market trading days (high volatility). \n\nA quant analyst will look at both of these violent price movements and come up with a score that can be used to measure both (which is exactly what the GARCH framework does - more on this later). \n\nOn a typical day, there is about a ~10% chance of a violent move in $BTC. On a day after ones like the FTX crash, that probability triples to ~30% (these numbers are backtested from 15+ years of Bitcoin price data). \n\nThis model isn't perfect, but it gives you a rough framework for how a quant would actually build a tradeable model based on real market variables.\n\nQuant analysts (and the GARCH model) are often looking for predictable market volatility that can be used to manage portfolio risk. \n\n## III: The GARCH Model\n\nWe have established that market violence is predictable. The question now becomes how do we actually measure and forecast it?\n\nThis is where the Nobel-Prize-winning calculation by Robert F. Engle comes in.\n\nRobert F. Engle originally developed the \"ARCH\" framework that was then extended by his student Tim Bollerslev to the \"GARCH\" framework we know today that many quant desks run. \n\n![GARCH market volatility model ](https://pbs.twimg.com/media/HNthlMWaUAA6uu1.jpg)\n\nHow the GARCH calculation works \n\nGARCH forecasts tomorrow's market violence as the sum of three things:\n\n1. Base level market movement  \n\nEvery asset carries a baseline amount of movement. \n\nFor example, Bitcoin's is higher than the S&P's, and that never really changes.\n\n2.     Yesterday's shock\n\nHow hard did the market actually move in the last session?\n\n3.    Yesterday's volatility level\n\nWhere was volatility already sitting before that move happened?\n\nBy adding those three things together, you have a forecast for tomorrow's potential market violence - and that is the entire model.\n\nKeep in mind, with these three market variables, the GARCH model forecasts how violent the market may be in the future, but it doesn't give us a directional bias (long/short).\n\n## IV: Calculating Real Positions\n\nThis is where the GARCH volatility forecast becomes tradeable.  \n\nThe logic runs like this:\n\nThe risk on any trade is your position size multiplied by the market's violence - you cannot control market violence, so instead, you control position size.  \n\nThis is broken into three steps:\n\nStep One: Set Your Account Drawdown Limit  \n\nDecide the annual swing you are willing to tolerate on your account -institutional desks typically run ~15%.  \n\nStep Two: Pull the Violence Score\n\nPull the current violence score from the GARCH model.  \n\nAs I write this, the Nasdaq is running at roughly 30% annualised.  \n\n![Violence score calculation](https://pbs.twimg.com/media/HNtjMF0bsAAtwH4.jpg)\n\nStep Three: Calculate\n\nDivide your account drawdown limit by the model score (15/30 = 0.5).\n\nIf a trade signal fires today, that means it would get half your normal position size (0.5). \n\nFor example, on a $10,000 baseline position, that is $5,000.  \n\nWhere the GARCH model falls short \n\nThis model will never call a top or a bottom. In fact, it contains zero directional information at all, and if a crash erupts out of a genuinely calm market period, this will not save you, and in theory, you would catch it at full size. \n\nI am not claiming this quant model removes risk - but I am saying it is the best starting point I have found for thinking about risk the way professionals actually do. \n\nAnd to be clear, actual entries and exits are determined by another trading department within financial trading desks - a quant's job is simply to develop predictable, repeatable frameworks like the GARCH model to help manage risk over time. \n\n## V: Installing & Testing the Claude Skill\n\nI encoded this entire quant risk framework into a reusable Claude Skill that you can install to help manage your own portfolio's risk. \n\nHere's a step-by-step on how to install it - there are two ways to install it:\n\nMethod One: Plugin command\n\n- Open the GitHub: https://github.com/milesdeutscher/garchmethod/tree/main\n\n- Find the installation section, copy\n\n![Install](https://pbs.twimg.com/media/HNtm49FbUAACPIo.jpg)\n\nPaste the install command into Claude Code and it will run the plugin install automatically. \n\n![example ](https://pbs.twimg.com/media/HNtn5Eca8AAbar9.png)\n\nMethod Two: Manual file config. \n\nIf you want to see the strategy written line by line, open garchmethod.md in the repo, copy the whole file, and paste it into Claude Code.\n\nIt will fetch the skill files from the repo and verify the strategy for you.\n\n![manual config. file](https://pbs.twimg.com/media/HNtoBZfbAAAfsXW.jpg)\n\nYou do not need both methods - I am just showing you both so you can choose.\n\nOnce it is installed, you can just talk to it, and it runs using the exact GARCH model outlined above. \n\nExample prompts\n\n\"What's the volatility forecast on Bitcoin?\"\n\n\"Explain what the current volatility forecast means on $BTC in simple terms and how it should impact my Bitcoin position sizing.\"\n\n\"Help me size my S&P500 position according to current market volatility\" \n\n![example](https://pbs.twimg.com/media/HNtrRr8bwAA2N72.png)\n\nBacktesting the strategy \n\nI backtested the same trading strategy two ways. One with fixed position sizing, and one with the GARCH position sizing framework.\n\nThe strategy itself was a simple EMA cross, running on 15 years of Bitcoin data. I ran the same entries, same exits, and the same signals in both.\n\nOver the 15-year timeframe, the GARCH framework ended with a total portfolio equity of $21,205, while the fixed position sizing ended at $17,957. \n\nThe important part is that the GARCH framework took significantly fewer drawdowns, and overall, less market risk to achieve a greater portfolio balance.\n\n![backtesting (real results)](https://pbs.twimg.com/media/HNtrXrcaEAAev5x.png)\n\n![backtesting (real results)](https://pbs.twimg.com/media/HNtp1x5agAAgEoQ.jpg)\n\nI conducted many other such backtests where the GARCH framework was a clear winner, and this is why this quant framework is so powerful. \n\n## VI: Importing Into TradingView\n\nThis is the last piece that puts the whole framework on your chart as a live number.  \n\nInside the repo there is a Pine Script folder. \n\nOpen it and copy the entire file. \n\n![Pine script](https://pbs.twimg.com/media/HNtrggEa4AAuLkg.jpg)\n\nThen go into TradingView, open the Pine Editor, paste it in, hit enter, and refresh.  \n\nThis will load the entire indicator and calculation score into your live charts.\n\n![Importing into TradingView](https://pbs.twimg.com/media/HNtsAYTbUAAbO0s.jpg)\n\nOnce added, you'll see a live \"Storm Gauge\" calculation in your TradingView charts (the GARCH volatility calculation in real time).\n\n![Storm Gauge](https://pbs.twimg.com/media/HNtsbKKbEAAJvk6.jpg)\n\n## Closing \n\nI hope you found this quant framework valuable - I genuinely haven't seen anybody else use AI in the markets like this. \n\nIf you did find this valuable, be sure to follow me here @milesdeutscher - every single week, I post articles breaking down how I'm using AI to gain an edge in the financial markets.\n\nFor deeper AI insights, follow me over on @aiedge_. \n\nIf you enjoy written content, feel free to subscribe to my free market newsletter.\n\nEvery single week, we publish free market research, real finance x AI workflows, & more.\n\nhttps://newsletter.milesdeutscher.com.au/\n\n![Market newsletter by Miles ](https://pbs.twimg.com/media/HNttydUbAAAE_gp.jpg)\n\n100% free, no spam ever & unsub anytime\n\nThank you for making it this far.\n\n- Miles"}}