"""AlphaForge GOAT Strategy Guide - How to Be the Greatest of All Time This is not just code. This is your quant trading BIBLE. Follow these rules religiously and you will compound wealth. Break them and you will blow up. Guaranteed. """ from typing import Dict, List import json # THE GOAT MINDSET - Read This Every Morning GOAT_MINDSET = """ THE GOAT MINDSET 1. SURVIVAL FIRST, PROFIT SECOND Your #1 job is NOT to make money. It's to NOT lose money. If you survive, compounding does the rest. 2. PROCESS OVER OUTCOME A bad process with a good result is LUCK. A good process with a bad result is VARIANCE. Judge yourself by your PROCESS, not your PnL today. 3. EDGE COMPOUNDS, LUCK DOESN'T A 0.05 IC doesn't sound like much. But over 252 trading days, it compounds into massive alpha. This is why Two Sigma and Renaissance are worth $100B+. 4. DIVERSIFICATION IS THE ONLY FREE LUNCH Harry Markowitz won a Nobel Prize proving this. Don't fight Nobel Prize winners. 5. YOU ARE YOUR OWN WORST ENEMY Fear makes you sell the bottom. Greed makes you buy the top. AlphaForge removes emotion. Trust the system. """ # THE GOAT RULES - Violate at Your Own Peril GOAT_RULES = { "risk_management": { "title": "RISK MANAGEMENT - THE ONLY THING THAT MATTERS", "rules": [ { "rule": "NEVER risk more than 2% of capital on a single position", "why": "A 2% risk means you can be wrong 50 times in a row and still have 36% left.", "action": "Set max_weight = 0.20 and stop-loss at 10%. 0.20 * 0.10 = 2% max loss." }, { "rule": "NEVER risk more than 6% of capital in a single month", "why": "Three 2% losses in a month = 6%. That's your circuit breaker.", "action": "Track monthly PnL. If down 6%, reduce all positions by 50%." }, { "rule": "ALWAYS know your maximum drawdown BEFORE you trade", "why": "If you can't handle a 20% drawdown, don't use a strategy with 25% historical max DD.", "action": "Set personal max DD threshold. AlphaForge default: 15%." }, { "rule": "NEVER add to a losing position", "why": "Averaging down is how amateurs turn small losses into catastrophes.", "action": "Use fixed position sizes. Never increase size because you're down." }, { "rule": "ALWAYS use the Kelly Criterion (fractionally)", "why": "Kelly tells you optimal bet size given your edge. Use HALF Kelly or QUARTER Kelly.", "action": "Kelly % = (Win Rate * Avg Win - Loss Rate * Avg Loss) / Avg Win. Use 25-50% of that." } ] }, "position_sizing": { "title": "POSITION SIZING - SIZE IS MORE IMPORTANT THAN TIMING", "rules": [ { "rule": "Size by VOLATILITY, not by conviction", "why": "A 'sure thing' in a volatile stock can hurt you more than a 'maybe' in a calm stock.", "action": "Position Size = (Target Risk %) / (Stock Volatility * Stop Loss %)." }, { "rule": "INCREASE size when Sharpe is high, DECREASE when Sharpe is low", "why": "Your edge fluctuates. When metrics are hot, press the bet. When cold, shrink.", "action": "Base position = Base * (Current Sharpe / Target Sharpe). Target Sharpe = 1.5." }, { "rule": "NEVER go all-in on a single signal", "why": "Even the best signals have drawdowns. Combine multiple uncorrelated signals.", "action": "Minimum 3 uncorrelated alpha sources: Price + Sentiment + Options Flow." }, { "rule": "USE volatility targeting for the TOTAL portfolio", "why": "If target vol is 10% but current vol is 20%, you are 2x too risky. Scale down 50%.", "action": "Portfolio Leverage = Target Vol / Current Portfolio Vol. Adjust daily." } ] }, "execution": { "title": "EXECUTION - THE DIFFERENCE BETWEEN THEORY AND REALITY", "rules": [ { "rule": "ALWAYS account for transaction costs", "why": "At 150% annual turnover and 3bps cost, you lose 0.09% to friction. At 10bps, 0.30%.", "action": "Use low-cost brokers. Avoid frequent rebalancing. Batch orders." }, { "rule": "NEVER trade during first/last 15 minutes unless you have to", "why": "Open and close have highest volatility and widest spreads.", "action": "Place orders between 10:30 AM - 3:30 PM EST. Use VWAP for large orders." }, { "rule": "ALWAYS use limit orders, NEVER market orders", "why": "Market orders guarantee execution at unknown prices. Limit orders control price. Saves 5-10bps.", "action": "Set limit at mid-price for liquid stocks. 5bps inside spread for illiquid." }, { "rule": "NEVER chase a move", "why": "If a stock already moved 2% in 5 minutes, you missed it. Chasing = buying high.", "action": "Set alerts at your entry price. If it never hits, move on. 10,000+ stocks exist." } ] }, "psychology": { "title": "PSYCHOLOGY - THE INVISIBLE KILLER", "rules": [ { "rule": "NEVER check PnL more than once per day", "why": "Intraday volatility is noise. Checking every minute creates anxiety and impulsive decisions.", "action": "Set a daily alarm for 4 PM. Check then. Close the app. Live your life." }, { "rule": "NEVER trade when emotional", "why": "Fear, greed, anger, euphoria - all destroy edge. Your brain can't make rational decisions under strong emotion.", "action": "After a big loss: mandatory 24-hour cooling period. No exceptions." }, { "rule": "ALWAYS keep a trading journal", "why": "You think you know why you made each trade. You don't. Writing forces clarity.", "action": "Log: Date, Signal, Size, Rationale, Outcome, Emotion Level (1-10). Review monthly." }, { "rule": "NEVER compare yourself to others", "why": "Social media shows winners, not losers. Everyone has drawdowns.", "action": "Your only benchmark is your own track record. Beat your previous self." }, { "rule": "ALWAYS sleep well at night", "why": "If you can't sleep because of positions, your risk is too high. Your body is telling you.", "action": "If you lose sleep, close 50% of the position tomorrow. Health > money." } ] }, "strategy": { "title": "STRATEGY - THE SCIENCE OF EDGE", "rules": [ { "rule": "ALWAYS have at least 3 uncorrelated alpha sources", "why": "Price momentum and mean reversion can be negatively correlated. When one fails, the other works.", "action": "AlphaForge uses: Price Technicals + Sentiment + Options Flow." }, { "rule": "NEVER overfit to historical data", "why": "A strategy that perfectly fits the past will fail in the future. Markets change.", "action": "Use walk-forward testing. Never optimize on the test set." }, { "rule": "ALWAYS monitor for regime changes", "why": "Strategies that work in bull markets often fail in bear markets.", "action": "Reduce beta in bear markets, increase in bull. AlphaForge detects regimes automatically." }, { "rule": "NEVER ignore the base rate", "why": "If SPY goes up 55% of days, any 'long every day' strategy wins 55%. Report ALPHA, not return.", "action": "If alpha < 2%, you are a closet indexer. Just buy SPY." }, { "rule": "ALWAYS diversify across time horizons", "why": "Short-term (1-5 days) and long-term (1-3 months) signals have different drawdown periods.", "action": "Run AlphaForge on 5-day, 21-day, and 63-day horizons. Blend 40/30/30." } ] } } # GOAT TIER DEFINITIONS GOAT_TIERS = { "NEEDS_WORK": { "range": (0, 40), "emoji": "🔧", "description": "You're learning. Don't trade real money yet.", "advice": [ "Paper trade for 6 months minimum", "Focus on risk management above all else", "Read 'A Random Walk Down Wall Street' by Malkiel", "Study the backtest metrics until you dream about Sharpe ratios" ] }, "DEVELOPING": { "range": (40, 55), "emoji": "📈", "description": "You have potential. Keep grinding.", "advice": [ "Trade with 10% of your intended capital", "Focus on one alpha source until you master it", "Journal every trade religiously", "Review your metrics weekly, not daily" ] }, "SOLID_PRO": { "range": (55, 70), "emoji": "💪", "description": "You're making real money. Stay disciplined.", "advice": [ "Scale to 50% of intended capital", "Add a second uncorrelated alpha source", "Implement dynamic position sizing based on Sharpe", "Start tracking tax efficiency" ] }, "ELITE_QUANT": { "range": (70, 85), "emoji": "⭐", "description": "You're in the top 5% of active managers.", "advice": [ "Scale to full capital allocation", "Consider managing money for friends/family", "Add options hedging for tail risk protection", "Document your process for institutional capital" ] }, "LEGENDARY_GOAT": { "range": (85, 100), "emoji": "🐐", "description": "You're competing with Renaissance and Two Sigma.", "advice": [ "Consider launching a hedge fund", "Hire a risk manager", "Diversify into alternative data sources", "Protect your IP aggressively - this edge won't last forever" ] } } def print_goat_mindset(): print(GOAT_MINDSET) def print_goat_rules(): for section, content in GOAT_RULES.items(): print(f"\n{'='*80}") print(f" {content['title']}") print(f"{'='*80}\n") for i, rule in enumerate(content['rules'], 1): print(f" {i}. {rule['rule']}") print(f" WHY: {rule['why']}") print(f" ACTION: {rule['action']}") print() def get_tier_advice(score: float) -> dict: for tier_name, tier_info in GOAT_TIERS.items(): low, high = tier_info['range'] if low <= score < high: return { 'tier': tier_name, 'emoji': tier_info['emoji'], 'description': tier_info['description'], 'advice': tier_info['advice'] } return GOAT_TIERS['LEGENDARY_GOAT'] if __name__ == '__main__': print_goat_mindset() print_goat_rules() for tier_name, tier_info in GOAT_TIERS.items(): print(f"{tier_info['emoji']} {tier_name}: {tier_info['description']}")