Quick References

Decimals

  • USDC: 6

  • Strikes: 8

  • Prices: 8

  • WETH: 18 (not used if USDC-only)

  • CBBTC: 8

Referrer

  • Use a unique address for your platform.

  • Pass as the 3rd arg to fillOrder() on every trade.

  • Filter user portfolios by position.referrer.

Endpoints

Orders:    https://round-snowflake-9c31.devops-118.workers.dev/
Trigger:   https://optionbook-indexer.thetanuts.finance/api/v1/update
Positions: https://optionbook-indexer.thetanuts.finance/api/v1/user/{address}/positions
History:   https://optionbook-indexer.thetanuts.finance/api/v1/user/{address}/history
Stats:     https://optionbook-indexer.thetanuts.finance/api/v1/stats

Example Flow (condensed)

// 1) fetch
const { data } = await (await fetch('https://round-snowflake-9c31.devops-118.workers.dev/')).json();

// 2) filter
const BTC = '0x64c9...48F'; const USDC = '0x8335...913';
const spreads = data.orders.filter(o =>
  o.order.priceFeed === BTC &&
  o.order.collateral.toLowerCase() === USDC.toLowerCase() &&
  o.order.strikes.length === 2
);

// 3) buy $10
await buyOption(spreads[0], 10);

// 4) sync + wait
await fetch('https://optionbook-indexer.thetanuts.finance/api/v1/update');
await new Promise(r => setTimeout(r, 15_000));

// 5) fetch positions → filter by referrer

Last updated