Repository navigation
feat(sdk): run candle strategies, a data type on backtest and sweep requests - #11
Merged
Merged
Conversation
…equests Every run the Java SDK started was prepared, executed and read as ticker data: the type was a constant in both workflows. A strategy that reads candles, run over a klines dataset, therefore always failed at preparation with 'This strategy reads kline data, but the run was submitted against ticker data'. The TypeScript and Python SDKs already take a data type. BacktestRequest and SweepRequest get a type (DataSourceType, ticker by default, kline for candles) that every stage uses: preparation, execution, polling, cancellation and the sweep reads. A run is addressed by its exchange, its type and its id, so the reads that take only an exchange and an id (getBacktestResult, getSweepRunEquityCurve, getBoundedSweepRunEquityCurve) get overloads with a type; the forms without one keep reading the ticker route. The record constructors that predate the type still work.
This branch was previously deployed
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.
What
The Java SDK could not run a strategy that reads candles. Both workflows fixed the data type to
ticker, so a kline strategy over a klines dataset always failed at preparation:The TypeScript and Python SDKs already take a data type, and the MCP server (which sits on this SDK) had no way to ask for a kline run for the same reason.
Change
BacktestRequestandSweepRequestgettype(DataSourceType;TICKERby default,KLINEfor candles). Builders:.type(DataSourceType.KLINE). Every stage uses it: preparation, execution, polling, cancellation, and the sweep result, sensitivity and curve reads.getBacktestResult(exchangeId, type, jobId),getSweepRunEquityCurve(exchangeId, type, ...)andgetBoundedSweepRunEquityCurve(exchangeId, type, ...), onQTSurferand onAuthenticatedClient. The forms without a type keep reading the ticker route.typestill work and build ticker runs. Anulltype meansTICKER.docs/backtesting.mdshows how to ask for a kline run; changelog entry under[Unreleased].Tests
DataSourceTypeRequestTest: the default, the given type, the older constructors and anulltype.readResultaddresses a run by its type; a kline sweep uses the kline route on every call (local HTTP server);getBacktestResultof a kline run hits/backtest/user/kline/execute/...through bothQTSurferand the sessionauthenticate(...)returns.mvn verifypasses with the new tests (2 skipped, as before).Checked live
The built classes against the live API (OpenAPI 0.128.47), on a ready klines dataset with a kline QTScript strategy:
Failedwith the platform's reason, now aQTSExecutionError;Completed) and not found on the ticker route (404);Not in this PR
No version bump or release. The MCP server takes the type in a following change, once this is released.