Skip to content

Commit 4cc61d7

Browse files
committed
Merge branch 'master' of github.com:pendle-finance/documentation
2 parents 0688728 + 7c2c552 commit 4cc61d7

15 files changed

Lines changed: 852 additions & 11 deletions

File tree

File renamed without changes.
File renamed without changes.
File renamed without changes.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Boros Public API Documentation
2+
3+
## Overview
4+
5+
Welcome to the Boros Public API documentation. This API provides programmatic access to Boros Finance's trading and analytics platform, enabling you to integrate Boros functionality into your applications.
6+
7+
:::note Legacy Documentation
8+
The previous version of the backend documentation has been moved to the [Backend-legacy folder](https://github.com/pendle-finance/documentation/tree/master/docs/boros-dev-docs/Backend-legacy).
9+
:::
10+
11+
## Getting Started
12+
13+
### API Documentation
14+
15+
The complete API reference with all available endpoints, request/response schemas, and authentication details is available through our interactive OpenAPI documentation:
16+
17+
**Interactive API Docs:** https://api.boros.finance/open-api/docs
18+
19+
### SDKs
20+
21+
We provide official SDKs to simplify integration with the Boros API:
22+
23+
#### TypeScript SDK
24+
The TypeScript SDK offers full type safety and is ideal for Node.js and browser-based applications.
25+
26+
- **Repository:** https://github.com/pendle-finance/sdk-boros-public
27+
- **Installation:** `npm install @pendle/sdk-boros`
28+
29+
For detailed SDK documentation, API references, and advanced usage, refer to the SDK repository.
30+
31+
### Code Examples
32+
33+
For practical examples demonstrating common use cases and workflows, see our examples repository:
34+
35+
**Examples Repository:** https://github.com/pendle-finance/boros-api-examples
36+
37+
38+
## Support
39+
40+
For questions, issues, or feature requests, please refer to the relevant SDK repository or contact our support team. https://discord.gg/6BrmdyBkQ2
41+
42+
---
43+
44+
**Base URL:** `https://api.boros.finance`
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Glossary
2+
3+
Quick reference for key terms used in the Boros API. For portfolio concepts (leverage, margin, PnL, liquidation), see the [Boros User Glossary](https://pendle.gitbook.io/boros/boros-docs/about-boros/glossary).
4+
5+
---
6+
7+
## Core Concepts
8+
9+
| Term | Description |
10+
|------|-------------|
11+
| **Market** | A trading market uniquely identified by `marketId`, with one collateral token and specific parameters |
12+
| **Asset** | Any token in the system, identified by `tokenId` (e.g., USDT has 6 decimals, BTC has 8) |
13+
| **Root** | EVM address (0x-prefixed) serving as the primary trading identity |
14+
| **Account** | Sub-account under a root (IDs 0-255). Account `0` is default for trading; `255` is reserved for AMM |
15+
| **Agent** | Wallet authorized to trade on your behalf but cannot withdraw funds |
16+
| **Market Account** | Unique trading context: `(root, subaccountId, tokenId, marketId)`. Use `CROSS_MARKET_ID` (16777215) for cross-margin, or specific `marketId` for isolated |
17+
| **Decimals** | Deposits/withdrawals use native token decimals; trading/balances always use 18 decimals internally |
18+
19+
---
20+
21+
## Trading Concepts
22+
23+
| Term | Description |
24+
|------|-------------|
25+
| **OrderBook** | Primary liquidity source with Long/Short sides organized by price ticks. [Learn more](/boros-dev/Mechanics/OrderBook) |
26+
| **Order** | Trade instruction with `orderId`, `tick` (price level), `side`, `size` (18 decimals), and `tif` |
27+
| **Tick** | Integer price level. Formula: `rate = 1.00005^(tick × tickStep) - 1`. Use SDK helpers to convert |
28+
| **Slippage** | Max acceptable price impact as percentage (market orders only) |
29+
| **AMM** | Automated market maker providing continuous liquidity |
30+
31+
---
32+
33+
## Enums
34+
35+
### Side
36+
37+
| Value | Name | Description |
38+
|-------|------|-------------|
39+
| `0` | `LONG` | Betting on rate increase |
40+
| `1` | `SHORT` | Betting on rate decrease |
41+
42+
### Time In Force (TIF)
43+
44+
| Value | Name | Description |
45+
|-------|------|-------------|
46+
| `0` | `GOOD_TIL_CANCELLED` | Remains active until filled or cancelled |
47+
| `1` | `FILL_OR_KILL` | Must fill completely immediately or cancel |
48+
| `2` | `IMMEDIATE_OR_CANCEL` | Fill what's possible, cancel the rest |
49+
| `3` | `POST_ONLY` | Only add liquidity, reject if would take |
50+
| `4` | `POST_ONLY_SLIDE` | Post-only with price adjustment |
51+
52+
---
53+
54+
## SDK Helpers
55+
56+
```typescript
57+
import { MarketAccLib, CROSS_MARKET_ID, estimateTickForRate, getRateAtTick } from "@pendle/sdk-boros";
58+
import { FixedX18 } from "@pendle/boros-offchain-math";
59+
60+
// Pack market account
61+
const marketAcc = MarketAccLib.pack(walletAddress, accountId, tokenId, CROSS_MARKET_ID);
62+
63+
// Convert between tick and rate
64+
const tick = estimateTickForRate(FixedX18.fromNumber(0.05), tickStep, false);
65+
const rate = getRateAtTick(tick, tickStep);
66+
67+
// Convert decimals
68+
const size = FixedX18.fromNumber(100).value.toString();
69+
const amount = FixedX18.fromBigIntString(balanceString).toNumber();
70+
```
71+
72+
---
73+
74+
## Additional Resources
75+
76+
- [Boros User Glossary](https://pendle.gitbook.io/boros/boros-docs/about-boros/glossary) - Portfolio and general trading terms
77+
- [OrderBook Mechanics](/boros-dev/Mechanics/OrderBook) - How the orderbook works
78+
- [Custom Types](/boros-dev/Contracts/CustomTypes) - Contract type definitions
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Agent Trading
2+
3+
## Overview
4+
5+
An **agent** is an EVM address authorized to execute trading operations on behalf of your root account. Agents enable automated trading and simplified transaction management without requiring your root account to sign every transaction.
6+
7+
**Benefits:**
8+
- Execute trades without signing each transaction with your root account
9+
- Enable automated trading strategies
10+
- Simplified transaction flow for high-frequency operations
11+
- Enhanced security by limiting exposure of your root private key
12+
13+
## How Agents Work
14+
15+
Agents use a delegated signing mechanism where your root account authorizes a specific agent address to perform actions on your behalf. Once approved, the agent can sign transactions for operations like placing orders, canceling orders, and other trading activities.
16+
17+
## Setting Up an Agent
18+
19+
### Step 1: Generate an Agent
20+
21+
Create a new EVM address (private/public key pair) that will serve as your agent. This can be done using standard Ethereum wallet libraries.
22+
23+
**Example:** https://github.com/pendle-finance/boros-api-examples/blob/main/examples/01-agent.ts
24+
25+
### Step 2: Approve the Agent
26+
27+
Sign an approval payload with your root account to authorize the agent.
28+
29+
1. Generate the approval payload
30+
2. Sign the payload using your root account's private key
31+
3. Submit the signed approval to the Boros backend
32+
33+
Example can be found in https://github.com/pendle-finance/boros-api-examples/blob/main/examples/01-agent.ts
34+
35+
### Step 3: Confirmation
36+
37+
Once the approval transaction is processed, the agent is authorized to act on behalf of your account. You can now use the agent's signature for trading operations without requiring your root signature.
38+
39+
**API Reference:** Check agent expiry and status: https://api.boros.finance/open-api/docs#tag/agents/get/v1/agents/expiry-time
40+
41+
## Trading with an Agent
42+
43+
Once your agent is approved, follow this workflow for executing trades:
44+
45+
### Workflow
46+
47+
1. **Generate Calldata**
48+
- Call the Boros API to generate transaction calldata, or
49+
- Generate calldata manually using the SDK
50+
51+
2. **Sign with Agent**
52+
- Use your agent's private key to sign the calldata payload
53+
54+
3. **Submit Transaction**
55+
- Send the signed calldata to the Boros backend
56+
- The backend submits the transaction on-chain on your behalf
57+
58+
**Example:** https://github.com/pendle-finance/boros-api-examples
59+
60+
## Gas Fees
61+
62+
The Boros backend submits transactions to the blockchain on your behalf. Gas fees are charged for each on-chain action.
63+
64+
**Important Points:**
65+
- Gas fees are denominated in USD based on the current ETH price
66+
- Fees reflect the actual cost charged by the Arbitrum network
67+
- **No additional markup** - you pay only the network transaction fee
68+
- Fees are deducted from your account balance automatically
69+
70+
### Managing Gas Balance
71+
72+
You need to maintain sufficient balance to cover gas fees for your transactions.
73+
74+
#### Option 1: Pay via Agent Flow
75+
76+
Use the agent signing mechanism to deposit funds into your gas treasury.
77+
78+
**Example:** https://github.com/pendle-finance/boros-api-examples/blob/main/examples/12-top-up-gas-account.ts
79+
80+
#### Option 2: Web Interface
81+
82+
Use the Boros web interface for a simple deposit flow. You can go to https://boros.pendle.finance/account and click on the Gas balance button
83+
84+
85+
**UI Link:** [Boros App](https://boros.pendle.finance)
86+
87+
## Security Considerations
88+
89+
**Best Practices:**
90+
- Store agent private keys securely, separate from your root key
91+
- Monitor agent activity regularly
92+
- Set appropriate expiry times for agent approvals
93+
- Revoke agent access if compromised
94+
- Never share agent private keys
95+
96+
**Agent Limitations:**
97+
- Agents can only perform authorized trading operations
98+
- Agents cannot withdraw funds without additional authorization
99+
- Agent approvals can be revoked at any time by the root account
100+
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Boros Open API Documentation
2+
3+
This document provides a guide to integrating with the Boros trading platform API.
4+
5+
## Table of Contents
6+
7+
- [Overview](#overview)
8+
- [Base URLs](#base-urls)
9+
- [API Reference](#api-reference)
10+
- [Code Examples](#code-examples)
11+
12+
---
13+
14+
## Overview
15+
16+
The Boros Open API allows you to:
17+
- Query market data, assets, and order books
18+
- Deposit and withdraw collateral
19+
- Place, cancel, and manage orders
20+
- Query account balances and positions
21+
- Access funding rate and settlement data
22+
23+
For key concepts and terminology, see the [Glossary](./glossary).
24+
25+
**Example Repository:** [https://github.com/pendle-finance/boros-api-examples](https://github.com/pendle-finance/boros-api-examples)
26+
27+
---
28+
29+
## Base URLs
30+
31+
| Environment | Base URL |
32+
|-------------|----------|
33+
| Production | `https://api.boros.finance` |
34+
35+
All API endpoints are prefixed with `/open-api/v1/` (or `/open-api/v2/` for v2 endpoints).
36+
37+
---
38+
39+
## API Reference
40+
41+
For complete API documentation with all endpoints, parameters, request/response examples, and interactive testing, see:
42+
43+
- **Open API (Swagger):** [https://api.boros.finance/open-api/docs](https://api.boros.finance/open-api/docs)
44+
- **Transaction Submission API (Swagger):** [https://api.boros.finance/send-txs-bot/docs](https://api.boros.finance/send-txs-bot/docs)
45+
46+
### API Categories
47+
48+
| Category | Description |
49+
|----------|-------------|
50+
| **Assets** | Retrieve available assets with metadata and prices |
51+
| **Markets** | Query markets, trades, order books, and chart data |
52+
| **Accounts** | Manage settings, balances, orders, and transactions |
53+
| **Calldata** | Generate transaction calldata for deposits, withdrawals, orders, and more |
54+
| **Simulations** | Preview operations before executing on-chain |
55+
| **Funding Rate** | Access funding rate symbols and settlement summaries |
56+
| **Charts** | Fetch OHLCV data for markets |
57+
| **Agents** | Manage agent authorization and expiry |
58+
| **Events** | Query liquidation events |
59+
60+
### Transaction Submission Flow
61+
62+
1. Get calldata from the Open API (e.g., `/open-api/v1/calldata/place-orders`)
63+
2. Sign the calldata using `@pendle/sdk-boros` package
64+
3. Submit signed transactions to `/send-txs-bot/v2/agent/bulk-direct-call`
65+
66+
---
67+
68+
## Code Examples
69+
70+
For complete working examples including agent approval, deposits, withdrawals, order placement, and more, see the example repository:
71+
72+
**[https://github.com/pendle-finance/boros-api-examples](https://github.com/pendle-finance/boros-api-examples)**

0 commit comments

Comments
 (0)