Skip to content

Commit cbaa9e5

Browse files
committed
openapi: add equityCurve + pnlTotalPercent to backtest results
Expose the equity curve (one point per yield, anchored at backtest from with initialCapital) and the total PnL as a percentage of initial capital. Both already produced by the backend; this just pins the wire format and ships the schema. Bumps API to 0.94.0.
1 parent bdfe104 commit cbaa9e5

1 file changed

Lines changed: 51 additions & 2 deletions

File tree

openapi.yaml

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ openapi: 3.1.0
22
info:
33
title: QTSurfer API
44
summary: QTSurfer backend services API
5-
version: 0.93.0
5+
version: 0.94.0
66
contact:
77
name: QTSurfer Support
88
email: support@qtsurfer.com
@@ -752,13 +752,21 @@ paths:
752752
strategyId: "strategy:00000000-0000-0000-0000-000000000000:ticker:2iyvtenlzh9dabqtxn7nbv"
753753
instrument: "BTC/USDT"
754754
pnlTotal: 42.75
755+
pnlTotalPercent: 2.25
755756
totalTrades: 156
756757
winRate: 58.33
757758
sharpeRatio: 1.245
758759
sortinoRatio: 1.872
759760
cagr: 0.1534
760761
maxDrawdown: 12.50
761762
maxDrawdownPercent: 8.75
763+
equityCurve:
764+
- timestamp: 1700000000000
765+
equity: 100.0
766+
- timestamp: 1700000060000
767+
equity: 110.5
768+
- timestamp: 1700000120000
769+
equity: 90.25
762770
signalCount: 100000
763771
signalsId: "00000000-0000-0000-0000-000000000000/exec/binance/3vsndwikcuaatjmb83fjtl"
764772
signalsUrl: "https://storage.qtsurfer.com/00000000-0000-0000-0000-000000000000/exec/binance/3vsndwikcuaatjmb83fjtl.parquet"
@@ -945,7 +953,8 @@ components:
945953
type: object
946954
description: >-
947955
Execution result map. Always includes core fields (hostName, iops, strategyId, instrument).
948-
Yield metrics (pnlTotal, totalTrades, winRate, etc.) are present when the strategy emitted at least one trade.
956+
Yield metrics (pnlTotal, pnlTotalPercent, totalTrades, winRate, equityCurve, etc.) are present
957+
when the strategy emitted at least one trade.
949958
When signal storage is enabled, includes signal fields described below.
950959
required:
951960
- strategyId
@@ -973,6 +982,11 @@ components:
973982
format: double
974983
description: Total profit and loss in the output currency
975984
example: 42.75
985+
pnlTotalPercent:
986+
type: number
987+
format: double
988+
description: Total PnL as a percentage of the initial capital (`backtestFunding`). Zero when `backtestFunding` is 0.
989+
example: 42.75
976990
totalTrades:
977991
type: integer
978992
format: int64
@@ -1008,6 +1022,22 @@ components:
10081022
format: double
10091023
description: Maximum percentage drawdown from peak equity
10101024
example: 8.75
1025+
equityCurve:
1026+
type: array
1027+
description: >-
1028+
Equity curve over the backtest. Element 0 is an anchor at the backtest `from`
1029+
with `initialCapital`; the remaining points are one sample per emitted yield,
1030+
in order. Use it to plot the strategy's running equity without re-deriving
1031+
it from the yield history.
1032+
items:
1033+
$ref: '#/components/schemas/EquityPoint'
1034+
example:
1035+
- timestamp: 1700000000000
1036+
equity: 100.0
1037+
- timestamp: 1700000060000
1038+
equity: 110.5
1039+
- timestamp: 1700000120000
1040+
equity: 90.25
10111041
signalCount:
10121042
type: integer
10131043
description: Number of signals emitted during strategy execution
@@ -1037,6 +1067,25 @@ components:
10371067
type: string
10381068
description: Human-readable reason when signalsUpload is Failed or Skipped.
10391069
example: "signal file generation failed"
1070+
EquityPoint:
1071+
type: object
1072+
description: Single sample of the running equity at a yield event.
1073+
required:
1074+
- timestamp
1075+
- equity
1076+
properties:
1077+
timestamp:
1078+
type: integer
1079+
format: int64
1080+
description: >-
1081+
Epoch milliseconds. The first point in an equity curve is anchored at the
1082+
backtest `from`; subsequent points carry the timestamp of each emitted yield.
1083+
example: 1700000000000
1084+
equity:
1085+
type: number
1086+
format: double
1087+
description: Running equity at this point (`initialCapital + cumulativePnl`).
1088+
example: 110.5
10401089
strategyId:
10411090
description: Unique identifier for a compiled strategy
10421091
type: string

0 commit comments

Comments
 (0)