An interactive Jupyter notebook containing essential DeFi calculators for optimizing trading and liquidity provision strategies.
Colab link: https://colab.research.google.com/drive/19rR1TAGPDkcQcAiFyL7RVsMszc1JyHGi#scrollTo=iAU6Vzwfj4Bg
A comprehensive calculator for determining optimal position sizes and capital allocation when executing money market borrowing and perpetual futures strategies.
- Calculates optimal long/short position allocations
- Determines leverage for both positions
- Estimates transaction fees and capital efficiency
- Provides detailed breakdown of:
- Position sizes in dollar amounts
- Token quantities
- Swap fees and transaction costs
- Notional exposure
- Current Price
- LTV (Loan-to-Value ratio)
- Liquidation Factor
- Long/Short Liquidation Prices
- Total Investment Amount
- Swap Fee Percentage
- MMR (Maintenance Margin Ratio)
A tool for calculating optimal token ratios and splits when providing liquidity to AMM pools.
- Price ratio calculator between token pairs
- Optimal split calculator for LP positions
- High precision calculations (18 decimal places)
- Automatic ratio transfer between calculators
- Sample Token A Amount
- Sample Token B Amount
- Total Token A Available
- Price Ratio (auto-filled from ratio calculator)
- Open the notebook in a Jupyter environment
- Run all cells to initialize the calculators
- Input your parameters using the interactive widgets
- Results will update automatically as you adjust the inputs
- Python 3.x
- IPython
- ipywidgets
- decimal