> For the complete documentation index, see [llms.txt](https://ats-doc.gitbook.io/v1/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ats-doc.gitbook.io/v1/basics/trading-report.md).

# Trading Report

The **ATS Trading Report** provides comprehensive insights into trading session performance. You can view this detailed report directly in the terminal logs or through [Realtime Logs](/v1/apis/quickstart-6.md) streaming API, offering metrics across trading activity, PnL (Profit and Loss), and symbol performance.

## Sample Report

```
====================================================================================================
|||||||||||||||||||||||||||||||| Trade Report from Metric Evaluator ||||||||||||||||||||||||||||||||
====================================================================================================

1) Basic Info

        > # of open buy-sell pairs: 24
        > # of open one-sided orders: 0
        > # of open liquidation orders: 0
        > # of completed orders: 518
        > # of rejected orders: 0
                > buy-sell count: 518 (100.0000 %)
                > one-sided count: 0 (0.0000 %)
                        > buy only count: 0 (0.0000 %)
                        > sell only count: 0 (0.0000 %)
                > Liquidation order count: 0 (buy: 0, sell: 0)
        > Start time: 2022-05-12 00:00:00+00:00
        > End time: 2022-05-16 06:26:18+00:00
        > Trading time: 6146.30 minutes (102.44 hours = 4.27 days)
        > Trades (Buy-Sell Pair) Execution Times:
                > Trading rate:  2.5 trades per hour = 60 trades per day
                > Longest trade time:  95.30 minutes =  1.59 hours
                > Shortest trade time:  0.15 minutes
                > Average trade time:  13.28 minutes
                > STD of trade time:  14.57 minutes
                > Trade time percentiles: {'min': 0.15, 'p1': 0.52, 'p5': 1.05, 'p25': 3.32, 'p50': 8.05, 'p75': 17.62, 'p95': 44.95, 'p99': 64.07, 'max': 95.3} minutes
        > Buy Execution Times (Limit Orders Only):
                > Longest buy time:  2278.75 minutes =  1.59 hours
                > Shortest buy time:  0.25 minutes
                > Average buy time:  118.04 minutes
                > STD of buy time:  303.64 minutes
                > Buy time percentiles: {'min': 0.25, 'p1': 0.6, 'p5': 1.59, 'p25': 5.72, 'p50': 19.75, 'p75': 80.53, 'p95': 721.81, 'p99': 1642.58, 'max': 2278.75} minutes
        > Sell Execution Times (Limit Orders Only):
                > Longest sell time:  3237.90 minutes =  1.59 hours
                > Shortest sell time:  0.15 minutes
                > Average sell time:  212.40 minutes
                > STD of sell time:  515.74 minutes
                > Sell time percentiles: {'min': 0.15, 'p1': 0.85, 'p5': 1.34, 'p25': 8.22, 'p50': 26.15, 'p75': 108.08, 'p95': 951.25, 'p99': 3187.6, 'max': 3237.9} minutes

2) PnL stats (From Completed buy-sell trades)

        > Average PnL USDT: USDT 0.84210
        > Average PnL %: 0.907
        > STD of PnL USDT: USDT 0.13236
        > STD of PnL %: 0.124
        > PnL percentiles USDT: {'min': 0.66, 'p1': 0.67, 'p5': 0.69, 'p25': 0.74, 'p50': 0.81, 'p75': 0.91, 'p95': 1.06, 'p99': 1.27, 'max': 1.44}
        > PnL percentiles %: {'min': 0.01, 'p1': 0.01, 'p5': 0.01, 'p25': 0.01, 'p50': 0.01, 'p75': 0.01, 'p95': 0.01, 'p99': 0.01, 'max': 0.02}
        > Sharpe ratio: 6.61227
        > # of profitable trades: 259
        > # of losing trades: 0
        > # of neutral trades: 0
        > Profitable trade %: 100.0
        > Losing trade %: 0.0
        > Total gain: USDT 218.10409
        > Total loss: USDT 0.00000
        > Net profit: USDT 218.10409
        > Net profit %:  2.18104 %

3) Symbol Gains (From all trades - Including open order quantities)

        > Starting Price: USDT 29130.48
        > Last Price: USDT 29540.0
        > Price Difference: USDT 409.52000 (1.40581 %)
        > BTC initial value: 0.344 (free: 0.34400, holding: 0.00000)
        > BTC last value: 0.32782097440421304 (free: 0.29980, holding: 0.02802)
        > BTC initial quote value: USDT 10020.88512
        > BTC ending quote value: USDT 9683.83158
        > BTC gain: -0.01618 = USDT -337.05354 (-3.36351 %) --> Considering Price Fluctuation
        > BTC gain: -0.01618 = USDT -477.92842 (-4.76932 %) --> Omitting Price Fluctuation

        > USDT initial value: 10000 (free: 10000.00000, holding: 0.00000)
        > USDT last value: 10635.515025408793 (free: 9363.60862, holding: 1271.90641)
        > USDT gain: USDT 635.51503 (6.35515 %)

        > Initial equity value: USDT 20020.88512
        > Ending equity value: USDT 20319.34661
        > No Trade Ending equity value (expected): USDT 20161.76000
        > Equity gain: USDT 298.46149 (1.49075 %) 
        > No Trade Equity gain (expected): USDT 140.87488 (0.70364 %) 
        > Trading Advantage: USDT 157.58661 (0.78711 %) 

```

## Basic Trading Info

This section summarizes the trading activity during the session, providing details on open, completed, and rejected orders, as well as execution times for trades.

#### Order Metrics

* **# of open buy-sell pairs**: Number of open buy-sell order pairs.
* **# of open one-sided orders**: Number of open buy-only or sell-only orders.
* **# of open liquidation orders**: Number of open liquidation (asset swapping) orders.
* **# of completed orders**: Total number of completed orders.
* **# of rejected orders**: Total number of rejected orders.
  * **Buy-sell count**: Number of completed buy and sell orders in order-pair trades.
  * **One-sided count**: Number of completed one-sided orders.
    * **Buy only count**: Number of completed buy-only orders.
    * **Sell only count**: Number of completed sell-only orders.
  * **Liquidation order count**: Number of completed liquidation orders.

#### Session Timing

* **Start time**: Start time of the trading session.
* **End time**: End time of the trading session.
* **Trading time**: Duration of the trading session.

#### Trade Execution Times (Buy-Sell Pairs)

* **Trading rate**: Trade rate (e.g., trades per hour or trades per day).
* **Longest trade time**: Longest buy-sell pair completion time.
* **Shortest trade time**: Shortest buy-sell pair completion time.
* **Average trade time**: Average buy-sell pair completion time.
* **STD of trade time**: Standard deviation of buy-sell pair completion times.
* **Trade time percentiles**: Percentile distribution of buy-sell pair completion times.

#### Buy Execution Times (Limit Orders Only)

* **Longest buy time**: Longest buy order completion time.
* **Shortest buy time**: Shortest buy order completion time.
* **Average buy time**: Average buy order completion time.
* **STD of buy time**: Standard deviation of buy order completion times.
* **Buy time percentiles**: Percentile distribution of buy order completion times.

#### Sell Execution Times (Limit Orders Only)

* **Longest sell time**: Longest sell order completion time.
* **Shortest sell time**: Shortest sell order completion time.
* **Average sell time**: Average sell order completion time.
* **STD of sell time**: Standard deviation of sell order completion times.
* **Sell time percentiles**: Percentile distribution of sell order completion times.

## PnL Stats (From Completed Buy-Sell Trades)

This section provides details on profit and loss metrics derived from completed buy-sell trades.

#### Key PnL Metrics

* **Average PnL USDT**: Average profit or loss value in USDT.
* **Average PnL %**: Average profit or loss percentage.
* **STD of PnL USDT**: Standard deviation of PnL values in USDT.
* **STD of PnL %**: Standard deviation of PnL percentages.
* **PnL percentiles USDT**: Percentile distribution of PnL values in USDT.
* **PnL percentiles %**: Percentile distribution of PnL percentages.
* **Sharpe ratio**: [Sharpe ratio](https://en.wikipedia.org/wiki/Sharpe_ratio) of the trading session.

#### Trade Profitability

* **# of profitable trades**: Count of trades with PnL > 0.
* **# of losing trades**: Count of trades with PnL < 0.
* **# of neutral trades**: Count of trades with PnL = 0.
* **Profitable trade %**: Percentage of trades with positive PnL.
* **Losing trade %**: Percentage of trades with negative PnL.

#### Overall Profitability

* **Total gain**: Total profit from trades.
* **Total loss**: Total loss from trades.
* **Net profit**: Net profit calculated as `Total gain - Total loss`.
* **Net profit %**: Net profit percentage.

## Symbol Gains (From All Trades, Including Open Orders)

This section tracks the performance of the traded symbols, including starting and ending prices, gains, and equity changes.

#### Price Metrics

* **Starting Price**: Asset price at the start of the trading session.
* **Last Price**: Asset price at the end of the trading session.
* **Price Difference**: Difference between the starting and ending prices.

#### BTC (Base Asset) Metrics

* **BTC initial value**: Initial BTC amount at the start of the session.
* **BTC last value**: Closing BTC amount at the end of the session.
* **BTC initial quote value**: Value of the initial BTC amount in the quote asset.
* **BTC ending quote value**: Value of the closing BTC amount in the quote asset.
* **BTC gain**: Change in BTC quantity during the session.

#### USDT (Quote Asset) Metrics

* **USDT initial value**: Initial USDT amount at the start of the session.
* **USDT last value**: Closing USDT amount at the end of the session.
* **USDT gain**: Change in USDT quantity during the session.

#### Equity Metrics

* **Initial equity value**: Combined value of base and quote assets at the start of the session.
* **Ending equity value**: Combined value of base and quote assets at the end of the session.
* **No Trade Ending equity value (expected)**: Expected equity value if no trades were executed.
* **Equity gain**: Change in equity value during the session.
* **No Trade Equity gain (expected)**: Expected equity change if no trades were executed.
* **Trading Advantage**: Equity advantage gained by trading, calculated as the difference between actual and no-trade equity gain.

This document provides developers with a clear understanding of the metrics tracked by ATS during trading sessions, enabling informed decision-making and strategy refinement.
