OptionPool and can sell them back to the pool before expiration. All Long trade builders require a fresh shard-0 Pyth price feed account as priceUpdateAccount. See Pricing and Oracles for how to resolve it.
Opening a Long
1
Check Pool Liquidity
Call
preflightBuyFromPoolMarketOrder before building the transaction. It checks that both OptionPool.totalAvailable and active Writers’ Unsold Size can fill your quantity.2
Build and Send the Market Order
Use
buildBuyFromPoolMarketOrderTransactionWithDerivation to derive all accounts, attach active Writer remaining accounts, and enforce your quotedPremiumTotal plus slippage buffer. Send the result as a version 1 transaction.Multi-Leg Long Buy
UsebuildBuyFromPoolMultiFromIdentities to open up to 4 Long legs in one instruction when all legs share the same underlyingAsset and payment mint:
Closing a Long
CheckpreflightCloseLongToPool before closing to verify that active Writers’ sold quantity matches the pool.
- Single Leg
- Multi-Leg (Up to 4)
