Team Ai
Apppublic

SRC-7777/Crypto-Options-Pricing-Greeks-Explainer

sourceHugging Faceupdated 11mo agoView on Hugging Face
0likes
App README

Crypto Options Pricing & Greeks Explainer

A "Bloomberg Terminal" lite interface for simulating crypto option prices and understanding the "Greeks" (Delta, Gamma, Theta).

Status Python

๐Ÿš€ 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

  1. 1.Clone the repository:
bash
    git clone https://github.com/Soham-1827/Crypto-Options-Pricing-Greeks-Explainer.git
    cd Crypto-Options-Pricing-Greeks-Explainer
  1. 1.Install dependencies:
bash
    pip install -r requirements.txt
  1. 1.Set up Environment Variables: Create a .env file in the root directory and add your OpenAI API Key (required for the "Teacher" agent):
ini
    OPENAI_API_KEY=sk-your-api-key-here

(See `.env.example` for reference)

๐Ÿ–ฅ๏ธ Usage

Run the application locally:

bash
python app.py

Open your browser and navigate to http://127.0.0.1:8050/.

How to use:

  1. 1.Select Asset: Enter a CoinGecko ID (e.g., bitcoin, ethereum, solana).
  2. 2.Set Parameters: Adjust the target date, strike price, and option type (Call/Put).
  3. 3.Run Simulation: Click the button to run the Monte Carlo simulation.
  4. 4.Analyze:
  5. 5.View the calculated Fair Price and Greeks.
  6. 6.Read the AI Explanation of what these numbers mean for your trade.
  7. 7.Visualize the Payoff Diagram.

๐Ÿงช Testing

Run the unit tests to verify the simulation logic and API connectivity:

bash
# 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.

  1. 1.Create a new Space (Select Dash as the SDK).
  2. 2.Upload the files from this repository.
  3. 3.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.