# Options

## Get Option Prices

{% code title="get\_option\_prices.py" %}

```python
import requests

response = requests.get(
    "https://api.synthdata.co/insights/option-pricing",
    headers={"Authorization": "Apikey YOUR_API_KEY"},
    params={"asset": "BTC"}
)

data = response.json()
current_price = data['current_price']
call_options = data['call_options']  # {"84000": 4813.78, "84500": 4313.81, ...}
put_options = data['put_options']    # {"84000": 0.0, "84500": 0.03, ...}
expiry = data['expiry_time']         # "2026-01-23 08:00:00Z"
```

{% endcode %}

## Find Mispriced Options

{% code title="find\_mispriced\_options.py" %}

```python
for strike, synth_call in call_options.items():
    market_call = get_market_price(strike)
    
    if synth_call > 0:
        edge = (market_call - synth_call) / synth_call
        
        if edge > 0.05:
            print(f"SELL {strike} call - {edge:.1%} edge")
        elif edge < -0.05:
            print(f"BUY {strike} call - {abs(edge):.1%} edge")
```

{% endcode %}

## Bull Call Spread

{% code title="bull\_call\_spread.py" %}

```python
# Buy ATM call, sell OTM call
strikes = sorted([int(k) for k in call_options.keys()])

# Find ATM (closest to current price)
atm_strike = min(strikes, key=lambda x: abs(x - current_price))

# Find OTM (5% above current price)
otm_strike = min([s for s in strikes if s > current_price * 1.05], default=strikes[-1])

cost = call_options[str(atm_strike)] - call_options[str(otm_strike)]
max_profit = (otm_strike - atm_strike) - cost
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.synthdata.co/insights/options.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
