Skip to main content

Options Pricing Examples

Complete examples for pricing options with Greeks calculation.

Example 1: European Call Option

import requests

API_KEY = "fk_user_your_key"
BASE_URL = "https://finceptbackend.share.zrok.io"

# Price European call
response = requests.post(
    f"{BASE_URL}/quantlib/pricing/black-scholes",
    headers={"X-API-Key": API_KEY},
    json={
        "spot": 100,
        "strike": 105,
        "rate": 0.05,
        "volatility": 0.2,
        "time_to_maturity": 0.25,
        "option_type": "call"
    }
)

result = response.json()
print(f"Price: {result['data']['price']}")
print(f"Delta: {result['data']['delta']}")
Cost: 2 credits

Example 2: American Put with Binomial Tree

response = requests.post(
    f"{BASE_URL}/quantlib/pricing/binomial-tree",
    headers={"X-API-Key": API_KEY},
    json={
        "spot": 100,
        "strike": 105,
        "rate": 0.05,
        "volatility": 0.2,
        "time": 0.5,
        "steps": 100,
        "option_type": "american_put"
    }
)
Cost: 2 credits

Example 3: Barrier Option

response = requests.post(
    f"{BASE_URL}/quantlib/pricing/barrier-option",
    headers={"X-API-Key": API_KEY},
    json={
        "spot": 100,
        "strike": 105,
        "barrier": 110,
        "barrier_type": "up_and_out",
        "rate": 0.05,
        "volatility": 0.2,
        "time": 0.25,
        "option_type": "call"
    }
)
Cost: 2 credits More examples →