Boros API Best Practices
This guide provides recommendations and common patterns for integrating with the Boros API efficiently.
Bulk Order Placement
When placing multiple orders simultaneously, always use the bulk order endpoint instead of making multiple single order requests.
Why Use Bulk Orders?
| Approach | Gas Cost | Atomicity | Network Overhead |
|---|---|---|---|
| Multiple single orders | High (N transactions) | None (partial failures possible) | High |
| Bulk orders | Low (1 transaction) | Atomic (all or nothing) | Low |
Benefits
- Lower Gas Fees — Multiple operations batched into a single transaction
- Atomic Execution — All operations execute together, eliminating partial execution risks
- Better Performance — Reduces network overhead and speeds up execution
- Complex Strategies — Combine cancellations and new orders in one operation
Unlike single order placement (placeSingleOrder), bulk orders do NOT match with the AMM. They are placed directly into the order book. If you need to take liquidity from both the order book and the AMM, use single order placement with IOC or FOK time-in-force.
Examples
Transaction Submission
direct-call vs bulk-direct-call
The Send Txs Bot provides two submission endpoints:
| Endpoint | Use case |
|---|---|
POST /v2/agent/direct-call | Submit a single calldata |
POST /v2/agent/bulk-direct-call | Submit one or more calldatas with sequential execution |
Both v2 and v3 expose bulk-direct-call, but they have different request schemas:
- v2 (
BulkAgentExecuteDto) — no session required. Use this for programmatic / API integrations. - v3 (
BulkAgentExecuteV2Dto) — requires a mandatoryagentSessionfield (HTTP-only cookie / CSRF token). Use this for browser-based UIs only.
Unless you are building a browser UI with session management, always use v2.
When to use bulk-direct-call: Whenever you have more than one calldata to submit in a single batch — for example, the N calldatas returned by a bulk POST /calldata/place-orders, or a cancel-and-replace pair where you want them to execute in order. bulk-direct-call accepts an array of signed calldatas and executes them sequentially.
The new Open API at https://api-boros.pendle.finance/apis/ does not auto-prepend an exit-market or enter-market calldata. If you need to enter a market before trading, call POST /calldata-builder/agent/enter-markets explicitly and include its calldata in the same bulk-direct-call batch (or submit it earlier).
The legacy autoExitMarket parameter only applies to the deprecated mount at https://api.boros.finance/open-api/v1/calldata/place-order (singular). On the new plural endpoint, market entry/exit is your responsibility.
skipReceipt Parameter
Controls whether the Send Txs Bot waits for block confirmation:
skipReceipt=false(default): Waits for the transaction to be included in a block, then returnsstatusanderrorfields. Higher latency but gives immediate confirmation.skipReceipt=true: Returns thetxHashimmediately after broadcasting. Lower latency but you must track the transaction status yourself.
Market Management
Exit Unused Markets
If you have entered markets that are no longer in use, exit them to reduce gas costs on future operations.
When you enter a market, the system tracks your participation for margin calculations. Each entered market adds overhead to the margin tracker, making it more expensive in gas for every subsequent transaction.
Important limitations:
- Maximum 10 entered markets per
marketAcc(market account). This limit is per combination of (address, accountId, tokenId) — i.e., per collateral type. - Maximum active limit orders per
marketAccper market (configurable per market viamaxOpenOrders, typically 100) - Entering more markets = heavier margin calculations = higher gas costs
If you trade many markets over time (e.g., weekly expiry markets), you will hit the 10-market limit. You must exit expired/matured markets to free up slots for new ones. Call POST /calldata-builder/agent/exit-markets with the matured marketIds and submit the calldata via the Send Txs Bot.
Exiting unused markets helps:
- Reduce gas consumption on all subsequent transactions
- Free up slots for new markets (10 market limit)
- Improve transaction performance
When to Exit Markets
- After closing all positions in a market
- When you no longer plan to trade a specific market
- During account cleanup/maintenance
- Before market expiry (for dated markets)
To exit a market, you must first:
- Close all positions (zero position size)
- Cancel all open orders
- Have no pending settlements
Isolated-Only Markets
Some markets are isolated-only, meaning they cannot be traded from a cross-margin account. For these markets:
- Deposit to the isolated account — You must transfer collateral specifically to the isolated market account, not the cross-margin account
- Use the correct
marketAcc— Pack themarketAccwith the specificmarketIdinstead ofCROSS_MARKET_ID
import { MarketAccLib } from "@pendle/boros-sdk-public";
// For isolated-only markets, use the specific marketId
const isolatedMarketAcc = MarketAccLib.pack(
walletAddress,
accountId,
tokenId,
marketId // Use the specific market ID, NOT CROSS_MARKET_ID
);
To fund an isolated account, either:
- Direct deposit: Deposit directly to the isolated market using the
marketIdin the deposit calldata - Cash transfer: Transfer from cross-margin to isolated using the
/calldata/cash-transferendpoint withisDeposit: true
Example: Top Up Isolated Account