---
title: "Api V2 Signals Trades-History Get"
method: GET
path: "/api/v2/signals/trades-history"
tags: ["Trade Signals (v2)"]
---

# Api V2 Signals Trades-History Get

`GET /api/v2/signals/trades-history`

## Request

- Base URL: `https://api.zerogex.io` (the document declares no server; this is the origin it was published from)
- URL: `https://api.zerogex.io/api/v2/signals/trades-history`
- Auth: HTTP bearer

Closed-trade log with aggregate win/loss statistics.

**Params:** `limit` (1–5000, default 500).

**Returns:**
```json
{
  "portfolio_size": 1000000,
  "trades": [
    {
      "id": 421, "underlying": "SPY",
      "signal_timestamp": "...", "opened_at": "...", "closed_at": "...", "updated_at": "...",
      "status": "closed", "direction": "bullish",
      "score_at_entry": 72.1, "score_latest": 64.8,
      "option_symbol": "SPY 250425C00680000", "option_type": "call",
      "expiration": "2025-04-25", "strike": 680.0,
      "entry_price": 1.22, "current_price": 1.55,
      "quantity_initial": 10, "quantity_open": 0,
      "realized_pnl": 330.0, "unrealized_pnl": 0.0, "total_pnl": 330.0,
      "pnl_percent": 27.05,
      "pricing_mode": "debit",
      "outcome": "win"
    }
  ],
  "summary": {
    "total_trades": 120, "wins": 72, "losses": 44,
    "win_rate": 0.6, "total_pnl": 12450.32
  }
}
```

- `portfolio_size` — from `SIGNALS_PORTFOLIO_SIZE` env var.
- `outcome` — `"win"` (pnl > 0), `"loss"` (pnl < 0), or `"flat"`.
- `pricing_mode` — `"debit"` (held long: entry = premium paid, exit = sale
  proceeds) or `"credit"` (held short: entry = premium received, exit =
  buyback cost). Drives PnL sign and frontend labelling.
- `win_rate` — 4-decimal fraction; `null` when no trades exist.
- `score_at_entry` / `score_latest` — MSI composite values (0–100).

**Page design.** Stats header strip (win rate, total P&L, counts);
sortable/filterable trades table; equity-curve sparkline from cumulative `total_pnl`.

## Query parameters

- `limit` integer

## Response `200`

Successful Response

- EnvelopeAny
  - `data` unknown, required
  - `freshness` Freshness, required: The v2 freshness envelope. Present on every ``/api/v2/*`` response.
    - `evaluated_at` string, date-time, required: When the API evaluated this response (server wall clock, UTC). Endpoint-health signal: advances on every request even when the underlying data is unchanged.
    - `generated_at` string, date-time, required: When the served data was computed. Equals the snapshot stamp for cycle-backed endpoints, or evaluated_at for endpoints computed on demand for this request.
    - `source_timestamp` string, date-time, nullable: Timestamp of the upstream market observation the payload derives from. This is what freshness_status is measured against. Null when the endpoint has no upstream feed or returned no rows.
    - `latest_event_at` string, date-time, nullable: Newest event timestamp present in the payload (last bar, last trade, last scored row). Best-effort on very large responses, which are sampled rather than fully walked.
    - `age_seconds` number, nullable: evaluated_at - source_timestamp, in seconds. Null when source_timestamp is null.
    - `market_session_status` string, required: pre-market | regular | after-hours | closed (US/Eastern).
    - `expected_update_cadence` string, nullable: ISO-8601 duration for how often this endpoint's data is expected to change right now, e.g. PT60S. Null means no updates are expected (weekend, holiday, or a feed that only runs during the session).
    - `expected_update_cadence_seconds` number, nullable: expected_update_cadence as a number of seconds.
    - `cadence_profile` string, required: Identifier of the cadence class this endpoint belongs to, e.g. analytics_cycle. Stable across releases; the seconds behind it may be retuned.
    - `stale_after` string, date-time, nullable: Instant after which this payload should be treated as stale. Null whenever expected_update_cadence is null.
    - `freshness_status` 'fresh' | 'aging' | 'stale' | 'session_closed' | 'static' | 'unknown', required: The rolled-up freshness verdict for one response. ``fresh`` ``source_timestamp`` is within one expected update cadence. ``aging`` Past one cadence but not yet past ``stale_after`` — the grace band that absorbs normal cycle jitter. Not an error; a client that polls faster than the cadence sees this routinely. ``stale`` Past ``stale_after`` while updates *were* expected. This is the actionable state: the feed behind this endpoint is late. ``session_closed`` A feed-backed endpoint whose feed is not due to produce anything right now (weekend, holiday, or a feed that only runs during the session). The payload is the last good value — deliberately NOT reported as ``stale``, because an overnight consumer polling a closed market is not observing a fault and should not page on it. ``static`` The endpoint is not feed-backed at all: completed history, or a result computed from the caller's own inputs. Age here carries no health meaning and never becomes a fault. ``unknown`` No source timestamp could be resolved from the payload (e.g. a pure calculator, an admin endpoint, or an empty result set). A consumer should fall back to ``evaluated_at`` for endpoint health and make no claim about data age.

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/zerogex/apis/zerogex-api.md) · [All operations](https://skmtc.dev/zerogex/apis/zerogex-api/llms.txt) · [OpenAPI document](https://skmtc.dev/zerogex/apis/zerogex-api/revisions/753b26bf0592?raw)
