Positions and History

Production advice: index on-chain events yourself. Use these endpoints for dev/test.

Base URL

https://odette.fi/api

After a Trade — Trigger Sync

POST/GET https://optionbook-indexer.thetanuts.finance/api/v1/update
  • Call immediately after a trade.

  • If { status: "skipped" }, retry after ~10s.

  • Wait ~15s after a successful update before fetching positions.

Fetch User Positions (OPEN)

GET https://optionbook-indexer.thetanuts.finance/api/v1/user/{userAddress}/positions

Response (abridged)

[
  {
    "address": "0x...",
    "status": "open",
    "buyer": "0x...",
    "seller": "0x...",
    "referrer": "0x...",         // filter by YOUR_REFERRER
    "createdBy": "0x...",        // OptionBook contract (do not filter on this)
    "entryTimestamp": 1734336000,
    "entryTxHash": "0x...",
    "entryPremium": "1000000",
    "entryFeePaid": "30000",
    "collateralToken": "0x8335...913",
    "collateralSymbol": "USDC",
    "collateralDecimals": 6,
    "underlyingAsset": "BTC",
    "priceFeed": "0x64c9...48F",
    "strikes": ["10000000000", "11000000000"],
    "expiryTimestamp": 1734364800,
    "numContracts": "20000000",
    "collateralAmount": "100000000",
    "optionType": 257,
    "settlement": null,
    "explicitClose": null
  }
]

Filter by your referrer

const MY_REFERRER = '0x...';
const mine = positions.filter(p => p.referrer.toLowerCase() === MY_REFERRER.toLowerCase());

Fetch User History (SETTLED)

GET https://optionbook-indexer.thetanuts.finance/api/v1/user/{userAddress}/history

Same shape as positions, with:

  • status: "settled"

  • settlement populated (settlementPrice 8 dp, payoutBuyer 6 dp, etc.)

Other Endpoints

GET https://optionbook-indexer.thetanuts.finance/api/v1/open-positions   // all open positions
GET https://optionbook-indexer.thetanuts.finance/api/v1/stats            // protocol stats

Last updated