Minimal TypeScript examples for integrating with BOROS trading APIs.
-
Clone and install:
git clone <repo> cd boros-api-examples yarn install
-
Configure environment:
cp .env.example .env # Edit .env with your keys -
Run examples in order:
yarn example:agent # Approve your agent wallet yarn example:assets # View available assets yarn example:markets # View active markets yarn example:deposit # Deposit collateral yarn example:balance # Check your balance yarn example:place-order # Place a limit order
A separate key that can only trade (not withdraw). Generate any random wallet,
add to .env, then run 01-agent.ts to approve it.
You can have up to 256 sub-accounts (0-255). Default is 0. Each sub-account has separate margin and positions.
A packed identifier containing: (walletAddress, accountId, tokenId, marketId)
- For cross-margin: use
CROSS_MARKET_ID - For isolated-margin: use the specific
marketId
- Deposits/Withdrawals: Native token decimals (e.g., 6 for USDT)
- Trading/Balances: Always 18 decimals internally
Rates are represented as integer ticks. Formula:
rate = 1.00005^(tick * tickStep) - 1
Conversion between rate and tick using SDK helpers:
getRateAtTick()estimateTickForRate()
| # | Script | Requires Agent | Description |
|---|---|---|---|
| 01 | agent | No | Approve agent wallet |
| 02 | assets | No | List available assets |
| 03 | markets | No | List active markets |
| 04 | deposit | No | Deposit collateral |
| 05 | balance | No | Check balance and positions |
| 06 | withdraw | No | Request withdrawal |
| 07 | cash-transfer | Yes | Move funds between cross/isolated |
| 08 | market-order | Yes | Open/close position at market |
| 09 | place-order | Yes | Place limit order |
| 10 | cancel-order | Yes | Cancel existing order |
| 11 | bulk-place-orders | Yes | Efficient way to place multiple limit orders |