Type/to search
8
Follow
1360
Followers
Get Rich Quick in Crypto? From Viral Post to Real Backtest Results
Discussions
Created 2026-01-22 17:27:59  Updated 2026-01-23 10:46:10
 0
 107

img

The Beginning: A Beautiful Arbitrage Dream

Recently while browsing Zhihu (Chinese Quora), I came across a post with an enticing title: "Stable Way to Get Rich in Crypto: 3,000 USDT to 12,000 USDT in Three Months."

I laughed. Stable? Get rich? When these two words appear together, there are usually only two possibilities: either it's a scam, or the person hasn't encountered a black swan event yet.

But as a quantitative trading developer, seeing this kind of strategy description, I couldn't resist clicking in to take a look.

The Theory Goes Like This:

  • BTC is the leader in crypto, so its price swings must be larger than its followers (ETH, SOL, etc.)
  • Bull market arrives: BTC rises aggressively → Long BTC + Short ETH → Profit from the spread
  • Bear market arrives: BTC falls harder → Short BTC + Long ETH → Still profit from the spread

img

After reading this, I fell into deep thought...

It seems, perhaps, maybe, possibly, hope, wish, maybe... there's some logic to it?

Version 1: The Naive Beginning

Without further ado, I opened FMZ Quant Platform and got to work!

The simplest logic:

javascript
// Pseudocode if (btcChange > 2%) { Open Long 1 contract BTC Open Short 1 contract ETH }

After writing it, I confidently clicked backtest, and then...

Got absolutely wrecked.

Watching that equity curve plummet straight down, I fell into deep self-doubt.

Version 2: Scientific Hedging

Where's the Problem? The Art of Beta Hedging

Calming down and thinking about it, the problem was obvious:

1 contract BTC ≠ 1 contract ETH

BTC is now $100,000 each, while ETH is only $3,000+. If you hedge 1:1 by quantity, that's not hedging—that's giving away money.

A real hedging strategy needs to consider:

  • Price ratio: BTC/ETH ≈ 30:1
  • Volatility difference: The return correlation between the two
  • Contract value: OKX BTC perpetual 1 contract = 0.01 BTC, ETH perpetual 1 contract = 0.1 ETH

Complete Implementation of Beta Hedging

This code is the core calculation engine of the strategy, fully implementing the Beta coefficient calculation of ETH relative to BTC. The Beta coefficient here represents two key pieces of information: the basic price ratio relationship and volatility linkage, which directly determines the hedging ratio.

javascript
// Calculate Beta coefficient of ETH relative to BTC function calculateBeta(btcRecords, ethRecords, lookback) { // Fallback handling when data is insufficient if (btcRecords.length < lookback + 1 || ethRecords.length < lookback + 1) { Log("⚠️ Insufficient K-line data, using current price ratio as default Beta") let btcPrice = btcRecords[btcRecords.length - 1].Close let ethPrice = ethRecords[ethRecords.length - 1].Close let defaultBeta = btcPrice / ethPrice betaInfo.currentBeta = defaultBeta betaInfo.correlation = 0 betaInfo.priceRatio = defaultBeta betaInfo.returnBeta = 1.0 betaInfo.lastUpdate = new Date().toLocaleString() Log(" Default Beta =", _N(defaultBeta, 2), "| Price ratio:", _N(btcPrice, 0), "/", _N(ethPrice, 0)) return defaultBeta } let btcReturns = [] let ethReturns = [] let priceRatios = [] // Step 1: Calculate daily returns + historical price ratios for (let i = btcRecords.length - lookback; i < btcRecords.length; i++) { // Daily return = (Today's close - Yesterday's close) / Yesterday's close let btcRet = (btcRecords[i].Close - btcRecords[i-1].Close) / btcRecords[i-1].Close let ethRet = (ethRecords[i].Close - ethRecords[i-1].Close) / ethRecords[i-1].Close btcReturns.push(btcRet) ethReturns.push(ethRet) // Record daily price ratio let ratio = btcRecords[i].Close / ethRecords[i].Close priceRatios.push(ratio) } // Step 2: Calculate historical average price ratio let avgPriceRatio = priceRatios.reduce((a, b) => a + b, 0) / priceRatios.length // Step 3: Calculate price ratio volatility let priceRatioVariance = 0 for (let i = 0; i < priceRatios.length; i++) { let diff = priceRatios[i] - avgPriceRatio priceRatioVariance += diff * diff } priceRatioVariance /= (priceRatios.length - 1) let priceRatioStd = Math.sqrt(priceRatioVariance) let priceRatioCv = priceRatioStd / avgPriceRatio // Coefficient of variation // Step 4: Calculate mean of returns let btcMean = btcReturns.reduce((a,b) => a+b, 0) / btcReturns.length let ethMean = ethReturns.reduce((a,b) => a+b, 0) / ethReturns.length // Step 5: Calculate covariance and variance let covariance = 0 let btcVariance = 0 let ethVariance = 0 for (let i = 0; i < btcReturns.length; i++) { let btcDiff = btcReturns[i] - btcMean let ethDiff = ethReturns[i] - ethMean covariance += btcDiff * ethDiff btcVariance += btcDiff * btcDiff ethVariance += ethDiff * ethDiff } covariance /= (btcReturns.length - 1) btcVariance /= (btcReturns.length - 1) ethVariance /= (ethReturns.length - 1) // Step 6: Calculate return Beta // Beta = Cov(ETH, BTC) / Var(BTC) let returnBeta = covariance / btcVariance // Step 7: Calculate correlation coefficient // Correlation = Cov(ETH, BTC) / (Std(BTC) × Std(ETH)) let correlation = covariance / Math.sqrt(btcVariance * ethVariance) // Step 8: Final Beta = Historical average price ratio × Return Beta let finalBeta = avgPriceRatio * returnBeta // Step 9: Limit Beta range to avoid extreme values let minBeta = avgPriceRatio * 0.5 let maxBeta = avgPriceRatio * 2.0 finalBeta = Math.max(minBeta, Math.min(maxBeta, finalBeta)) // Step 10: Get current price ratio let currentBtcPrice = btcRecords[btcRecords.length - 1].Close let currentEthPrice = ethRecords[ethRecords.length - 1].Close let currentPriceRatio = currentBtcPrice / currentEthPrice // Update Beta info to global betaInfo.currentBeta = finalBeta betaInfo.correlation = correlation betaInfo.returnBeta = returnBeta betaInfo.avgPriceRatio = avgPriceRatio betaInfo.currentPriceRatio = currentPriceRatio betaInfo.priceRatioStd = priceRatioStd betaInfo.priceRatioCv = priceRatioCv betaInfo.lastUpdate = new Date().toLocaleString() return finalBeta }

Main Functions and Logic:

  1. Data validation and fallback handling: Checks if historical data is sufficient; if not, uses current price ratio directly, ensuring the strategy can always run.

  2. Return series calculation: Converts price data to returns, eliminating the dimensional effect of absolute prices, making assets with different prices comparable.

  3. Core statistical calculations:

    • Covariance: Measures the direction and strength of return co-movement between BTC and ETH
    • Variance: Measures the volatility of BTC returns itself
    • Return Beta: Cov(ETH,BTC) / Var(BTC), indicating ETH return sensitivity to BTC return changes
    • Correlation coefficient: Standardized covariance, reflecting degree of linear correlation
  4. Composite Beta synthesis: Final Beta = Historical average price ratio × Return Beta. This considers both basic price differences (e.g., BTC is 30x ETH) and volatility characteristic differences (e.g., ETH volatility is 0.8x BTC). For example, if price ratio is 30 and return Beta is 0.8, then final Beta = 24, meaning hedging 1 BTC requires 24 ETH.

  5. Risk control mechanism: Sets reasonable range limits on Beta value, preventing unreasonable hedge ratios calculated from short-term extreme market conditions.

With Beta calculated, we still need to bridge "the gap between theory and reality"—converting theoretical coefficients to actually tradeable quantities on exchanges. This code completes this key conversion:

javascript
// Calculate hedge contract quantities function calculateHedgeAmount(beta) { let btcCoinAmount = config.btcCoinAmount // 0.1 BTC let ethCoinAmount = btcCoinAmount * beta // ETH quantity = 0.1 × Beta // Convert to contract quantities let btcContracts = Math.floor(btcCoinAmount / contractInfo.btcCtVal) btcContracts = Math.max(1, btcContracts) // At least 1 contract let ethContracts = Math.floor(ethCoinAmount / contractInfo.ethCtVal) ethContracts = Math.max(1, ethContracts) // Actual coin amounts for opening positions let actualBtcCoins = btcContracts * contractInfo.btcCtVal let actualEthCoins = ethContracts * contractInfo.ethCtVal Log("🎯 Hedge Calculation | Beta:", _N(beta, 3), "\n BTC: ", _N(actualBtcCoins, 4), "coins =", btcContracts, "contracts (CtVal:", contractInfo.btcCtVal, ")", "\n ETH: ", _N(actualEthCoins, 4), "coins =", ethContracts, "contracts (CtVal:", contractInfo.ethCtVal, ")", "\n Actual ratio:", _N(actualEthCoins / actualBtcCoins, 3)) return { btc: btcContracts, eth: ethContracts, btcCoins: actualBtcCoins, ethCoins: actualEthCoins, beta: beta } }

Key Conversion Steps:

  1. Determine base position size: Set base BTC quantity according to configuration (e.g., 0.1 BTC), serving as the "anchor" for the entire hedge portfolio.

  2. Theoretical coin calculation: ETH theoretical quantity = BTC base quantity × Beta coefficient.

  3. Contract value conversion: The most critical practical step. Divide theoretical coin amounts by each contract's "contract value" (CtVal). For example, 1 BTC contract might represent 0.01 BTC, 1 ETH contract represents 0.1 ETH, yielding contract quantities.

  4. Integer handling: Use floor division to ensure trading integer contracts, with minimum of 1. Also reverse-calculate actual trading ratios for subsequent precise P&L calculations.

Opening and Closing Logic

This is the execution and risk control part of the strategy, converting calculated hedge plans into actual trading operations and managing risk. Here we show the opening logic; use long positions as an example—short positions follow mirror logic.

Trigger condition design: Uses dual conditions—BTC gain > 2% AND BTC gain > ETH gain. This ensures sufficient market volatility and that the expected relative strength relationship holds.

javascript
// BTC up > 2% and gain greater than ETH → Long BTC + Short ETH if (btcChange > 0.02 && btcChange > ethChange) { let amounts = calculateHedgeAmount(beta) // First open BTC long let btcOrder = createMarketOrder(config.btcSymbol, "buy", amounts.btc) if (!btcOrder) { Log("❌ BTC long open failed") return null } // Then open ETH short let ethOrder = createMarketOrder(config.ethSymbol, "sell", amounts.eth) if (!ethOrder) { Log("❌ ETH short open failed, rolling back BTC") createMarketOrder(config.btcSymbol, "closebuy", amounts.btc) return null } Log("🟢 Position opened | Beta:", _N(beta, 3)) }

Atomic trade execution: Sequential execution with rollback mechanism. First open BTC long; if successful, then open ETH short. If ETH order fails, immediately close the already-opened BTC long, ensuring position integrity and avoiding single-sided risk exposure.

Here's the closing logic:

Calculate P&L by coin amount: Calculate combined P&L of both positions based on opening coin amounts, measuring comprehensive hedge effectiveness.

  • BTC long P&L = (Current price - Entry price) × BTC coin amount held
  • ETH short P&L = (Entry price - Current price) × ETH coin amount held

Risk control thresholds: Evaluate overall portfolio performance with asymmetric take-profit (+3%) and stop-loss (-1%) lines, pursuing positive expected value.

javascript
// Calculate P&L by coin amounts function checkClose(pos, btcTicker, ethTicker) { let btcPnlUsd, ethPnlUsd if (pos.type === 'long_btc_short_eth') { // BTC long P&L = (Current price - Entry price) × Coins btcPnlUsd = (btcTicker.Last - pos.btcPrice) * pos.btcCoinAmount // ETH short P&L = (Entry price - Current price) × Coins ethPnlUsd = (pos.ethPrice - ethTicker.Last) * pos.ethCoinAmount } else { btcPnlUsd = (pos.btcPrice - btcTicker.Last) * pos.btcCoinAmount ethPnlUsd = (ethTicker.Last - pos.ethPrice) * pos.ethCoinAmount } let totalPnlUsd = btcPnlUsd + ethPnlUsd let totalCost = pos.btcPrice * pos.btcCoinAmount + pos.ethPrice * pos.ethCoinAmount let totalPnlPct = totalPnlUsd / totalCost // Take profit: +3% if (totalPnlPct >= 0.03) { return {close: true, reason: '✅ Take Profit', pnl: totalPnlPct, pnlUsd: totalPnlUsd} } // Stop loss: -1% if (totalPnlPct <= -0.01) { return {close: true, reason: '🛑 Stop Loss', pnl: totalPnlPct, pnlUsd: totalPnlUsd} } return {close: false, pnl: totalPnlPct, pnlUsd: totalPnlUsd} }

Running the backtest again, the result...

The curve finally went up!

Backtest Data Analysis

From October 2025 to January 2026, approximately 3 months:

Capital Performance

MetricValue
Initial Capital$50,000
Final Equity$51,095
Total Return~2.2%
Max DrawdownControlled within reasonable range

Trading Statistics

MetricValue
Take Profit Count6 times
Stop Loss Count14 times
Win Rate30%

The Real Conclusion

After complete backtest verification, this strategy:

✅ What Works in Theory:

  • Beta hedging does reduce single-sided risk
  • Price ratio reversion provides arbitrage opportunities
  • Take-profit and stop-loss can protect profits

⚠️ Problems in Reality:

  • Low returns: Only 30% win rate, 2.2% cumulative return over 3 months—far from the 4x claimed in the post
  • Few opportunities: The 2% threshold limits opening frequency
  • Fee costs: Frequent opening/closing eats into profits
  • Slippage risk: Live trading may be worse than backtest
  • Extreme conditions: If BTC and ETH both surge/crash simultaneously, hedging fails

🔍 Optimization Directions:

  • Multi-coin rotation: Don't just hedge ETH—can add SOL, BNB, etc.
  • Dynamic thresholds: Adjust opening thresholds based on volatility
  • Stop-loss cooldown: Prohibit immediate reopening after stop-loss
  • Volatility Delta hedging: Besides price Beta, consider volatility hedging
  • Position sizing: Dynamically adjust capital ratio per trade

Final Thoughts: The Meaning of Quantitative Trading

This is the charm of quantitative trading:

Start with an idea → Write code to implement → Backtest to verify → Optimize and improve

The strategy concept in that Zhihu post wasn't wrong, but the devil is in the details:

  • Without Beta hedging, you're just gambling on direction
  • Without risk controls, you're trading naked
  • Without backtest verification, you're just daydreaming

Real quantitative trading means verifying every idea with data, implementing every strategy with code, and keeping records of every trade.

If you have an idea, verify it.

The code is at the end of this article. Feel free to run it yourself, modify it, and optimize it.

If you're interested, I can continue writing about:

  • Volatility Delta hedging strategies
  • Multi-coin rotation implementation
  • Position sizing and risk control optimization

Welcome to like, comment, and ask for more!

📝 Article source code (strategy parameters can be flexibly set at the beginning of the source code, trading logic has been optimized): Bidirectional Beta Hedging Strategy


Disclaimer

This article is for educational and discussion purposes only and does not constitute any investment advice.

PS: There's no stable get-rich-quick method in crypto—only risk management and continuous optimization.

Comment
All comments (0)
No data
No data
  • 1
iPhone Download
Forums
PINE Language
© 2015 - ∞ INVENTOR PTE LTD (SG)