Document serverStatistics and the closed trades endpoints - #2630
Merged
AlexCatarino merged 1 commit intoAug 19, 2026
Merged
Conversation
Add the serverStatistics block that LEAN now reports for backtests and live deployments to the OpenAPI spec, together with the undocumented /backtests/trades/read and /live/trades/read endpoints, ordered after Orders. Replace the stale Trade schema with ClosedTrade, which matches what AlgorithmPerformance.closedTrades returns, and give the trades endpoints a ClosedTradeWithOrders schema for the orders they also return. Render the models of a response or request that accepts one of several schemas, which the generator used to skip, and stop it from closing an array example twice when the example is a list. Add a Server Statistics section to the Writing Algorithms statistics documentation and link it from the runtime statistics table. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
LEAN #9720 reports
serverStatisticsfor backtests and live deployments, and the cloud API returns it, but nothing documented it. This adds it, together with two undocumented endpoints found while verifying the payloads.serverStatistics— newServerStatisticsschema and an optional property onBacktestResultandLiveAlgorithmResults. It is optional because results produced before LEAN reported it don't carry it, and the live one is absent once the deployment stops./backtests/trades/readand/live/trades/read— neither was in the spec. Both are documented asTradessections placed afterOrders, which renumbers the Insights and Logs folders (page URLs use the slug, so no link changes).Trade->ClosedTrade— the oldTradeschema claimed a singularsymboland noid,isWinororderIds. The realAlgorithmPerformance.closedTradespayload has all of them, so the schema is replaced. The trades endpoints also return the orders that opened and closed each trade, so they useClosedTradeWithOrders.oneOfproduced a header and nothing else, which is why the live orders page has been empty; it now renders every variant. An array example that is already a list also closed its brackets twice, which made the Object Store request example invalid JSON.Test plan
vacuum lint QuantConnect-Platform-2.0.0.yaml --fail-severity errorpasses with no errors.python code-generators/API-Reference-Code-Generator.pyis idempotent: a second run leaves no changes./backtests/readand/live/readforserverStatistics,/backtests/trades/readand/live/trades/readfor the trade objects, andAlgorithmPerformance.closedTradesfor the schema replacement."timeInForce":that the committed backtest orders page already shows.Notes
14 Agent Management/03 Deployments/07 Read Conversation/02 Request.html. That page was stale against the spec, and running the generator picks it up./live/orders/readneed the platform team rather than a docs change:algorithmIdis accepted but ignored, sodeployIdis the parameter that scopes the read, and an unscoped trades read returns a single trade while reporting the full count.