|
| 1 | +#!/usr/bin/env bash |
| 2 | +# |
| 3 | +# FTX Collapse — Crypto Contagion Hedge |
| 4 | +# ======================================== |
| 5 | +# |
| 6 | +# Date: November 8, 2022 (Binance announced it would sell its FTT holdings) |
| 7 | +# |
| 8 | +# Thesis: On Nov 6, CoinDesk reported Alameda's balance sheet was full |
| 9 | +# of FTT tokens. On Nov 8, Binance announced it would liquidate its |
| 10 | +# ~$530M in FTT, triggering a bank run on FTX. Crypto was about to |
| 11 | +# enter a contagion spiral — but it wasn't clear how far traditional |
| 12 | +# markets would follow. The trade: short crypto (BTC + ETH) and go |
| 13 | +# long gold as a safe-haven hedge in case the contagion spread. |
| 14 | +# |
| 15 | +# Legs: |
| 16 | +# 1. Short BTC — 0.15 BTC at ~$18,500 ($2,775 notional) |
| 17 | +# 2. Short ETH — 2.0 ETH at ~$1,340 ($2,680 notional) |
| 18 | +# 3. Long GOLD — 3 oz at ~$1,712/oz ($5,136 notional) |
| 19 | +# |
| 20 | +# Gold is the anchor — roughly sized to match the combined crypto short. |
| 21 | +# If crypto crashes and gold holds or rises, both sides win. If crypto |
| 22 | +# recovers, the gold leg limits the damage. |
| 23 | +# |
| 24 | +# What happened: BTC dropped from $18.5k to $15.7k (-15%) in 7 days. |
| 25 | +# ETH fell from $1,340 to $1,100 (-18%). Gold was roughly flat, |
| 26 | +# providing stability. The crypto short was the main profit driver. |
| 27 | +# |
| 28 | +# Usage: ./examples/backtest/ftx_crypto_contagion.sh |
| 29 | +# |
| 30 | +set -uo pipefail |
| 31 | +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" |
| 32 | +BT="${BACKTEST:-$SCRIPT_DIR/../../target/release/backtest}" |
| 33 | + |
| 34 | +echo "" |
| 35 | +echo "══════════════════════════════════════════════════════════════" |
| 36 | +echo " FTX Collapse — November 8, 2022" |
| 37 | +echo " Short BTC + Short ETH + Long GOLD (contagion hedge)" |
| 38 | +echo "══════════════════════════════════════════════════════════════" |
| 39 | +echo "" |
| 40 | + |
| 41 | +# ── Reset portfolio ──────────────────────────────────────────────── |
| 42 | +$BT --at 2022-11-08 reset 2>/dev/null |
| 43 | + |
| 44 | +# ── Scout: get prices on Nov 8, 2022 ────────────────────────────── |
| 45 | +echo "── Scouting prices on 2022-11-08 ──" |
| 46 | +echo "" |
| 47 | + |
| 48 | +BTC_PRICE=$($BT --at 2022-11-08 --json '{"command":"quote","symbol":"BTC"}' 2>/dev/null | jq -r '.price') |
| 49 | +ETH_PRICE=$($BT --at 2022-11-08 --json '{"command":"quote","symbol":"ETH"}' 2>/dev/null | jq -r '.price') |
| 50 | +GOLD_PRICE=$($BT --at 2022-11-08 --json '{"command":"quote","symbol":"GOLD"}' 2>/dev/null | jq -r '.price') |
| 51 | + |
| 52 | +echo " BTC: \$$BTC_PRICE" |
| 53 | +echo " ETH: \$$ETH_PRICE" |
| 54 | +echo " GOLD: \$$GOLD_PRICE" |
| 55 | +echo "" |
| 56 | + |
| 57 | +# ── Leg 1: Short BTC — exchange contagion ───────────────────────── |
| 58 | +echo "── Leg 1: Short BTC (FTX contagion, forced selling) ──" |
| 59 | +$BT --at 2022-11-08 sell BTC --amount 0.15 --price "$BTC_PRICE" |
| 60 | + |
| 61 | +# ── Leg 2: Short ETH — crypto-wide selloff ──────────────────────── |
| 62 | +echo "── Leg 2: Short ETH (correlated crypto drawdown) ──" |
| 63 | +$BT --at 2022-11-08 sell ETH --amount 2.0 --price "$ETH_PRICE" |
| 64 | + |
| 65 | +# ── Leg 3: Long gold — safe-haven anchor ────────────────────────── |
| 66 | +echo "── Leg 3: Long GOLD (safe haven, hedge against reversal) ──" |
| 67 | +$BT --at 2022-11-08 buy GOLD --amount 3 --price "$GOLD_PRICE" |
| 68 | + |
| 69 | +# ── Portfolio snapshot ───────────────────────────────────────────── |
| 70 | +echo "══════════════════════════════════════════════════════════════" |
| 71 | +echo " Portfolio Summary" |
| 72 | +echo "══════════════════════════════════════════════════════════════" |
| 73 | +$BT --at 2022-11-08 balance |
| 74 | +$BT --at 2022-11-08 positions |
| 75 | + |
| 76 | +# ── Cleanup ──────────────────────────────────────────────────────── |
| 77 | +$BT --at 2022-11-08 reset > /dev/null 2>&1 |
0 commit comments