Add delete backtests by filters
This commit is contained in:
@@ -577,6 +577,66 @@ export class BacktestClient extends AuthorizedApiBase {
|
||||
return Promise.resolve<FileResponse>(null as any);
|
||||
}
|
||||
|
||||
backtest_DeleteBacktestsByFilters(scoreMin: number | null | undefined, scoreMax: number | null | undefined, winrateMin: number | null | undefined, winrateMax: number | null | undefined, maxDrawdownMax: number | null | undefined, tickers: string | null | undefined, indicators: string | null | undefined, durationMinDays: number | null | undefined, durationMaxDays: number | null | undefined, name: string | null | undefined): Promise<FileResponse> {
|
||||
let url_ = this.baseUrl + "/Backtest/ByFilters?";
|
||||
if (scoreMin !== undefined && scoreMin !== null)
|
||||
url_ += "scoreMin=" + encodeURIComponent("" + scoreMin) + "&";
|
||||
if (scoreMax !== undefined && scoreMax !== null)
|
||||
url_ += "scoreMax=" + encodeURIComponent("" + scoreMax) + "&";
|
||||
if (winrateMin !== undefined && winrateMin !== null)
|
||||
url_ += "winrateMin=" + encodeURIComponent("" + winrateMin) + "&";
|
||||
if (winrateMax !== undefined && winrateMax !== null)
|
||||
url_ += "winrateMax=" + encodeURIComponent("" + winrateMax) + "&";
|
||||
if (maxDrawdownMax !== undefined && maxDrawdownMax !== null)
|
||||
url_ += "maxDrawdownMax=" + encodeURIComponent("" + maxDrawdownMax) + "&";
|
||||
if (tickers !== undefined && tickers !== null)
|
||||
url_ += "tickers=" + encodeURIComponent("" + tickers) + "&";
|
||||
if (indicators !== undefined && indicators !== null)
|
||||
url_ += "indicators=" + encodeURIComponent("" + indicators) + "&";
|
||||
if (durationMinDays !== undefined && durationMinDays !== null)
|
||||
url_ += "durationMinDays=" + encodeURIComponent("" + durationMinDays) + "&";
|
||||
if (durationMaxDays !== undefined && durationMaxDays !== null)
|
||||
url_ += "durationMaxDays=" + encodeURIComponent("" + durationMaxDays) + "&";
|
||||
if (name !== undefined && name !== null)
|
||||
url_ += "name=" + encodeURIComponent("" + name) + "&";
|
||||
url_ = url_.replace(/[?&]$/, "");
|
||||
|
||||
let options_: RequestInit = {
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
"Accept": "application/octet-stream"
|
||||
}
|
||||
};
|
||||
|
||||
return this.transformOptions(options_).then(transformedOptions_ => {
|
||||
return this.http.fetch(url_, transformedOptions_);
|
||||
}).then((_response: Response) => {
|
||||
return this.processBacktest_DeleteBacktestsByFilters(_response);
|
||||
});
|
||||
}
|
||||
|
||||
protected processBacktest_DeleteBacktestsByFilters(response: Response): Promise<FileResponse> {
|
||||
const status = response.status;
|
||||
let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
|
||||
if (status === 200 || status === 206) {
|
||||
const contentDisposition = response.headers ? response.headers.get("content-disposition") : undefined;
|
||||
let fileNameMatch = contentDisposition ? /filename\*=(?:(\\?['"])(.*?)\1|(?:[^\s]+'.*?')?([^;\n]*))/g.exec(contentDisposition) : undefined;
|
||||
let fileName = fileNameMatch && fileNameMatch.length > 1 ? fileNameMatch[3] || fileNameMatch[2] : undefined;
|
||||
if (fileName) {
|
||||
fileName = decodeURIComponent(fileName);
|
||||
} else {
|
||||
fileNameMatch = contentDisposition ? /filename="?([^"]*?)"?(;|$)/g.exec(contentDisposition) : undefined;
|
||||
fileName = fileNameMatch && fileNameMatch.length > 1 ? fileNameMatch[1] : undefined;
|
||||
}
|
||||
return response.blob().then(blob => { return { fileName: fileName, data: blob, status: status, headers: _headers }; });
|
||||
} else if (status !== 200 && status !== 204) {
|
||||
return response.text().then((_responseText) => {
|
||||
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
||||
});
|
||||
}
|
||||
return Promise.resolve<FileResponse>(null as any);
|
||||
}
|
||||
|
||||
backtest_GetBacktestsByRequestId(requestId: string): Promise<Backtest[]> {
|
||||
let url_ = this.baseUrl + "/Backtest/ByRequestId/{requestId}";
|
||||
if (requestId === undefined || requestId === null)
|
||||
@@ -4310,6 +4370,7 @@ export enum BacktestSortableColumn {
|
||||
Fees = "Fees",
|
||||
SharpeRatio = "SharpeRatio",
|
||||
Ticker = "Ticker",
|
||||
Name = "Name",
|
||||
}
|
||||
|
||||
export interface LightBacktest {
|
||||
|
||||
Reference in New Issue
Block a user