This commit is contained in:
2025-11-09 02:08:31 +07:00
parent 1ed58d1a98
commit 7dba29c66f
57 changed files with 8362 additions and 359 deletions

View File

@@ -1072,6 +1072,44 @@ export class BacktestClient extends AuthorizedApiBase {
return Promise.resolve<FileResponse>(null as any);
}
backtest_GetBundleStatus(bundleRequestId: string): Promise<BundleBacktestStatusResponse> {
let url_ = this.baseUrl + "/Backtest/Bundle/{bundleRequestId}/Status";
if (bundleRequestId === undefined || bundleRequestId === null)
throw new Error("The parameter 'bundleRequestId' must be defined.");
url_ = url_.replace("{bundleRequestId}", encodeURIComponent("" + bundleRequestId));
url_ = url_.replace(/[?&]$/, "");
let options_: RequestInit = {
method: "GET",
headers: {
"Accept": "application/json"
}
};
return this.transformOptions(options_).then(transformedOptions_ => {
return this.http.fetch(url_, transformedOptions_);
}).then((_response: Response) => {
return this.processBacktest_GetBundleStatus(_response);
});
}
protected processBacktest_GetBundleStatus(response: Response): Promise<BundleBacktestStatusResponse> {
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) {
return response.text().then((_responseText) => {
let result200: any = null;
result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as BundleBacktestStatusResponse;
return result200;
});
} else if (status !== 200 && status !== 204) {
return response.text().then((_responseText) => {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
});
}
return Promise.resolve<BundleBacktestStatusResponse>(null as any);
}
backtest_RunGenetic(request: RunGeneticRequest): Promise<GeneticRequest> {
let url_ = this.baseUrl + "/Backtest/Genetic";
url_ = url_.replace(/[?&]$/, "");
@@ -2354,6 +2392,152 @@ export class DataClient extends AuthorizedApiBase {
}
}
export class JobClient extends AuthorizedApiBase {
private http: { fetch(url: RequestInfo, init?: RequestInit): Promise<Response> };
private baseUrl: string;
protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined;
constructor(configuration: IConfig, baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise<Response> }) {
super(configuration);
this.http = http ? http : window as any;
this.baseUrl = baseUrl ?? "http://localhost:5000";
}
job_GetJobStatus(jobId: string): Promise<BacktestJobStatusResponse> {
let url_ = this.baseUrl + "/Job/{jobId}";
if (jobId === undefined || jobId === null)
throw new Error("The parameter 'jobId' must be defined.");
url_ = url_.replace("{jobId}", encodeURIComponent("" + jobId));
url_ = url_.replace(/[?&]$/, "");
let options_: RequestInit = {
method: "GET",
headers: {
"Accept": "application/json"
}
};
return this.transformOptions(options_).then(transformedOptions_ => {
return this.http.fetch(url_, transformedOptions_);
}).then((_response: Response) => {
return this.processJob_GetJobStatus(_response);
});
}
protected processJob_GetJobStatus(response: Response): Promise<BacktestJobStatusResponse> {
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) {
return response.text().then((_responseText) => {
let result200: any = null;
result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as BacktestJobStatusResponse;
return result200;
});
} else if (status !== 200 && status !== 204) {
return response.text().then((_responseText) => {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
});
}
return Promise.resolve<BacktestJobStatusResponse>(null as any);
}
job_GetJobs(page: number | undefined, pageSize: number | undefined, sortBy: string | undefined, sortOrder: string | undefined, status: string | null | undefined, jobType: string | null | undefined, userId: number | null | undefined, workerId: string | null | undefined, bundleRequestId: string | null | undefined): Promise<PaginatedJobsResponse> {
let url_ = this.baseUrl + "/Job?";
if (page === null)
throw new Error("The parameter 'page' cannot be null.");
else if (page !== undefined)
url_ += "page=" + encodeURIComponent("" + page) + "&";
if (pageSize === null)
throw new Error("The parameter 'pageSize' cannot be null.");
else if (pageSize !== undefined)
url_ += "pageSize=" + encodeURIComponent("" + pageSize) + "&";
if (sortBy === null)
throw new Error("The parameter 'sortBy' cannot be null.");
else if (sortBy !== undefined)
url_ += "sortBy=" + encodeURIComponent("" + sortBy) + "&";
if (sortOrder === null)
throw new Error("The parameter 'sortOrder' cannot be null.");
else if (sortOrder !== undefined)
url_ += "sortOrder=" + encodeURIComponent("" + sortOrder) + "&";
if (status !== undefined && status !== null)
url_ += "status=" + encodeURIComponent("" + status) + "&";
if (jobType !== undefined && jobType !== null)
url_ += "jobType=" + encodeURIComponent("" + jobType) + "&";
if (userId !== undefined && userId !== null)
url_ += "userId=" + encodeURIComponent("" + userId) + "&";
if (workerId !== undefined && workerId !== null)
url_ += "workerId=" + encodeURIComponent("" + workerId) + "&";
if (bundleRequestId !== undefined && bundleRequestId !== null)
url_ += "bundleRequestId=" + encodeURIComponent("" + bundleRequestId) + "&";
url_ = url_.replace(/[?&]$/, "");
let options_: RequestInit = {
method: "GET",
headers: {
"Accept": "application/json"
}
};
return this.transformOptions(options_).then(transformedOptions_ => {
return this.http.fetch(url_, transformedOptions_);
}).then((_response: Response) => {
return this.processJob_GetJobs(_response);
});
}
protected processJob_GetJobs(response: Response): Promise<PaginatedJobsResponse> {
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) {
return response.text().then((_responseText) => {
let result200: any = null;
result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as PaginatedJobsResponse;
return result200;
});
} else if (status !== 200 && status !== 204) {
return response.text().then((_responseText) => {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
});
}
return Promise.resolve<PaginatedJobsResponse>(null as any);
}
job_GetJobSummary(): Promise<JobSummaryResponse> {
let url_ = this.baseUrl + "/Job/summary";
url_ = url_.replace(/[?&]$/, "");
let options_: RequestInit = {
method: "GET",
headers: {
"Accept": "application/json"
}
};
return this.transformOptions(options_).then(transformedOptions_ => {
return this.http.fetch(url_, transformedOptions_);
}).then((_response: Response) => {
return this.processJob_GetJobSummary(_response);
});
}
protected processJob_GetJobSummary(response: Response): Promise<JobSummaryResponse> {
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) {
return response.text().then((_responseText) => {
let result200: any = null;
result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as JobSummaryResponse;
return result200;
});
} else if (status !== 200 && status !== 204) {
return response.text().then((_responseText) => {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
});
}
return Promise.resolve<JobSummaryResponse>(null as any);
}
}
export class MoneyManagementClient extends AuthorizedApiBase {
private http: { fetch(url: RequestInfo, init?: RequestInit): Promise<Response> };
private baseUrl: string;
@@ -4740,6 +4924,20 @@ export interface BundleBacktestRequestViewModel {
estimatedTimeRemainingSeconds?: number | null;
}
export interface BundleBacktestStatusResponse {
bundleRequestId?: string;
status?: string | null;
totalJobs?: number;
completedJobs?: number;
failedJobs?: number;
runningJobs?: number;
pendingJobs?: number;
progressPercentage?: number;
createdAt?: Date;
completedAt?: Date | null;
errorMessage?: string | null;
}
export interface GeneticRequest {
requestId: string;
user: User;
@@ -5199,6 +5397,69 @@ export interface AgentBalance {
time?: Date;
}
export interface BacktestJobStatusResponse {
jobId?: string;
status?: string | null;
progressPercentage?: number;
createdAt?: Date;
startedAt?: Date | null;
completedAt?: Date | null;
errorMessage?: string | null;
result?: LightBacktest | null;
}
export interface PaginatedJobsResponse {
jobs?: JobListItemResponse[];
totalCount?: number;
currentPage?: number;
pageSize?: number;
totalPages?: number;
hasNextPage?: boolean;
hasPreviousPage?: boolean;
}
export interface JobListItemResponse {
jobId?: string;
status?: string;
jobType?: string;
progressPercentage?: number;
priority?: number;
userId?: number;
bundleRequestId?: string | null;
geneticRequestId?: string | null;
assignedWorkerId?: string | null;
createdAt?: Date;
startedAt?: Date | null;
completedAt?: Date | null;
lastHeartbeat?: Date | null;
errorMessage?: string | null;
startDate?: Date;
endDate?: Date;
}
export interface JobSummaryResponse {
statusSummary?: JobStatusSummary[];
jobTypeSummary?: JobTypeSummary[];
statusTypeSummary?: JobStatusTypeSummary[];
totalJobs?: number;
}
export interface JobStatusSummary {
status?: string;
count?: number;
}
export interface JobTypeSummary {
jobType?: string;
count?: number;
}
export interface JobStatusTypeSummary {
status?: string;
jobType?: string;
count?: number;
}
export interface ScenarioViewModel {
name: string;
indicators: IndicatorViewModel[];