Cryptocurrency Markets: Structure and Trading
Module: Fintech AI | Difficulty: Advanced
Market Structure
- 24/7 trading
- Global fragmented liquidity
- High volatility
AMM (Automated Market Making)
Impermanent Loss
where .
Trading Strategies
| Strategy | Risk | Complexity |
|---|---|---|
| Market Making | Medium | Low |
| Arbitrage | Low | Medium |
| Momentum | High | Low |
| DeFi Yield | High | High |
import numpy as np
class AMM:
def __init__(self, token_a_reserve, token_b_reserve):
self.reserve_a = token_a_reserve
self.reserve_b = token_b_reserve
self.k = token_a_reserve * token_b_reserve
def price(self):
return self.reserve_b / self.reserve_a
def swap(self, amount_in, fee=0.003):
amount_in_with_fee = amount_in * (1 - fee)
amount_out = self.reserve_b - self.k / (self.reserve_a + amount_in_with_fee)
self.reserve_a += amount_in_with_fee
self.reserve_b -= amount_out
return amount_out
def impermanent_loss(self, price_ratio):
return 2 * np.sqrt(price_ratio) / (1 + price_ratio) - 1
Research Insight: Crypto markets have unique characteristics: 24/7 trading, global fragmentation, and regulatory uncertainty. Market making is profitable due to high volatility and wide spreads, but inventory risk is significant.