SRC-7777/Crypto-Options-Pricing-Greeks-Explainer
0
Crypto Options Pricing & Greeks Explainer
A "Bloomberg Terminal" lite interface for simulating crypto option prices and understanding the "Greeks" (Delta, Gamma, Theta).
๐ Features
- Heston Model Simulation: Uses Monte Carlo simulation with stochastic volatility (more accurate for crypto than Black-Scholes).
- Real-Time Data: Fetches spot prices from CoinGecko and risk-free rates (yields) from DefiLlama.
- AI Teacher: Uses LangChain + OpenAI to explain complex option Greeks in plain English.
- Interactive UI: Built with Dash & Plotly for a professional financial terminal look.
๐ ๏ธ Installation
- Clone the repository:
git clone https://github.com/Soham-1827/Crypto-Options-Pricing-Greeks-Explainer.git
cd Crypto-Options-Pricing-Greeks-Explainer- Install dependencies:
pip install -r requirements.txt- Set up Environment Variables: Create a
.envfile in the root directory and add your OpenAI API Key (required for the "Teacher" agent):
OPENAI_API_KEY=sk-your-api-key-here(See `.env.example` for reference)
๐ฅ๏ธ Usage
Run the application locally:
python app.pyOpen your browser and navigate to http://127.0.0.1:8050/.
How to use:
- Select Asset: Enter a CoinGecko ID (e.g.,
bitcoin,ethereum,solana). - Set Parameters: Adjust the target date, strike price, and option type (Call/Put).
- Run Simulation: Click the button to run the Monte Carlo simulation.
- Analyze:
- View the calculated Fair Price and Greeks.
- Read the AI Explanation of what these numbers mean for your trade.
- Visualize the Payoff Diagram.
๐งช Testing
Run the unit tests to verify the simulation logic and API connectivity:
# Run simulation logic tests
python -m unittest tests/test_simulation.py
# Run API connectivity tests (requires internet)
python -m unittest tests/test_api.pyโ๏ธ Deployment (Hugging Face Spaces)
This project is ready for deployment on Hugging Face Spaces.
- Create a new Space (Select Dash as the SDK).
- Upload the files from this repository.
- Go to Settings > Variables and add
OPENAI_API_KEY.
โ ๏ธ Disclaimer
This tool is for educational purposes only. The prices generated are simulations based on mathematical models and do not represent guaranteed market prices. Crypto options are high-risk instruments.
