> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trdrs.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Get trading analytics

> Returns the figures of your closed trades over a period: wins and losses, of trades and of trading days, profit factor, averages, expectancy, biggest trades, drawdown, Sharpe and Sortino ratios, streaks, the trader score, a chart series for each trading day, and every trading day's result for a calendar. They are worked out from every round trip the accounts hold, the same trades `GET /api/account/pnl/round-trips` lists, each counted on the trading day it closed. Name an account for its figures, or omit both `provider` and `account` for the figures of every open account you hold together. Read it again when the account stream sends an `analytics` event.

Required key: Trading API key. A venue's backend can also send it with its Venue key, which carries `trader:read` or `trader:trade`, naming one of its own traders in `x-trdrs-trader`: it then runs on that trader's own accounts.



## OpenAPI

````yaml /api/openapi.json get /api/account/analytics
openapi: 3.1.0
info:
  title: trdrs Engine API
  version: 1.1.0
  description: >-
    ## API Reference


    Every route the trdrs engine serves, with what to send and what comes back.
    It covers market

    data and news, trading and account state for a trader's own software,
    Connect and its

    pre-registration, the venue routes a prop firm or brokerage runs its
    accounts through, and a

    trader's own challenges.


    Start with the Quickstart for your first call. The API standards hold the
    rules every route

    shares: keys, errors, rate limits, idempotency, paging and streaming.
servers:
  - url: https://app.trdrs.co
    description: Production
  - url: /
    description: This engine
security: []
tags:
  - name: Venue platform preview
    description: >-
      Run your venue: its providers, instruments, conditions, groups, routes,
      stages, venue rules, keys, accounts, usage, balance receipts and webhooks.
      These routes are in preview. They are served on the sandbox to every
      venue, and production access is arranged when a venue qualifies. Every
      route here under `/api/venues/` takes a Venue key. The back office reaches
      the same routes under `/api/back-office/` with a verified owner’s session,
      because the Venue key stays on your server, and both run the same checks.
      The team’s routes under `/api/organizations` serve the back office, since
      one organization runs its venues with one team.
  - name: Market data
    description: >-
      Search and look up symbols, read price history and quotes, check the
      server clock, and stream live bars. Crypto prices come from each
      provider’s public feed. Futures prices are licensed to each user and
      stream only from that trader’s own futures source: a login on their
      venue’s production Rithmic system, under their own market data
      subscription. A Rithmic Test login carries no market data. Futures reach
      the trader’s own signed-in session, and a venue’s backend acting for its
      trader. A Trading API key reads crypto market data only. Without a source,
      a futures request answers 503 `feed_requires_connection` and the symbol
      search lists no futures.
  - name: News
    description: >-
      Market news and the economic calendar, from licensed and open sources,
      tagged with futures roots as they arrive. The content is the same for
      everyone, and these routes admit the same callers as market data: a
      licensed origin, a session or a Trading API key. Page headlines by publish
      time, filter them by instrument root, and stream them live over
      server-sent events. Thumbnails come through the image route.
  - name: Trading
    description: >-
      Place, change and cancel orders, protect a position with a bracket and
      change or withdraw it, and close or flatten positions. Every call that
      places an order takes a `clientOrderId` as its idempotency key.
  - name: Account
    description: >-
      Read an account a trader can trade: its balance, positions, working
      orders, fills, profit and loss history, and the live account stream. You
      don’t create accounts here. A venue issues accounts on the paper book with
      Issue an account into a group, and connects its traders' own accounts at a
      provider from its backend with its Venue key and `x-trdrs-trader`.
  - name: Connect
    description: >-
      Connect is the account picker a trader opens in the trading platform,
      where it lists the built-in providers the trader’s venue switched on in
      its back office’s Settings > Connect. A venue’s backend runs the same
      Connect for one of its own traders with its Venue key and
      `x-trdrs-trader`, as [Route your traders’
      orders](/guides/route-your-traders-orders) shows. The pre-registration
      routes, which take the pre-registration key, are deprecated and go in the
      next release.
  - name: Trading platform session
    description: >-
      The routes the trdrs trading platform calls for a trader signed in to it:
      the trader's own Hyperliquid wallet, their Demo on the paper book, the
      exchanges they connect, their sign-in sessions, and payout requests from
      their accounts. Each takes the trader's own session from trdrs's own
      origin, and an API key or a Venue key can't call them. A venue's own app
      does these things from its backend with its Venue key and
      `x-trdrs-trader`; [Build a trader app](/guides/build-a-trader-app) maps
      each one.
  - name: Challenges
    description: >-
      List evaluation programs, enroll in one, and read a trader’s own
      enrollments and their history. **Preview: outside the additive-only
      promise**, so these shapes can change; see Versioning and stability.
      **They take a signed-in session, not a key**, and exist only on an engine
      that runs with `CHALLENGES_ENABLED`. Anywhere else every one answers
      `404`.
paths:
  /api/account/analytics:
    get:
      tags:
        - Account
      summary: Get trading analytics
      description: >-
        Returns the figures of your closed trades over a period: wins and
        losses, of trades and of trading days, profit factor, averages,
        expectancy, biggest trades, drawdown, Sharpe and Sortino ratios,
        streaks, the trader score, a chart series for each trading day, and
        every trading day's result for a calendar. They are worked out from
        every round trip the accounts hold, the same trades `GET
        /api/account/pnl/round-trips` lists, each counted on the trading day it
        closed. Name an account for its figures, or omit both `provider` and
        `account` for the figures of every open account you hold together. Read
        it again when the account stream sends an `analytics` event.


        Required key: Trading API key. A venue's backend can also send it with
        its Venue key, which carries `trader:read` or `trader:trade`, naming one
        of its own traders in `x-trdrs-trader`: it then runs on that trader's
        own accounts.
      parameters:
        - name: provider
          in: query
          schema:
            type: string
          description: >-
            The provider the account is at, such as `rithmic` or `paper`. With
            `account` omitted, your default account there. Omit both for every
            open account you hold.
        - name: account
          in: query
          schema:
            type: string
          description: >-
            The account number at that provider. It must be one of your own
            accounts, or the call is refused with 400.
        - name: period
          in: query
          schema:
            type: string
            enum:
              - 7d
              - 30d
              - 90d
              - ytd
              - all
            default: all
          description: >-
            The last 7, 30 or 90 days counting today, the year so far, or every
            day. Send it or a range, never both.
        - name: from
          in: query
          schema:
            type: string
            pattern: ^\d{4}-\d{2}-\d{2}$
          description: >-
            Instead of a period, the range's first trading day, exactly as
            YYYY-MM-DD. Omit it to start from the first trade.
        - name: to
          in: query
          schema:
            type: string
            pattern: ^\d{4}-\d{2}-\d{2}$
          description: >-
            Instead of a period, the range's last trading day, exactly as
            YYYY-MM-DD. Omit it to end today.
        - name: tz
          in: query
          schema:
            type: string
            default: UTC
          description: >-
            The IANA time zone whose calendar day is today, such as
            `America/New_York`. A period ends today in it.
        - name: fees
          in: query
          schema:
            type: string
            enum:
              - include
              - exclude
            default: include
          description: >-
            `include` takes each trade's commission and fees off its result;
            `exclude` reads each trade before them.
      responses:
        '200':
          description: The figures over the period.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccountAnalyticsResponse'
        '400':
          description: >-
            The period, a date, the time zone or `fees` is invalid, a period
            comes with a range, the provider or account is unknown, or no
            provider is connected.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: The key is missing, unknown or revoked.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - tradingApiKey: []
        - venueKey: []
          trader: []
      x-codeSamples:
        - lang: javascript
          label: TypeScript
          source: >-
            const res = await
            fetch('https://app.trdrs.co/api/account/analytics', {
              headers: { Authorization: `Bearer ${process.env.TRDRS_API_KEY}` },
            })

            const data = await res.json()
        - lang: shell
          label: cURL
          source: |-
            curl 'https://app.trdrs.co/api/account/analytics' \
              -H "Authorization: Bearer $TRDRS_API_KEY"
components:
  schemas:
    AccountAnalyticsResponse:
      type: object
      description: >-
        The figures of your closed trades over a period, worked out from every
        round trip the accounts hold. Each trade's result is its realized profit
        and loss, less its commission and fees where `feesIncluded`. Money is in
        the account's currency, signed. A figure the trades cannot support is
        null. The drawdown and the streaks read the trades in the order they
        closed.
      properties:
        accounts:
          type: array
          description: The accounts the figures cover.
          items:
            type: object
            properties:
              provider:
                type: string
                description: The provider the account is at.
              accountNumber:
                type: string
                description: The account number.
            required:
              - provider
              - accountNumber
        from:
          type:
            - string
            - 'null'
          description: >-
            The first trading day the period covers, as YYYY-MM-DD, or null for
            every day from the first trade.
        to:
          type: string
          description: The last trading day the period covers, as YYYY-MM-DD.
        firstDay:
          type:
            - string
            - 'null'
          description: >-
            The trading day of the first trade the accounts closed, or null when
            they have none.
        feesIncluded:
          type: boolean
          description: Whether each trade's commission and fees come off its result.
        syncing:
          type: boolean
          description: >-
            True while any of the accounts' fill or order history is still being
            copied from its provider, so older trades may still arrive.
        trades:
          $ref: '#/components/schemas/AnalyticsOutcomes'
          description: The period's trades.
        days:
          $ref: '#/components/schemas/AnalyticsOutcomes'
          description: >-
            The period's trading days, each the sum of the trades that closed on
            it.
        grossProfit:
          type: number
          description: What the winning trades made.
        grossLoss:
          type: number
          description: What the losing trades lost, as a positive amount.
        net:
          type: number
          description: The sum of every trade's result.
        profitFactor:
          type:
            - number
            - 'null'
          description: Gross profit over gross loss, or null with no losing trade.
        averageTrade:
          type:
            - number
            - 'null'
          description: The average trade, which is the expectancy of one.
        averageWin:
          type:
            - number
            - 'null'
          description: The average winning trade.
        averageLoss:
          type:
            - number
            - 'null'
          description: The average losing trade, negative.
        winLossRatio:
          type:
            - number
            - 'null'
          description: The average win over the size of the average loss.
        averagePerDay:
          type:
            - number
            - 'null'
          description: The net result over the trading days.
        biggestWinner:
          type:
            - number
            - 'null'
          description: The best trade.
        biggestLoser:
          type:
            - number
            - 'null'
          description: The worst trade.
        maxDrawdown:
          type: number
          description: >-
            The deepest fall of the running result from its high, trade by
            trade, as a positive amount.
        recoveryFactor:
          type:
            - number
            - 'null'
          description: The net result over the deepest drawdown, or null with no drawdown.
        sharpe:
          type:
            - number
            - 'null'
          description: >-
            The daily results' mean over their sample deviation, for a year of
            252 trading days, or null under two days.
        sortino:
          type:
            - number
            - 'null'
          description: >-
            As `sharpe`, over the deviation of the losing days, or null with no
            losing day.
        longestWinStreak:
          type: integer
          description: The most winning trades in a row.
        longestLossStreak:
          type: integer
          description: The most losing trades in a row.
        currentStreak:
          type:
            - object
            - 'null'
          description: >-
            The run the latest trades are on, or null when the latest trade
            broke even or there is none. A breakeven trade ends a run.
          properties:
            kind:
              type: string
              enum:
                - win
                - loss
              description: Whether the run won or lost.
            count:
              type: integer
              description: How many trades it holds.
          required:
            - kind
            - count
        score:
          type:
            - object
            - 'null'
          description: >-
            The trader score: five measures from 0 to 100, and their mean, or
            null with no trade. The win rates count wins among wins and losses;
            the profit factor and the win/loss ratio earn 100 at 3 or above, and
            also with wins and no loss; drawdown control is the share of the
            gross profit the deepest drawdown left standing.
          properties:
            measures:
              type: object
              description: Each measure, from 0 to 100.
              properties:
                winRate:
                  type: number
                  description: The share of decided trades that won.
                profitFactor:
                  type: number
                  description: The profit factor, as a share of 3.
                winLossRatio:
                  type: number
                  description: The win/loss ratio, as a share of 3.
                dayWinRate:
                  type: number
                  description: The share of decided trading days that won.
                drawdownControl:
                  type: number
                  description: >-
                    The share of the gross profit the deepest drawdown left
                    standing.
              required:
                - winRate
                - profitFactor
                - winLossRatio
                - dayWinRate
                - drawdownControl
            score:
              type: number
              description: The mean of the five measures.
          required:
            - measures
            - score
        series:
          type: object
          description: The period's charts, one point a trading day, oldest first.
          properties:
            equity:
              type: array
              items:
                $ref: '#/components/schemas/AnalyticsDay'
              description: The running result from zero.
            daily:
              type: array
              items:
                $ref: '#/components/schemas/AnalyticsDay'
              description: Each day's result.
            drawdown:
              type: array
              items:
                $ref: '#/components/schemas/AnalyticsDay'
              description: >-
                How far the running result stood under its high, zero or
                negative.
            trades:
              type: array
              items:
                $ref: '#/components/schemas/AnalyticsDay'
              description: How many trades closed.
          required:
            - equity
            - daily
            - drawdown
            - trades
        calendar:
          type: array
          items:
            $ref: '#/components/schemas/AnalyticsDay'
          description: >-
            Every trading day of the accounts' whole history with a closed
            trade, oldest first, and its result, whatever the period.
      required:
        - accounts
        - from
        - to
        - firstDay
        - feesIncluded
        - syncing
        - trades
        - days
        - grossProfit
        - grossLoss
        - net
        - profitFactor
        - averageTrade
        - averageWin
        - averageLoss
        - winLossRatio
        - averagePerDay
        - biggestWinner
        - biggestLoser
        - maxDrawdown
        - recoveryFactor
        - sharpe
        - sortino
        - longestWinStreak
        - longestLossStreak
        - currentStreak
        - score
        - series
        - calendar
      example:
        accounts:
          - provider: rithmic
            accountNumber: PA-4821-07
        from: '2026-07-26'
        to: '2026-08-24'
        firstDay: '2026-08-21'
        feesIncluded: true
        syncing: false
        trades:
          wins: 2
          breakeven: 1
          losses: 2
          total: 5
        days:
          wins: 2
          breakeven: 0
          losses: 0
          total: 2
        grossProfit: 1740
        grossLoss: 372.5
        net: 1367.5
        profitFactor: 4.671140939597316
        averageTrade: 273.5
        averageWin: 870
        averageLoss: -186.25
        winLossRatio: 4.671140939597316
        averagePerDay: 683.75
        biggestWinner: 1150
        biggestLoser: -212.5
        maxDrawdown: 212.5
        recoveryFactor: 6.435294117647059
        sharpe: 25.061468455902197
        sortino: null
        longestWinStreak: 1
        longestLossStreak: 1
        currentStreak: null
        score:
          measures:
            winRate: 50
            profitFactor: 100
            winLossRatio: 100
            dayWinRate: 100
            drawdownControl: 87.78735632183908
          score: 87.55747126436782
        series:
          equity:
            - day: '2026-08-21'
              value: 377.5
            - day: '2026-08-24'
              value: 1367.5
          daily:
            - day: '2026-08-21'
              value: 377.5
            - day: '2026-08-24'
              value: 990
          drawdown:
            - day: '2026-08-21'
              value: 0
            - day: '2026-08-24'
              value: 0
          trades:
            - day: '2026-08-21'
              value: 2
            - day: '2026-08-24'
              value: 3
        calendar:
          - day: '2026-08-21'
            value: 377.5
          - day: '2026-08-24'
            value: 990
    ErrorResponse:
      type: object
      description: >-
        The body of every error response. It always carries `error`, an English
        sentence you can show. A refused trading request also carries `code`,
        one of the refusal codes, and `params`, the details of that refusal.
        Translate by `code` and `params`, and show a generic message for a code
        you don't recognize. Other errors may carry a `code` of their own.
      properties:
        error:
          type: string
          description: What went wrong, as an English sentence.
        code:
          type: string
          description: >-
            A stable machine code. On a refused trading request, it is one of
            the refusal codes.
        params:
          type: object
          description: >-
            The details of the refusal named by `code`, on a refused trading
            request.
      required:
        - error
      example:
        error: invalid_instrument
    AnalyticsOutcomes:
      type: object
      description: >-
        How many results won (above zero), broke even (exactly zero) and lost
        (below zero).
      properties:
        wins:
          type: integer
          description: The results above zero.
        breakeven:
          type: integer
          description: The results of exactly zero.
        losses:
          type: integer
          description: The results below zero.
        total:
          type: integer
          description: Every result.
      required:
        - wins
        - breakeven
        - losses
        - total
    AnalyticsDay:
      type: object
      description: One point of a day series.
      properties:
        day:
          type: string
          pattern: ^\d{4}-\d{2}-\d{2}$
          description: The trading day, as YYYY-MM-DD.
        value:
          type: number
          description: The value on that day.
      required:
        - day
        - value
  securitySchemes:
    tradingApiKey:
      type: http
      scheme: bearer
      description: >-
        The Trading API key (`trdrs_sk_…`), for market data, orders and account
        state on the accounts its owner holds. Use it server-to-server, and keep
        it on your server. Its scope is named `trading` in the API.
    venueKey:
      type: http
      scheme: bearer
      description: >-
        The Venue key (`trdrs_vk_sandbox_…` or `trdrs_vk_production_…`), in
        preview. It belongs to one venue in one environment and carries the
        scopes it was created with. The venue's verified owner creates it while
        signed in. It works on the `/api/venues/{venueId}` routes and, with
        `trader:read` or `trader:trade`, on the account, market, trading and
        Connect routes, reading the venue's own traders' accounts and Connect,
        routing their orders and connecting their own accounts, each request
        naming its trader in `x-trdrs-trader`. A `trdrs_sk_…` key can't be used
        in its place. It reaches its venue's routes and its venue's own traders,
        and the owner manages keys from a signed-in session. Keep it on your
        server.
    trader:
      type: apiKey
      in: header
      name: x-trdrs-trader
      description: >-
        Your own id for one of your traders: the id the accounts your venue
        issues them use. Send it with your Venue key carrying `trader:read`, or
        `trader:trade` to also route the trader's orders, and the request runs
        as that trader on their own accounts. An id that names none of your
        traders is refused with `404` `trader_not_found` and a suspended trader
        with `403` `trader_suspended`. A request that also carries a cookie or a
        browser `Origin` is refused with `400` `credential_not_allowed`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.