---
title: "Closed-trade ledger"
method: GET
path: "/api/bot/v1/trades"
tags: ["Paper trading"]
---

# Closed-trade ledger

`GET /api/bot/v1/trades`

## Request

- Base URL: `https://marginpad.io`
- URL: `https://marginpad.io/api/bot/v1/trades`
- Auth: API key in header `X-API-Key`

Full closed-trade history with paging - /positions is capped at 100, this pages through the whole retention window. Follow next_before for the next page.

## Query parameters

- `limit` string
- `before` string

## Response `200`

ok

- Trades
  - `trades` Trade[]
    - `id` string, nullable
    - `closed_ts` integer
    - `symbol` string
    - `side` 'long' | 'short'
    - `leverage` number
    - `margin_usd` number
    - `pnl_usd` number, nullable
    - `roe_pct` number, nullable
    - `liquidated` boolean
    - `via` string, nullable: Which path executed the close: bot, site, sweep, cron, sltp.
  - `count` integer
  - `next_before` integer, nullable: Cursor for the next page; null when there are no more.
  - `retention_days` integer

---

[API](https://skmtc.dev/marginpad/apis/marginpad-free-crypto-api.md) · [All operations](https://skmtc.dev/marginpad/apis/marginpad-free-crypto-api/llms.txt) · [OpenAPI document](https://skmtc.dev/marginpad/apis/marginpad-free-crypto-api/revisions/27d21fcd0bf0?raw)
