Trades Endpoints

abstract

List, view, update, and LLM-analyze individual trades for a given account — the primary data source for the Trades page and post-trade review workflow.

🔒 Authentication

PropertyValue
MechanismNone
RequiredNo

Endpoints in this group

MethodPathDescription
GET/api/v1/tradesList trades with filters
GET/api/v1/trades/{trade_id}Get single trade detail
PATCH/api/v1/trades/{trade_id}Update trade fields
POST/api/v1/trades/{trade_id}/analyzeTrigger LLM post-trade analysis

GET /api/v1/trades

List trades for the active account with optional date range, symbol, and status filters.

Request

ParameterLocationTypeRequiredDescription
account_idQueryintegerYesFilter by account
symbolQuerystringNoFilter by symbol (e.g., EURUSD)
from_dateQuerystringNoISO date start (e.g., 2026-05-01)
to_dateQuerystringNoISO date end
is_openQuerybooleanNotrue = open trades only
include_paperQuerybooleanNoInclude paper trades (default: false)
limitQueryintegerNoMax results (default: 100)
offsetQueryintegerNoPagination offset

Logic Flow

📤 Responses

200 OK example:

[
  {
    "id": 1001,
    "account_id": 42,
    "ticket": 55551234,
    "symbol": "EURUSD",
    "direction": "BUY",
    "volume": 0.1,
    "entry_price": 1.08520,
    "stop_loss": 1.08220,
    "take_profit": 1.09120,
    "close_price": 1.08980,
    "profit": 46.00,
    "opened_at": "2026-05-16T10:30:00Z",
    "closed_at": "2026-05-16T14:15:00Z",
    "source": "HarmonicStrategy",
    "order_status": "filled",
    "order_type": "market",
    "is_paper_trade": false,
    "strategy_id": 3,
    "trade_analysis": null
  }
]

Pydantic Schema: backend/api/routes/trades.py :: TradeResponse


GET /api/v1/trades/

Fetch a single trade by ID including its post-trade analysis if available.


PATCH /api/v1/trades/

Update editable trade fields (e.g., maintenance_enabled, exclude_from_research).

Request body example:

{
  "maintenance_enabled": false,
  "exclude_from_research": true
}

POST /api/v1/trades//analyze

Trigger an LLM post-trade analysis for a closed trade. Stores result in trade_analysis JSON column.

Logic: Fetches trade + journal + indicators → sends to LLM → updates trades.trade_analysis with JSON result.

Response: { "analysis": { "verdict": "...", "lessons": [...], "rating": 7 } }


RolePath
Routerbackend/api/routes/trades.py
DB TableDB - trades
RoleLink
Frontend PagePage - Trades
DB SchemaDB - trades
DB SchemaDB - ai_journal