# Overview

TypeScript SDK for Thetanuts Finance V4 — options trading on EVM chains.

## Features

* **Complete Options Trading**: Fill orders, manage positions, handle RFQs
* **Settlement Types**: Cash-settled and physically settled options
* **Multi-Strategy Support**: Spreads, butterflies, condors, iron condors (cash-settled)
* **Real-time Data**: WebSocket subscriptions for live updates
* **Type-Safe**: Full TypeScript support with comprehensive type definitions
* **Modular Design**: Use only what you need
* **ESM and CJS builds**: Maximum compatibility

## OptionBook vs RFQ

The SDK supports two trading systems. Choose based on your use case:

|                 | **OptionBook**                                                               | **RFQ (Factory)**                                                                                 |
| --------------- | ---------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
| **What**        | Fill existing market-maker orders                                            | Create custom options via sealed-bid auction                                                      |
| **When to use** | Quick trades on listed options (vanilla and multi-leg)                       | Custom options via sealed-bid auction: any strike, any expiry, cash-settled or physically settled |
| **Structures**  | Vanilla, spread, butterfly, condor, iron condor (cash-settled)               | Vanilla, spread, butterfly, condor, iron condor (cash-settled or physically settled for vanilla)  |
| **Key methods** | `fillOrder()`, `previewFillOrder()`                                          | `buildRFQRequest()`, `requestForQuotation()`                                                      |
| **Pricing**     | Order prices from `fetchOrders()`                                            | MM pricing from `getAllPricing()`                                                                 |
| **Data source** | Book indexer (`/api/v1/book/`)                                               | Factory indexer (`/api/v1/factory/`)                                                              |
| **User data**   | `getUserPositionsFromIndexer()`                                              | `getUserRfqs()`, `getUserOptionsFromRfq()`                                                        |
| **Stats**       | `getBookProtocolStats()`, `getBookDailyStats()`                              | `getFactoryProtocolStats()`, `getFactoryDailyStats()`                                             |
| **Collateral**  | Paid upfront by taker                                                        | `collateralAmount = 0` (held by factory)                                                          |
| **Settlement**  | Cash-settled (payout in USDC/WETH/cbBTC based on price difference at expiry) | Cash-settled by default; physically settled optional via `buildPhysicalOptionRFQ()`               |

## Which one should I use?

Both OptionBook and RFQ create cash-settled options using the same on-chain contracts. The difference is how you get there:

```
Is there an existing order that matches your trade?
  YES --> Use OptionBook (instant fill, no waiting)
  NO  --> Use RFQ (custom strike/expiry, MMs compete on price)

Need physical settlement (actual token delivery at expiry)?
  YES --> Use RFQ with buildPhysicalOptionRFQ()
  NO  --> Either works. OptionBook is faster if an order exists.
```

**OptionBook** is like a limit order book. Makers have already posted orders with set strikes, expiries, and prices. You pick one and fill it instantly.

**RFQ** is like sending out a request for bids. You specify what you want (any strike, any expiry), and market makers compete via sealed-bid auction. It takes \~60 seconds for offers to arrive, but you get competitive pricing on exactly the parameters you need.

***

## See also

* [Installation](https://docs.thetanuts.finance/sdk/getting-started/installation)
* [Quick Start](https://docs.thetanuts.finance/sdk/getting-started/quick-start)
* [Supported Chains](https://docs.thetanuts.finance/sdk/getting-started/supported-chains)


---

# 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.thetanuts.finance/sdk/getting-started/overview.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.
