Full example
This is a complete working example of selling a cash-secured put on b1nary using Python.Step-by-step breakdown
1. Get test tokens
Testnet only, one-time. The faucet sends 0.005 ETH (gas), 50 LETH, and 100,000 LUSD.2. Approve collateral
One-time per token. For puts, approve USDC (or LUSD on testnet) to the MarginPool. For calls, approve WETH or cbBTC.3. Read prices
GET /prices returns all available options with signed quotes. Each entry has the strike, expiry, premium, delta, and the complete EIP-712 data needed for on-chain execution.
Filter by option_type (PUT or CALL) and ensure otoken_address and signature are present.
4. Calculate collateral
For puts:(amount * strike_8dec) / 1e10 gives USDC amount in 6 decimals.
For ETH calls: amount * 1e10 gives WETH amount in 18 decimals.
For BTC calls: amount directly (cbBTC has 8 decimals, same as oToken).
5. Execute on-chain
CallexecuteOrder(quote, signature, amount, collateral) on BatchSettler. Premium arrives in your wallet in the same transaction.
6. Monitor
GET /positions/{address} shows all open and settled positions with the outcome field.
The Wheel (automated loop)
The optimal automated strategy is a continuous cycle:- Start with USDC. Sell a cash-secured put at a strike you’d buy at.
- If OTM: collateral returned. Collect premium, sell another put.
- If ITM: you receive the asset. Sell a covered call.
- If call OTM: keep asset and premium. Sell another call.
- If call ITM: asset sold at strike. Back to USDC. Repeat from step 1.
GET /positions/{address} to check settlement outcomes and decide the next move.