- Introduced IchimokuKumoTrend indicator in GeneticService with configuration settings for tenkanPeriods, kijunPeriods, senkouBPeriods, offsetPeriods, senkouOffset, and chikouOffset. - Updated ScenarioHelpers to handle creation and validation of the new indicator type. - Enhanced CustomScenario, backtest, and scenario pages to include IchimokuKumoTrend in indicator lists and parameter mappings. - Modified API and types to reflect the addition of the new indicator in relevant enums and mappings.
6070 lines
250 KiB
TypeScript
6070 lines
250 KiB
TypeScript
//----------------------
|
|
// <auto-generated>
|
|
// Generated using the NSwag toolchain v14.3.0.0 (NJsonSchema v11.2.0.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org)
|
|
// </auto-generated>
|
|
//----------------------
|
|
|
|
import AuthorizedApiBase from "./AuthorizedApiBase";
|
|
import IConfig from "./IConfig";
|
|
|
|
/* tslint:disable */
|
|
/* eslint-disable */
|
|
// ReSharper disable InconsistentNaming
|
|
|
|
export class AccountClient 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";
|
|
}
|
|
|
|
account_PostAccount(account: Account): Promise<Account> {
|
|
let url_ = this.baseUrl + "/Account";
|
|
url_ = url_.replace(/[?&]$/, "");
|
|
|
|
const content_ = JSON.stringify(account);
|
|
|
|
let options_: RequestInit = {
|
|
body: content_,
|
|
method: "POST",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
"Accept": "application/json"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processAccount_PostAccount(_response);
|
|
});
|
|
}
|
|
|
|
protected processAccount_PostAccount(response: Response): Promise<Account> {
|
|
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 Account;
|
|
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<Account>(null as any);
|
|
}
|
|
|
|
account_GetAccount(name: string | null | undefined): Promise<Account> {
|
|
let url_ = this.baseUrl + "/Account?";
|
|
if (name !== undefined && name !== null)
|
|
url_ += "name=" + encodeURIComponent("" + name) + "&";
|
|
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.processAccount_GetAccount(_response);
|
|
});
|
|
}
|
|
|
|
protected processAccount_GetAccount(response: Response): Promise<Account> {
|
|
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 Account;
|
|
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<Account>(null as any);
|
|
}
|
|
|
|
account_DeleteAccount(name: string | null | undefined): Promise<FileResponse> {
|
|
let url_ = this.baseUrl + "/Account?";
|
|
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.processAccount_DeleteAccount(_response);
|
|
});
|
|
}
|
|
|
|
protected processAccount_DeleteAccount(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);
|
|
}
|
|
|
|
account_GetAccounts(): Promise<Account[]> {
|
|
let url_ = this.baseUrl + "/Account/accounts";
|
|
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.processAccount_GetAccounts(_response);
|
|
});
|
|
}
|
|
|
|
protected processAccount_GetAccounts(response: Response): Promise<Account[]> {
|
|
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 Account[];
|
|
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<Account[]>(null as any);
|
|
}
|
|
|
|
account_GetAccountsBalances(): Promise<Account[]> {
|
|
let url_ = this.baseUrl + "/Account/balances";
|
|
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.processAccount_GetAccountsBalances(_response);
|
|
});
|
|
}
|
|
|
|
protected processAccount_GetAccountsBalances(response: Response): Promise<Account[]> {
|
|
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 Account[];
|
|
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<Account[]>(null as any);
|
|
}
|
|
|
|
account_GetGmxClaimableSummary(name: string): Promise<GmxClaimableSummary> {
|
|
let url_ = this.baseUrl + "/Account/{name}/gmx-claimable-summary";
|
|
if (name === undefined || name === null)
|
|
throw new Error("The parameter 'name' must be defined.");
|
|
url_ = url_.replace("{name}", encodeURIComponent("" + name));
|
|
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.processAccount_GetGmxClaimableSummary(_response);
|
|
});
|
|
}
|
|
|
|
protected processAccount_GetGmxClaimableSummary(response: Response): Promise<GmxClaimableSummary> {
|
|
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 GmxClaimableSummary;
|
|
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<GmxClaimableSummary>(null as any);
|
|
}
|
|
|
|
account_SwapGmxTokens(name: string, request: SwapTokensRequest): Promise<SwapInfos> {
|
|
let url_ = this.baseUrl + "/Account/{name}/gmx-swap";
|
|
if (name === undefined || name === null)
|
|
throw new Error("The parameter 'name' must be defined.");
|
|
url_ = url_.replace("{name}", encodeURIComponent("" + name));
|
|
url_ = url_.replace(/[?&]$/, "");
|
|
|
|
const content_ = JSON.stringify(request);
|
|
|
|
let options_: RequestInit = {
|
|
body: content_,
|
|
method: "POST",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
"Accept": "application/json"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processAccount_SwapGmxTokens(_response);
|
|
});
|
|
}
|
|
|
|
protected processAccount_SwapGmxTokens(response: Response): Promise<SwapInfos> {
|
|
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 SwapInfos;
|
|
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<SwapInfos>(null as any);
|
|
}
|
|
|
|
account_SendToken(name: string, request: SendTokenRequest): Promise<SwapInfos> {
|
|
let url_ = this.baseUrl + "/Account/{name}/send-token";
|
|
if (name === undefined || name === null)
|
|
throw new Error("The parameter 'name' must be defined.");
|
|
url_ = url_.replace("{name}", encodeURIComponent("" + name));
|
|
url_ = url_.replace(/[?&]$/, "");
|
|
|
|
const content_ = JSON.stringify(request);
|
|
|
|
let options_: RequestInit = {
|
|
body: content_,
|
|
method: "POST",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
"Accept": "application/json"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processAccount_SendToken(_response);
|
|
});
|
|
}
|
|
|
|
protected processAccount_SendToken(response: Response): Promise<SwapInfos> {
|
|
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 SwapInfos;
|
|
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<SwapInfos>(null as any);
|
|
}
|
|
|
|
account_GetExchangeApprovalStatus(): Promise<ExchangeInitializedStatus[]> {
|
|
let url_ = this.baseUrl + "/Account/exchanges-initialized-status";
|
|
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.processAccount_GetExchangeApprovalStatus(_response);
|
|
});
|
|
}
|
|
|
|
protected processAccount_GetExchangeApprovalStatus(response: Response): Promise<ExchangeInitializedStatus[]> {
|
|
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 ExchangeInitializedStatus[];
|
|
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<ExchangeInitializedStatus[]>(null as any);
|
|
}
|
|
}
|
|
|
|
export class AdminClient 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";
|
|
}
|
|
|
|
admin_GetBundleBacktestRequestsPaginated(page: number | undefined, pageSize: number | undefined, sortBy: BundleBacktestRequestSortableColumn | undefined, sortOrder: string | null | undefined, nameContains: string | null | undefined, status: BundleBacktestRequestStatus | null | undefined, userId: number | null | undefined, userNameContains: string | null | undefined, totalBacktestsMin: number | null | undefined, totalBacktestsMax: number | null | undefined, completedBacktestsMin: number | null | undefined, completedBacktestsMax: number | null | undefined, progressPercentageMin: number | null | undefined, progressPercentageMax: number | null | undefined, createdAtFrom: Date | null | undefined, createdAtTo: Date | null | undefined): Promise<PaginatedBundleBacktestRequestsResponse> {
|
|
let url_ = this.baseUrl + "/Admin/BundleBacktestRequests/Paginated?";
|
|
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 !== undefined && sortOrder !== null)
|
|
url_ += "sortOrder=" + encodeURIComponent("" + sortOrder) + "&";
|
|
if (nameContains !== undefined && nameContains !== null)
|
|
url_ += "nameContains=" + encodeURIComponent("" + nameContains) + "&";
|
|
if (status !== undefined && status !== null)
|
|
url_ += "status=" + encodeURIComponent("" + status) + "&";
|
|
if (userId !== undefined && userId !== null)
|
|
url_ += "userId=" + encodeURIComponent("" + userId) + "&";
|
|
if (userNameContains !== undefined && userNameContains !== null)
|
|
url_ += "userNameContains=" + encodeURIComponent("" + userNameContains) + "&";
|
|
if (totalBacktestsMin !== undefined && totalBacktestsMin !== null)
|
|
url_ += "totalBacktestsMin=" + encodeURIComponent("" + totalBacktestsMin) + "&";
|
|
if (totalBacktestsMax !== undefined && totalBacktestsMax !== null)
|
|
url_ += "totalBacktestsMax=" + encodeURIComponent("" + totalBacktestsMax) + "&";
|
|
if (completedBacktestsMin !== undefined && completedBacktestsMin !== null)
|
|
url_ += "completedBacktestsMin=" + encodeURIComponent("" + completedBacktestsMin) + "&";
|
|
if (completedBacktestsMax !== undefined && completedBacktestsMax !== null)
|
|
url_ += "completedBacktestsMax=" + encodeURIComponent("" + completedBacktestsMax) + "&";
|
|
if (progressPercentageMin !== undefined && progressPercentageMin !== null)
|
|
url_ += "progressPercentageMin=" + encodeURIComponent("" + progressPercentageMin) + "&";
|
|
if (progressPercentageMax !== undefined && progressPercentageMax !== null)
|
|
url_ += "progressPercentageMax=" + encodeURIComponent("" + progressPercentageMax) + "&";
|
|
if (createdAtFrom !== undefined && createdAtFrom !== null)
|
|
url_ += "createdAtFrom=" + encodeURIComponent(createdAtFrom ? "" + createdAtFrom.toISOString() : "") + "&";
|
|
if (createdAtTo !== undefined && createdAtTo !== null)
|
|
url_ += "createdAtTo=" + encodeURIComponent(createdAtTo ? "" + createdAtTo.toISOString() : "") + "&";
|
|
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.processAdmin_GetBundleBacktestRequestsPaginated(_response);
|
|
});
|
|
}
|
|
|
|
protected processAdmin_GetBundleBacktestRequestsPaginated(response: Response): Promise<PaginatedBundleBacktestRequestsResponse> {
|
|
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 PaginatedBundleBacktestRequestsResponse;
|
|
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<PaginatedBundleBacktestRequestsResponse>(null as any);
|
|
}
|
|
|
|
admin_GetBundleBacktestRequestsSummary(): Promise<BundleBacktestRequestSummaryResponse> {
|
|
let url_ = this.baseUrl + "/Admin/BundleBacktestRequests/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.processAdmin_GetBundleBacktestRequestsSummary(_response);
|
|
});
|
|
}
|
|
|
|
protected processAdmin_GetBundleBacktestRequestsSummary(response: Response): Promise<BundleBacktestRequestSummaryResponse> {
|
|
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 BundleBacktestRequestSummaryResponse;
|
|
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<BundleBacktestRequestSummaryResponse>(null as any);
|
|
}
|
|
|
|
admin_DeleteBundleBacktestRequest(id: string): Promise<FileResponse> {
|
|
let url_ = this.baseUrl + "/Admin/BundleBacktestRequests/{id}";
|
|
if (id === undefined || id === null)
|
|
throw new Error("The parameter 'id' must be defined.");
|
|
url_ = url_.replace("{id}", encodeURIComponent("" + id));
|
|
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.processAdmin_DeleteBundleBacktestRequest(_response);
|
|
});
|
|
}
|
|
|
|
protected processAdmin_DeleteBundleBacktestRequest(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);
|
|
}
|
|
|
|
admin_GetUsersPaginated(page: number | undefined, pageSize: number | undefined, sortBy: UserSortableColumn | undefined, sortOrder: string | null | undefined, userNameContains: string | null | undefined, ownerAddressContains: string | null | undefined, agentNameContains: string | null | undefined, telegramChannelContains: string | null | undefined): Promise<PaginatedUsersResponse> {
|
|
let url_ = this.baseUrl + "/Admin/Users/Paginated?";
|
|
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 !== undefined && sortOrder !== null)
|
|
url_ += "sortOrder=" + encodeURIComponent("" + sortOrder) + "&";
|
|
if (userNameContains !== undefined && userNameContains !== null)
|
|
url_ += "userNameContains=" + encodeURIComponent("" + userNameContains) + "&";
|
|
if (ownerAddressContains !== undefined && ownerAddressContains !== null)
|
|
url_ += "ownerAddressContains=" + encodeURIComponent("" + ownerAddressContains) + "&";
|
|
if (agentNameContains !== undefined && agentNameContains !== null)
|
|
url_ += "agentNameContains=" + encodeURIComponent("" + agentNameContains) + "&";
|
|
if (telegramChannelContains !== undefined && telegramChannelContains !== null)
|
|
url_ += "telegramChannelContains=" + encodeURIComponent("" + telegramChannelContains) + "&";
|
|
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.processAdmin_GetUsersPaginated(_response);
|
|
});
|
|
}
|
|
|
|
protected processAdmin_GetUsersPaginated(response: Response): Promise<PaginatedUsersResponse> {
|
|
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 PaginatedUsersResponse;
|
|
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<PaginatedUsersResponse>(null as any);
|
|
}
|
|
}
|
|
|
|
export class BacktestClient 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";
|
|
}
|
|
|
|
backtest_Backtests(): Promise<Backtest[]> {
|
|
let url_ = this.baseUrl + "/Backtest";
|
|
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_Backtests(_response);
|
|
});
|
|
}
|
|
|
|
protected processBacktest_Backtests(response: Response): Promise<Backtest[]> {
|
|
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 Backtest[];
|
|
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<Backtest[]>(null as any);
|
|
}
|
|
|
|
backtest_DeleteBacktest(id: string | null | undefined): Promise<FileResponse> {
|
|
let url_ = this.baseUrl + "/Backtest?";
|
|
if (id !== undefined && id !== null)
|
|
url_ += "id=" + encodeURIComponent("" + id) + "&";
|
|
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_DeleteBacktest(_response);
|
|
});
|
|
}
|
|
|
|
protected processBacktest_DeleteBacktest(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_Map(moneyManagementRequest: MoneyManagementRequest): Promise<MoneyManagement> {
|
|
let url_ = this.baseUrl + "/Backtest";
|
|
url_ = url_.replace(/[?&]$/, "");
|
|
|
|
const content_ = JSON.stringify(moneyManagementRequest);
|
|
|
|
let options_: RequestInit = {
|
|
body: content_,
|
|
method: "POST",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
"Accept": "application/json"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processBacktest_Map(_response);
|
|
});
|
|
}
|
|
|
|
protected processBacktest_Map(response: Response): Promise<MoneyManagement> {
|
|
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 MoneyManagement;
|
|
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<MoneyManagement>(null as any);
|
|
}
|
|
|
|
backtest_Backtest(id: string): Promise<Backtest> {
|
|
let url_ = this.baseUrl + "/Backtest/{id}";
|
|
if (id === undefined || id === null)
|
|
throw new Error("The parameter 'id' must be defined.");
|
|
url_ = url_.replace("{id}", encodeURIComponent("" + id));
|
|
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_Backtest(_response);
|
|
});
|
|
}
|
|
|
|
protected processBacktest_Backtest(response: Response): Promise<Backtest> {
|
|
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 Backtest;
|
|
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<Backtest>(null as any);
|
|
}
|
|
|
|
backtest_DeleteBacktests(request: DeleteBacktestsRequest): Promise<FileResponse> {
|
|
let url_ = this.baseUrl + "/Backtest/multiple";
|
|
url_ = url_.replace(/[?&]$/, "");
|
|
|
|
const content_ = JSON.stringify(request);
|
|
|
|
let options_: RequestInit = {
|
|
body: content_,
|
|
method: "DELETE",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
"Accept": "application/octet-stream"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processBacktest_DeleteBacktests(_response);
|
|
});
|
|
}
|
|
|
|
protected processBacktest_DeleteBacktests(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_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<LightBacktestResponse[]> {
|
|
let url_ = this.baseUrl + "/Backtest/ByRequestId/{requestId}";
|
|
if (requestId === undefined || requestId === null)
|
|
throw new Error("The parameter 'requestId' must be defined.");
|
|
url_ = url_.replace("{requestId}", encodeURIComponent("" + requestId));
|
|
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_GetBacktestsByRequestId(_response);
|
|
});
|
|
}
|
|
|
|
protected processBacktest_GetBacktestsByRequestId(response: Response): Promise<LightBacktestResponse[]> {
|
|
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 LightBacktestResponse[];
|
|
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<LightBacktestResponse[]>(null as any);
|
|
}
|
|
|
|
backtest_GetBacktestsByRequestIdPaginated(requestId: string, page: number | undefined, pageSize: number | undefined, sortBy: string | null | undefined, sortOrder: string | null | undefined): Promise<PaginatedBacktestsResponse> {
|
|
let url_ = this.baseUrl + "/Backtest/ByRequestId/{requestId}/Paginated?";
|
|
if (requestId === undefined || requestId === null)
|
|
throw new Error("The parameter 'requestId' must be defined.");
|
|
url_ = url_.replace("{requestId}", encodeURIComponent("" + requestId));
|
|
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 !== undefined && sortBy !== null)
|
|
url_ += "sortBy=" + encodeURIComponent("" + sortBy) + "&";
|
|
if (sortOrder !== undefined && sortOrder !== null)
|
|
url_ += "sortOrder=" + encodeURIComponent("" + sortOrder) + "&";
|
|
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_GetBacktestsByRequestIdPaginated(_response);
|
|
});
|
|
}
|
|
|
|
protected processBacktest_GetBacktestsByRequestIdPaginated(response: Response): Promise<PaginatedBacktestsResponse> {
|
|
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 PaginatedBacktestsResponse;
|
|
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<PaginatedBacktestsResponse>(null as any);
|
|
}
|
|
|
|
backtest_GetBacktestsPaginated(page: number | undefined, pageSize: number | undefined, sortBy: BacktestSortableColumn | undefined, sortOrder: string | null | undefined, 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<PaginatedBacktestsResponse> {
|
|
let url_ = this.baseUrl + "/Backtest/Paginated?";
|
|
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 !== undefined && sortOrder !== null)
|
|
url_ += "sortOrder=" + encodeURIComponent("" + sortOrder) + "&";
|
|
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: "GET",
|
|
headers: {
|
|
"Accept": "application/json"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processBacktest_GetBacktestsPaginated(_response);
|
|
});
|
|
}
|
|
|
|
protected processBacktest_GetBacktestsPaginated(response: Response): Promise<PaginatedBacktestsResponse> {
|
|
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 PaginatedBacktestsResponse;
|
|
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<PaginatedBacktestsResponse>(null as any);
|
|
}
|
|
|
|
backtest_Run(request: RunBacktestRequest): Promise<LightBacktest> {
|
|
let url_ = this.baseUrl + "/Backtest/Run";
|
|
url_ = url_.replace(/[?&]$/, "");
|
|
|
|
const content_ = JSON.stringify(request);
|
|
|
|
let options_: RequestInit = {
|
|
body: content_,
|
|
method: "POST",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
"Accept": "application/json"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processBacktest_Run(_response);
|
|
});
|
|
}
|
|
|
|
protected processBacktest_Run(response: Response): Promise<LightBacktest> {
|
|
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 LightBacktest;
|
|
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<LightBacktest>(null as any);
|
|
}
|
|
|
|
backtest_RunBundle(request: RunBundleBacktestRequest): Promise<BundleBacktestRequest> {
|
|
let url_ = this.baseUrl + "/Backtest/BacktestBundle";
|
|
url_ = url_.replace(/[?&]$/, "");
|
|
|
|
const content_ = JSON.stringify(request);
|
|
|
|
let options_: RequestInit = {
|
|
body: content_,
|
|
method: "POST",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
"Accept": "application/json"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processBacktest_RunBundle(_response);
|
|
});
|
|
}
|
|
|
|
protected processBacktest_RunBundle(response: Response): Promise<BundleBacktestRequest> {
|
|
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 BundleBacktestRequest;
|
|
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<BundleBacktestRequest>(null as any);
|
|
}
|
|
|
|
backtest_GetBundleBacktestRequests(): Promise<BundleBacktestRequest[]> {
|
|
let url_ = this.baseUrl + "/Backtest/Bundle";
|
|
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_GetBundleBacktestRequests(_response);
|
|
});
|
|
}
|
|
|
|
protected processBacktest_GetBundleBacktestRequests(response: Response): Promise<BundleBacktestRequest[]> {
|
|
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 BundleBacktestRequest[];
|
|
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<BundleBacktestRequest[]>(null as any);
|
|
}
|
|
|
|
backtest_GetBundleBacktestRequest(id: string): Promise<BundleBacktestRequestViewModel> {
|
|
let url_ = this.baseUrl + "/Backtest/Bundle/{id}";
|
|
if (id === undefined || id === null)
|
|
throw new Error("The parameter 'id' must be defined.");
|
|
url_ = url_.replace("{id}", encodeURIComponent("" + id));
|
|
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_GetBundleBacktestRequest(_response);
|
|
});
|
|
}
|
|
|
|
protected processBacktest_GetBundleBacktestRequest(response: Response): Promise<BundleBacktestRequestViewModel> {
|
|
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 BundleBacktestRequestViewModel;
|
|
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<BundleBacktestRequestViewModel>(null as any);
|
|
}
|
|
|
|
backtest_DeleteBundleBacktestRequest(id: string): Promise<FileResponse> {
|
|
let url_ = this.baseUrl + "/Backtest/Bundle/{id}";
|
|
if (id === undefined || id === null)
|
|
throw new Error("The parameter 'id' must be defined.");
|
|
url_ = url_.replace("{id}", encodeURIComponent("" + id));
|
|
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_DeleteBundleBacktestRequest(_response);
|
|
});
|
|
}
|
|
|
|
protected processBacktest_DeleteBundleBacktestRequest(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_SubscribeToBundle(requestId: string | null | undefined): Promise<FileResponse> {
|
|
let url_ = this.baseUrl + "/Backtest/Bundle/Subscribe?";
|
|
if (requestId !== undefined && requestId !== null)
|
|
url_ += "requestId=" + encodeURIComponent("" + requestId) + "&";
|
|
url_ = url_.replace(/[?&]$/, "");
|
|
|
|
let options_: RequestInit = {
|
|
method: "POST",
|
|
headers: {
|
|
"Accept": "application/octet-stream"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processBacktest_SubscribeToBundle(_response);
|
|
});
|
|
}
|
|
|
|
protected processBacktest_SubscribeToBundle(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_UnsubscribeFromBundle(requestId: string | null | undefined): Promise<FileResponse> {
|
|
let url_ = this.baseUrl + "/Backtest/Bundle/Unsubscribe?";
|
|
if (requestId !== undefined && requestId !== null)
|
|
url_ += "requestId=" + encodeURIComponent("" + requestId) + "&";
|
|
url_ = url_.replace(/[?&]$/, "");
|
|
|
|
let options_: RequestInit = {
|
|
method: "POST",
|
|
headers: {
|
|
"Accept": "application/octet-stream"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processBacktest_UnsubscribeFromBundle(_response);
|
|
});
|
|
}
|
|
|
|
protected processBacktest_UnsubscribeFromBundle(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_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(/[?&]$/, "");
|
|
|
|
const content_ = JSON.stringify(request);
|
|
|
|
let options_: RequestInit = {
|
|
body: content_,
|
|
method: "POST",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
"Accept": "application/json"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processBacktest_RunGenetic(_response);
|
|
});
|
|
}
|
|
|
|
protected processBacktest_RunGenetic(response: Response): Promise<GeneticRequest> {
|
|
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 GeneticRequest;
|
|
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<GeneticRequest>(null as any);
|
|
}
|
|
|
|
backtest_GetGeneticRequests(): Promise<GeneticRequest[]> {
|
|
let url_ = this.baseUrl + "/Backtest/Genetic";
|
|
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_GetGeneticRequests(_response);
|
|
});
|
|
}
|
|
|
|
protected processBacktest_GetGeneticRequests(response: Response): Promise<GeneticRequest[]> {
|
|
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 GeneticRequest[];
|
|
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<GeneticRequest[]>(null as any);
|
|
}
|
|
|
|
backtest_GetGeneticRequest(id: string): Promise<GeneticRequest> {
|
|
let url_ = this.baseUrl + "/Backtest/Genetic/{id}";
|
|
if (id === undefined || id === null)
|
|
throw new Error("The parameter 'id' must be defined.");
|
|
url_ = url_.replace("{id}", encodeURIComponent("" + id));
|
|
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_GetGeneticRequest(_response);
|
|
});
|
|
}
|
|
|
|
protected processBacktest_GetGeneticRequest(response: Response): Promise<GeneticRequest> {
|
|
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 GeneticRequest;
|
|
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<GeneticRequest>(null as any);
|
|
}
|
|
|
|
backtest_DeleteGeneticRequest(id: string): Promise<FileResponse> {
|
|
let url_ = this.baseUrl + "/Backtest/Genetic/{id}";
|
|
if (id === undefined || id === null)
|
|
throw new Error("The parameter 'id' must be defined.");
|
|
url_ = url_.replace("{id}", encodeURIComponent("" + id));
|
|
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_DeleteGeneticRequest(_response);
|
|
});
|
|
}
|
|
|
|
protected processBacktest_DeleteGeneticRequest(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);
|
|
}
|
|
}
|
|
|
|
export class BotClient 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";
|
|
}
|
|
|
|
bot_Start(request: StartBotRequest): Promise<string> {
|
|
let url_ = this.baseUrl + "/Bot/Start";
|
|
url_ = url_.replace(/[?&]$/, "");
|
|
|
|
const content_ = JSON.stringify(request);
|
|
|
|
let options_: RequestInit = {
|
|
body: content_,
|
|
method: "POST",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
"Accept": "application/json"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processBot_Start(_response);
|
|
});
|
|
}
|
|
|
|
protected processBot_Start(response: Response): Promise<string> {
|
|
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 string;
|
|
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<string>(null as any);
|
|
}
|
|
|
|
bot_StartCopyTrading(request: StartCopyTradingRequest): Promise<string> {
|
|
let url_ = this.baseUrl + "/Bot/StartCopyTrading";
|
|
url_ = url_.replace(/[?&]$/, "");
|
|
|
|
const content_ = JSON.stringify(request);
|
|
|
|
let options_: RequestInit = {
|
|
body: content_,
|
|
method: "POST",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
"Accept": "application/json"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processBot_StartCopyTrading(_response);
|
|
});
|
|
}
|
|
|
|
protected processBot_StartCopyTrading(response: Response): Promise<string> {
|
|
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 string;
|
|
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<string>(null as any);
|
|
}
|
|
|
|
bot_Save(request: SaveBotRequest): Promise<string> {
|
|
let url_ = this.baseUrl + "/Bot/Save";
|
|
url_ = url_.replace(/[?&]$/, "");
|
|
|
|
const content_ = JSON.stringify(request);
|
|
|
|
let options_: RequestInit = {
|
|
body: content_,
|
|
method: "POST",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
"Accept": "application/json"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processBot_Save(_response);
|
|
});
|
|
}
|
|
|
|
protected processBot_Save(response: Response): Promise<string> {
|
|
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 string;
|
|
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<string>(null as any);
|
|
}
|
|
|
|
bot_Stop(identifier: string | undefined): Promise<BotStatus> {
|
|
let url_ = this.baseUrl + "/Bot/Stop?";
|
|
if (identifier === null)
|
|
throw new Error("The parameter 'identifier' cannot be null.");
|
|
else if (identifier !== undefined)
|
|
url_ += "identifier=" + encodeURIComponent("" + identifier) + "&";
|
|
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.processBot_Stop(_response);
|
|
});
|
|
}
|
|
|
|
protected processBot_Stop(response: Response): Promise<BotStatus> {
|
|
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 BotStatus;
|
|
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<BotStatus>(null as any);
|
|
}
|
|
|
|
bot_StopAll(): Promise<boolean> {
|
|
let url_ = this.baseUrl + "/Bot/StopAll";
|
|
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.processBot_StopAll(_response);
|
|
});
|
|
}
|
|
|
|
protected processBot_StopAll(response: Response): Promise<boolean> {
|
|
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 boolean;
|
|
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<boolean>(null as any);
|
|
}
|
|
|
|
bot_Delete(identifier: string | undefined): Promise<boolean> {
|
|
let url_ = this.baseUrl + "/Bot/Delete?";
|
|
if (identifier === null)
|
|
throw new Error("The parameter 'identifier' cannot be null.");
|
|
else if (identifier !== undefined)
|
|
url_ += "identifier=" + encodeURIComponent("" + identifier) + "&";
|
|
url_ = url_.replace(/[?&]$/, "");
|
|
|
|
let options_: RequestInit = {
|
|
method: "DELETE",
|
|
headers: {
|
|
"Accept": "application/json"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processBot_Delete(_response);
|
|
});
|
|
}
|
|
|
|
protected processBot_Delete(response: Response): Promise<boolean> {
|
|
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 boolean;
|
|
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<boolean>(null as any);
|
|
}
|
|
|
|
bot_Restart(identifier: string | undefined): Promise<string> {
|
|
let url_ = this.baseUrl + "/Bot/Restart?";
|
|
if (identifier === null)
|
|
throw new Error("The parameter 'identifier' cannot be null.");
|
|
else if (identifier !== undefined)
|
|
url_ += "identifier=" + encodeURIComponent("" + identifier) + "&";
|
|
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.processBot_Restart(_response);
|
|
});
|
|
}
|
|
|
|
protected processBot_Restart(response: Response): Promise<string> {
|
|
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 string;
|
|
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<string>(null as any);
|
|
}
|
|
|
|
bot_GetActiveBots(): Promise<TradingBotResponse[]> {
|
|
let url_ = this.baseUrl + "/Bot";
|
|
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.processBot_GetActiveBots(_response);
|
|
});
|
|
}
|
|
|
|
protected processBot_GetActiveBots(response: Response): Promise<TradingBotResponse[]> {
|
|
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 TradingBotResponse[];
|
|
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<TradingBotResponse[]>(null as any);
|
|
}
|
|
|
|
bot_Map(moneyManagementRequest: MoneyManagementRequest): Promise<MoneyManagement> {
|
|
let url_ = this.baseUrl + "/Bot";
|
|
url_ = url_.replace(/[?&]$/, "");
|
|
|
|
const content_ = JSON.stringify(moneyManagementRequest);
|
|
|
|
let options_: RequestInit = {
|
|
body: content_,
|
|
method: "POST",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
"Accept": "application/json"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processBot_Map(_response);
|
|
});
|
|
}
|
|
|
|
protected processBot_Map(response: Response): Promise<MoneyManagement> {
|
|
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 MoneyManagement;
|
|
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<MoneyManagement>(null as any);
|
|
}
|
|
|
|
bot_GetBotsByStatus(status: BotStatus): Promise<TradingBotResponse[]> {
|
|
let url_ = this.baseUrl + "/Bot/ByStatus/{status}";
|
|
if (status === undefined || status === null)
|
|
throw new Error("The parameter 'status' must be defined.");
|
|
url_ = url_.replace("{status}", encodeURIComponent("" + status));
|
|
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.processBot_GetBotsByStatus(_response);
|
|
});
|
|
}
|
|
|
|
protected processBot_GetBotsByStatus(response: Response): Promise<TradingBotResponse[]> {
|
|
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 TradingBotResponse[];
|
|
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<TradingBotResponse[]>(null as any);
|
|
}
|
|
|
|
bot_GetMySavedBots(): Promise<TradingBotResponse[]> {
|
|
let url_ = this.baseUrl + "/Bot/GetMySavedBots";
|
|
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.processBot_GetMySavedBots(_response);
|
|
});
|
|
}
|
|
|
|
protected processBot_GetMySavedBots(response: Response): Promise<TradingBotResponse[]> {
|
|
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 TradingBotResponse[];
|
|
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<TradingBotResponse[]>(null as any);
|
|
}
|
|
|
|
bot_GetBotsPaginated(pageNumber: number | undefined, pageSize: number | undefined, status: BotStatus | null | undefined, name: string | null | undefined, ticker: string | null | undefined, agentName: string | null | undefined, sortBy: BotSortableColumn | undefined, sortDirection: string | null | undefined): Promise<PaginatedResponseOfTradingBotResponse> {
|
|
let url_ = this.baseUrl + "/Bot/Paginated?";
|
|
if (pageNumber === null)
|
|
throw new Error("The parameter 'pageNumber' cannot be null.");
|
|
else if (pageNumber !== undefined)
|
|
url_ += "pageNumber=" + encodeURIComponent("" + pageNumber) + "&";
|
|
if (pageSize === null)
|
|
throw new Error("The parameter 'pageSize' cannot be null.");
|
|
else if (pageSize !== undefined)
|
|
url_ += "pageSize=" + encodeURIComponent("" + pageSize) + "&";
|
|
if (status !== undefined && status !== null)
|
|
url_ += "status=" + encodeURIComponent("" + status) + "&";
|
|
if (name !== undefined && name !== null)
|
|
url_ += "name=" + encodeURIComponent("" + name) + "&";
|
|
if (ticker !== undefined && ticker !== null)
|
|
url_ += "ticker=" + encodeURIComponent("" + ticker) + "&";
|
|
if (agentName !== undefined && agentName !== null)
|
|
url_ += "agentName=" + encodeURIComponent("" + agentName) + "&";
|
|
if (sortBy === null)
|
|
throw new Error("The parameter 'sortBy' cannot be null.");
|
|
else if (sortBy !== undefined)
|
|
url_ += "sortBy=" + encodeURIComponent("" + sortBy) + "&";
|
|
if (sortDirection !== undefined && sortDirection !== null)
|
|
url_ += "sortDirection=" + encodeURIComponent("" + sortDirection) + "&";
|
|
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.processBot_GetBotsPaginated(_response);
|
|
});
|
|
}
|
|
|
|
protected processBot_GetBotsPaginated(response: Response): Promise<PaginatedResponseOfTradingBotResponse> {
|
|
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 PaginatedResponseOfTradingBotResponse;
|
|
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<PaginatedResponseOfTradingBotResponse>(null as any);
|
|
}
|
|
|
|
bot_CreateManualSignal(request: CreateManualSignalRequest): Promise<LightSignal> {
|
|
let url_ = this.baseUrl + "/Bot/CreateManualSignal";
|
|
url_ = url_.replace(/[?&]$/, "");
|
|
|
|
const content_ = JSON.stringify(request);
|
|
|
|
let options_: RequestInit = {
|
|
body: content_,
|
|
method: "POST",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
"Accept": "application/json"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processBot_CreateManualSignal(_response);
|
|
});
|
|
}
|
|
|
|
protected processBot_CreateManualSignal(response: Response): Promise<LightSignal> {
|
|
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 LightSignal;
|
|
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<LightSignal>(null as any);
|
|
}
|
|
|
|
bot_ClosePosition(request: ClosePositionRequest): Promise<Position> {
|
|
let url_ = this.baseUrl + "/Bot/ClosePosition";
|
|
url_ = url_.replace(/[?&]$/, "");
|
|
|
|
const content_ = JSON.stringify(request);
|
|
|
|
let options_: RequestInit = {
|
|
body: content_,
|
|
method: "POST",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
"Accept": "application/json"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processBot_ClosePosition(_response);
|
|
});
|
|
}
|
|
|
|
protected processBot_ClosePosition(response: Response): Promise<Position> {
|
|
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 Position;
|
|
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<Position>(null as any);
|
|
}
|
|
|
|
bot_GetBotConfig(identifier: string): Promise<TradingBotConfig> {
|
|
let url_ = this.baseUrl + "/Bot/GetConfig/{identifier}";
|
|
if (identifier === undefined || identifier === null)
|
|
throw new Error("The parameter 'identifier' must be defined.");
|
|
url_ = url_.replace("{identifier}", encodeURIComponent("" + identifier));
|
|
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.processBot_GetBotConfig(_response);
|
|
});
|
|
}
|
|
|
|
protected processBot_GetBotConfig(response: Response): Promise<TradingBotConfig> {
|
|
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 TradingBotConfig;
|
|
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<TradingBotConfig>(null as any);
|
|
}
|
|
|
|
bot_UpdateBotConfig(request: UpdateBotConfigRequest): Promise<string> {
|
|
let url_ = this.baseUrl + "/Bot/UpdateConfig";
|
|
url_ = url_.replace(/[?&]$/, "");
|
|
|
|
const content_ = JSON.stringify(request);
|
|
|
|
let options_: RequestInit = {
|
|
body: content_,
|
|
method: "PUT",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
"Accept": "application/json"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processBot_UpdateBotConfig(_response);
|
|
});
|
|
}
|
|
|
|
protected processBot_UpdateBotConfig(response: Response): Promise<string> {
|
|
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 string;
|
|
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<string>(null as any);
|
|
}
|
|
}
|
|
|
|
export class DataClient 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";
|
|
}
|
|
|
|
data_GetTickers(timeframe: Timeframe | undefined): Promise<TickerInfos[]> {
|
|
let url_ = this.baseUrl + "/Data/GetTickers?";
|
|
if (timeframe === null)
|
|
throw new Error("The parameter 'timeframe' cannot be null.");
|
|
else if (timeframe !== undefined)
|
|
url_ += "timeframe=" + encodeURIComponent("" + timeframe) + "&";
|
|
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.processData_GetTickers(_response);
|
|
});
|
|
}
|
|
|
|
protected processData_GetTickers(response: Response): Promise<TickerInfos[]> {
|
|
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 TickerInfos[];
|
|
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<TickerInfos[]>(null as any);
|
|
}
|
|
|
|
data_GetSpotlight(): Promise<SpotlightOverview> {
|
|
let url_ = this.baseUrl + "/Data/Spotlight";
|
|
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.processData_GetSpotlight(_response);
|
|
});
|
|
}
|
|
|
|
protected processData_GetSpotlight(response: Response): Promise<SpotlightOverview> {
|
|
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 SpotlightOverview;
|
|
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<SpotlightOverview>(null as any);
|
|
}
|
|
|
|
data_GetCandlesWithIndicators(request: GetCandlesWithIndicatorsRequest): Promise<CandlesWithIndicatorsResponse> {
|
|
let url_ = this.baseUrl + "/Data/GetCandlesWithIndicators";
|
|
url_ = url_.replace(/[?&]$/, "");
|
|
|
|
const content_ = JSON.stringify(request);
|
|
|
|
let options_: RequestInit = {
|
|
body: content_,
|
|
method: "POST",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
"Accept": "application/json"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processData_GetCandlesWithIndicators(_response);
|
|
});
|
|
}
|
|
|
|
protected processData_GetCandlesWithIndicators(response: Response): Promise<CandlesWithIndicatorsResponse> {
|
|
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 CandlesWithIndicatorsResponse;
|
|
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<CandlesWithIndicatorsResponse>(null as any);
|
|
}
|
|
|
|
data_GetStrategiesStatistics(): Promise<StrategiesStatisticsViewModel> {
|
|
let url_ = this.baseUrl + "/Data/GetStrategiesStatistics";
|
|
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.processData_GetStrategiesStatistics(_response);
|
|
});
|
|
}
|
|
|
|
protected processData_GetStrategiesStatistics(response: Response): Promise<StrategiesStatisticsViewModel> {
|
|
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 StrategiesStatisticsViewModel;
|
|
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<StrategiesStatisticsViewModel>(null as any);
|
|
}
|
|
|
|
data_GetTopStrategies(): Promise<TopStrategiesViewModel> {
|
|
let url_ = this.baseUrl + "/Data/GetTopStrategies";
|
|
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.processData_GetTopStrategies(_response);
|
|
});
|
|
}
|
|
|
|
protected processData_GetTopStrategies(response: Response): Promise<TopStrategiesViewModel> {
|
|
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 TopStrategiesViewModel;
|
|
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<TopStrategiesViewModel>(null as any);
|
|
}
|
|
|
|
data_GetTopStrategiesByRoi(): Promise<TopStrategiesByRoiViewModel> {
|
|
let url_ = this.baseUrl + "/Data/GetTopStrategiesByRoi";
|
|
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.processData_GetTopStrategiesByRoi(_response);
|
|
});
|
|
}
|
|
|
|
protected processData_GetTopStrategiesByRoi(response: Response): Promise<TopStrategiesByRoiViewModel> {
|
|
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 TopStrategiesByRoiViewModel;
|
|
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<TopStrategiesByRoiViewModel>(null as any);
|
|
}
|
|
|
|
data_GetUserStrategies(agentName: string | null | undefined): Promise<UserStrategyDetailsViewModel[]> {
|
|
let url_ = this.baseUrl + "/Data/GetUserStrategies?";
|
|
if (agentName !== undefined && agentName !== null)
|
|
url_ += "agentName=" + encodeURIComponent("" + agentName) + "&";
|
|
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.processData_GetUserStrategies(_response);
|
|
});
|
|
}
|
|
|
|
protected processData_GetUserStrategies(response: Response): Promise<UserStrategyDetailsViewModel[]> {
|
|
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 UserStrategyDetailsViewModel[];
|
|
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<UserStrategyDetailsViewModel[]>(null as any);
|
|
}
|
|
|
|
data_GetUserStrategy(agentName: string | null | undefined, strategyName: string | null | undefined): Promise<UserStrategyDetailsViewModel> {
|
|
let url_ = this.baseUrl + "/Data/GetUserStrategy?";
|
|
if (agentName !== undefined && agentName !== null)
|
|
url_ += "agentName=" + encodeURIComponent("" + agentName) + "&";
|
|
if (strategyName !== undefined && strategyName !== null)
|
|
url_ += "strategyName=" + encodeURIComponent("" + strategyName) + "&";
|
|
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.processData_GetUserStrategy(_response);
|
|
});
|
|
}
|
|
|
|
protected processData_GetUserStrategy(response: Response): Promise<UserStrategyDetailsViewModel> {
|
|
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 UserStrategyDetailsViewModel;
|
|
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<UserStrategyDetailsViewModel>(null as any);
|
|
}
|
|
|
|
data_GetPlatformSummary(): Promise<PlatformSummaryViewModel> {
|
|
let url_ = this.baseUrl + "/Data/GetPlatformSummary";
|
|
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.processData_GetPlatformSummary(_response);
|
|
});
|
|
}
|
|
|
|
protected processData_GetPlatformSummary(response: Response): Promise<PlatformSummaryViewModel> {
|
|
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 PlatformSummaryViewModel;
|
|
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<PlatformSummaryViewModel>(null as any);
|
|
}
|
|
|
|
data_GetAgentIndexPaginated(page: number | undefined, pageSize: number | undefined, sortBy: SortableFields | undefined, sortOrder: string | null | undefined, agentNames: string | null | undefined): Promise<PaginatedAgentIndexResponse> {
|
|
let url_ = this.baseUrl + "/Data/GetAgentIndexPaginated?";
|
|
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 !== undefined && sortOrder !== null)
|
|
url_ += "sortOrder=" + encodeURIComponent("" + sortOrder) + "&";
|
|
if (agentNames !== undefined && agentNames !== null)
|
|
url_ += "agentNames=" + encodeURIComponent("" + agentNames) + "&";
|
|
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.processData_GetAgentIndexPaginated(_response);
|
|
});
|
|
}
|
|
|
|
protected processData_GetAgentIndexPaginated(response: Response): Promise<PaginatedAgentIndexResponse> {
|
|
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 PaginatedAgentIndexResponse;
|
|
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<PaginatedAgentIndexResponse>(null as any);
|
|
}
|
|
|
|
data_GetAgentBalances(agentName: string | null | undefined, startDate: Date | undefined, endDate: Date | null | undefined): Promise<AgentBalanceHistory> {
|
|
let url_ = this.baseUrl + "/Data/GetAgentBalances?";
|
|
if (agentName !== undefined && agentName !== null)
|
|
url_ += "agentName=" + encodeURIComponent("" + agentName) + "&";
|
|
if (startDate === null)
|
|
throw new Error("The parameter 'startDate' cannot be null.");
|
|
else if (startDate !== undefined)
|
|
url_ += "startDate=" + encodeURIComponent(startDate ? "" + startDate.toISOString() : "") + "&";
|
|
if (endDate !== undefined && endDate !== null)
|
|
url_ += "endDate=" + encodeURIComponent(endDate ? "" + endDate.toISOString() : "") + "&";
|
|
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.processData_GetAgentBalances(_response);
|
|
});
|
|
}
|
|
|
|
protected processData_GetAgentBalances(response: Response): Promise<AgentBalanceHistory> {
|
|
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 AgentBalanceHistory;
|
|
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<AgentBalanceHistory>(null as any);
|
|
}
|
|
|
|
data_GetOnlineAgent(): Promise<string[]> {
|
|
let url_ = this.baseUrl + "/Data/GetOnlineAgent";
|
|
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.processData_GetOnlineAgent(_response);
|
|
});
|
|
}
|
|
|
|
protected processData_GetOnlineAgent(response: Response): Promise<string[]> {
|
|
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 string[];
|
|
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<string[]>(null as any);
|
|
}
|
|
|
|
data_GetStrategiesPaginated(pageNumber: number | undefined, pageSize: number | undefined, name: string | null | undefined, ticker: string | null | undefined, agentName: string | null | undefined, sortBy: BotSortableColumn | undefined, sortDirection: string | null | undefined): Promise<PaginatedResponseOfTradingBotResponse> {
|
|
let url_ = this.baseUrl + "/Data/GetStrategiesPaginated?";
|
|
if (pageNumber === null)
|
|
throw new Error("The parameter 'pageNumber' cannot be null.");
|
|
else if (pageNumber !== undefined)
|
|
url_ += "pageNumber=" + encodeURIComponent("" + pageNumber) + "&";
|
|
if (pageSize === null)
|
|
throw new Error("The parameter 'pageSize' cannot be null.");
|
|
else if (pageSize !== undefined)
|
|
url_ += "pageSize=" + encodeURIComponent("" + pageSize) + "&";
|
|
if (name !== undefined && name !== null)
|
|
url_ += "name=" + encodeURIComponent("" + name) + "&";
|
|
if (ticker !== undefined && ticker !== null)
|
|
url_ += "ticker=" + encodeURIComponent("" + ticker) + "&";
|
|
if (agentName !== undefined && agentName !== null)
|
|
url_ += "agentName=" + encodeURIComponent("" + agentName) + "&";
|
|
if (sortBy === null)
|
|
throw new Error("The parameter 'sortBy' cannot be null.");
|
|
else if (sortBy !== undefined)
|
|
url_ += "sortBy=" + encodeURIComponent("" + sortBy) + "&";
|
|
if (sortDirection !== undefined && sortDirection !== null)
|
|
url_ += "sortDirection=" + encodeURIComponent("" + sortDirection) + "&";
|
|
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.processData_GetStrategiesPaginated(_response);
|
|
});
|
|
}
|
|
|
|
protected processData_GetStrategiesPaginated(response: Response): Promise<PaginatedResponseOfTradingBotResponse> {
|
|
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 PaginatedResponseOfTradingBotResponse;
|
|
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<PaginatedResponseOfTradingBotResponse>(null as any);
|
|
}
|
|
}
|
|
|
|
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<JobStatusResponse> {
|
|
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<JobStatusResponse> {
|
|
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 JobStatusResponse;
|
|
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<JobStatusResponse>(null as any);
|
|
}
|
|
|
|
job_DeleteJob(jobId: string): Promise<FileResponse> {
|
|
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: "DELETE",
|
|
headers: {
|
|
"Accept": "application/octet-stream"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processJob_DeleteJob(_response);
|
|
});
|
|
}
|
|
|
|
protected processJob_DeleteJob(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);
|
|
}
|
|
|
|
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);
|
|
}
|
|
|
|
job_RetryJob(jobId: string): Promise<FileResponse> {
|
|
let url_ = this.baseUrl + "/Job/{jobId}/retry";
|
|
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: "POST",
|
|
headers: {
|
|
"Accept": "application/octet-stream"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processJob_RetryJob(_response);
|
|
});
|
|
}
|
|
|
|
protected processJob_RetryJob(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);
|
|
}
|
|
}
|
|
|
|
export class MoneyManagementClient 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";
|
|
}
|
|
|
|
moneyManagement_PostMoneyManagement(moneyManagement: MoneyManagement): Promise<MoneyManagement> {
|
|
let url_ = this.baseUrl + "/MoneyManagement";
|
|
url_ = url_.replace(/[?&]$/, "");
|
|
|
|
const content_ = JSON.stringify(moneyManagement);
|
|
|
|
let options_: RequestInit = {
|
|
body: content_,
|
|
method: "POST",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
"Accept": "application/json"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processMoneyManagement_PostMoneyManagement(_response);
|
|
});
|
|
}
|
|
|
|
protected processMoneyManagement_PostMoneyManagement(response: Response): Promise<MoneyManagement> {
|
|
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 MoneyManagement;
|
|
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<MoneyManagement>(null as any);
|
|
}
|
|
|
|
moneyManagement_GetMoneyManagement(name: string | null | undefined): Promise<MoneyManagement> {
|
|
let url_ = this.baseUrl + "/MoneyManagement?";
|
|
if (name !== undefined && name !== null)
|
|
url_ += "name=" + encodeURIComponent("" + name) + "&";
|
|
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.processMoneyManagement_GetMoneyManagement(_response);
|
|
});
|
|
}
|
|
|
|
protected processMoneyManagement_GetMoneyManagement(response: Response): Promise<MoneyManagement> {
|
|
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 MoneyManagement;
|
|
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<MoneyManagement>(null as any);
|
|
}
|
|
|
|
moneyManagement_DeleteMoneyManagement(name: string | null | undefined): Promise<FileResponse> {
|
|
let url_ = this.baseUrl + "/MoneyManagement?";
|
|
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.processMoneyManagement_DeleteMoneyManagement(_response);
|
|
});
|
|
}
|
|
|
|
protected processMoneyManagement_DeleteMoneyManagement(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);
|
|
}
|
|
|
|
moneyManagement_GetMoneyManagements(): Promise<MoneyManagement[]> {
|
|
let url_ = this.baseUrl + "/MoneyManagement/moneymanagements";
|
|
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.processMoneyManagement_GetMoneyManagements(_response);
|
|
});
|
|
}
|
|
|
|
protected processMoneyManagement_GetMoneyManagements(response: Response): Promise<MoneyManagement[]> {
|
|
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 MoneyManagement[];
|
|
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<MoneyManagement[]>(null as any);
|
|
}
|
|
}
|
|
|
|
export class ScenarioClient 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";
|
|
}
|
|
|
|
scenario_GetScenarios(): Promise<ScenarioViewModel[]> {
|
|
let url_ = this.baseUrl + "/Scenario";
|
|
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.processScenario_GetScenarios(_response);
|
|
});
|
|
}
|
|
|
|
protected processScenario_GetScenarios(response: Response): Promise<ScenarioViewModel[]> {
|
|
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 ScenarioViewModel[];
|
|
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<ScenarioViewModel[]>(null as any);
|
|
}
|
|
|
|
scenario_CreateScenario(name: string | null | undefined, loopbackPeriod: number | null | undefined, strategies: string[]): Promise<ScenarioViewModel> {
|
|
let url_ = this.baseUrl + "/Scenario?";
|
|
if (name !== undefined && name !== null)
|
|
url_ += "name=" + encodeURIComponent("" + name) + "&";
|
|
if (loopbackPeriod !== undefined && loopbackPeriod !== null)
|
|
url_ += "loopbackPeriod=" + encodeURIComponent("" + loopbackPeriod) + "&";
|
|
url_ = url_.replace(/[?&]$/, "");
|
|
|
|
const content_ = JSON.stringify(strategies);
|
|
|
|
let options_: RequestInit = {
|
|
body: content_,
|
|
method: "POST",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
"Accept": "application/json"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processScenario_CreateScenario(_response);
|
|
});
|
|
}
|
|
|
|
protected processScenario_CreateScenario(response: Response): Promise<ScenarioViewModel> {
|
|
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 ScenarioViewModel;
|
|
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<ScenarioViewModel>(null as any);
|
|
}
|
|
|
|
scenario_DeleteScenario(name: string | null | undefined): Promise<FileResponse> {
|
|
let url_ = this.baseUrl + "/Scenario?";
|
|
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.processScenario_DeleteScenario(_response);
|
|
});
|
|
}
|
|
|
|
protected processScenario_DeleteScenario(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);
|
|
}
|
|
|
|
scenario_UpdateScenario(name: string | null | undefined, loopbackPeriod: number | null | undefined, strategies: string[]): Promise<FileResponse> {
|
|
let url_ = this.baseUrl + "/Scenario?";
|
|
if (name !== undefined && name !== null)
|
|
url_ += "name=" + encodeURIComponent("" + name) + "&";
|
|
if (loopbackPeriod !== undefined && loopbackPeriod !== null)
|
|
url_ += "loopbackPeriod=" + encodeURIComponent("" + loopbackPeriod) + "&";
|
|
url_ = url_.replace(/[?&]$/, "");
|
|
|
|
const content_ = JSON.stringify(strategies);
|
|
|
|
let options_: RequestInit = {
|
|
body: content_,
|
|
method: "PUT",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
"Accept": "application/octet-stream"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processScenario_UpdateScenario(_response);
|
|
});
|
|
}
|
|
|
|
protected processScenario_UpdateScenario(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);
|
|
}
|
|
|
|
scenario_GetIndicators(): Promise<IndicatorViewModel[]> {
|
|
let url_ = this.baseUrl + "/Scenario/indicator";
|
|
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.processScenario_GetIndicators(_response);
|
|
});
|
|
}
|
|
|
|
protected processScenario_GetIndicators(response: Response): Promise<IndicatorViewModel[]> {
|
|
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 IndicatorViewModel[];
|
|
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<IndicatorViewModel[]>(null as any);
|
|
}
|
|
|
|
scenario_CreateIndicator(indicatorType: IndicatorType | undefined, name: string | null | undefined, period: number | null | undefined, fastPeriods: number | null | undefined, slowPeriods: number | null | undefined, signalPeriods: number | null | undefined, multiplier: number | null | undefined, stochPeriods: number | null | undefined, smoothPeriods: number | null | undefined, cyclePeriods: number | null | undefined): Promise<IndicatorViewModel> {
|
|
let url_ = this.baseUrl + "/Scenario/indicator?";
|
|
if (indicatorType === null)
|
|
throw new Error("The parameter 'indicatorType' cannot be null.");
|
|
else if (indicatorType !== undefined)
|
|
url_ += "indicatorType=" + encodeURIComponent("" + indicatorType) + "&";
|
|
if (name !== undefined && name !== null)
|
|
url_ += "name=" + encodeURIComponent("" + name) + "&";
|
|
if (period !== undefined && period !== null)
|
|
url_ += "period=" + encodeURIComponent("" + period) + "&";
|
|
if (fastPeriods !== undefined && fastPeriods !== null)
|
|
url_ += "fastPeriods=" + encodeURIComponent("" + fastPeriods) + "&";
|
|
if (slowPeriods !== undefined && slowPeriods !== null)
|
|
url_ += "slowPeriods=" + encodeURIComponent("" + slowPeriods) + "&";
|
|
if (signalPeriods !== undefined && signalPeriods !== null)
|
|
url_ += "signalPeriods=" + encodeURIComponent("" + signalPeriods) + "&";
|
|
if (multiplier !== undefined && multiplier !== null)
|
|
url_ += "multiplier=" + encodeURIComponent("" + multiplier) + "&";
|
|
if (stochPeriods !== undefined && stochPeriods !== null)
|
|
url_ += "stochPeriods=" + encodeURIComponent("" + stochPeriods) + "&";
|
|
if (smoothPeriods !== undefined && smoothPeriods !== null)
|
|
url_ += "smoothPeriods=" + encodeURIComponent("" + smoothPeriods) + "&";
|
|
if (cyclePeriods !== undefined && cyclePeriods !== null)
|
|
url_ += "cyclePeriods=" + encodeURIComponent("" + cyclePeriods) + "&";
|
|
url_ = url_.replace(/[?&]$/, "");
|
|
|
|
let options_: RequestInit = {
|
|
method: "POST",
|
|
headers: {
|
|
"Accept": "application/json"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processScenario_CreateIndicator(_response);
|
|
});
|
|
}
|
|
|
|
protected processScenario_CreateIndicator(response: Response): Promise<IndicatorViewModel> {
|
|
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 IndicatorViewModel;
|
|
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<IndicatorViewModel>(null as any);
|
|
}
|
|
|
|
scenario_DeleteIndicator(name: string | null | undefined): Promise<FileResponse> {
|
|
let url_ = this.baseUrl + "/Scenario/indicator?";
|
|
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.processScenario_DeleteIndicator(_response);
|
|
});
|
|
}
|
|
|
|
protected processScenario_DeleteIndicator(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);
|
|
}
|
|
|
|
scenario_Updateindicator(indicatorType: IndicatorType | undefined, name: string | null | undefined, period: number | null | undefined, fastPeriods: number | null | undefined, slowPeriods: number | null | undefined, signalPeriods: number | null | undefined, multiplier: number | null | undefined, stochPeriods: number | null | undefined, smoothPeriods: number | null | undefined, cyclePeriods: number | null | undefined): Promise<FileResponse> {
|
|
let url_ = this.baseUrl + "/Scenario/indicator?";
|
|
if (indicatorType === null)
|
|
throw new Error("The parameter 'indicatorType' cannot be null.");
|
|
else if (indicatorType !== undefined)
|
|
url_ += "indicatorType=" + encodeURIComponent("" + indicatorType) + "&";
|
|
if (name !== undefined && name !== null)
|
|
url_ += "name=" + encodeURIComponent("" + name) + "&";
|
|
if (period !== undefined && period !== null)
|
|
url_ += "period=" + encodeURIComponent("" + period) + "&";
|
|
if (fastPeriods !== undefined && fastPeriods !== null)
|
|
url_ += "fastPeriods=" + encodeURIComponent("" + fastPeriods) + "&";
|
|
if (slowPeriods !== undefined && slowPeriods !== null)
|
|
url_ += "slowPeriods=" + encodeURIComponent("" + slowPeriods) + "&";
|
|
if (signalPeriods !== undefined && signalPeriods !== null)
|
|
url_ += "signalPeriods=" + encodeURIComponent("" + signalPeriods) + "&";
|
|
if (multiplier !== undefined && multiplier !== null)
|
|
url_ += "multiplier=" + encodeURIComponent("" + multiplier) + "&";
|
|
if (stochPeriods !== undefined && stochPeriods !== null)
|
|
url_ += "stochPeriods=" + encodeURIComponent("" + stochPeriods) + "&";
|
|
if (smoothPeriods !== undefined && smoothPeriods !== null)
|
|
url_ += "smoothPeriods=" + encodeURIComponent("" + smoothPeriods) + "&";
|
|
if (cyclePeriods !== undefined && cyclePeriods !== null)
|
|
url_ += "cyclePeriods=" + encodeURIComponent("" + cyclePeriods) + "&";
|
|
url_ = url_.replace(/[?&]$/, "");
|
|
|
|
let options_: RequestInit = {
|
|
method: "PUT",
|
|
headers: {
|
|
"Accept": "application/octet-stream"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processScenario_Updateindicator(_response);
|
|
});
|
|
}
|
|
|
|
protected processScenario_Updateindicator(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);
|
|
}
|
|
}
|
|
|
|
export class SentryTestClient 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";
|
|
}
|
|
|
|
sentryTest_TestException(): Promise<FileResponse> {
|
|
let url_ = this.baseUrl + "/api/SentryTest/test-exception";
|
|
url_ = url_.replace(/[?&]$/, "");
|
|
|
|
let options_: RequestInit = {
|
|
method: "GET",
|
|
headers: {
|
|
"Accept": "application/octet-stream"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processSentryTest_TestException(_response);
|
|
});
|
|
}
|
|
|
|
protected processSentryTest_TestException(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);
|
|
}
|
|
|
|
sentryTest_ThrowException(): Promise<FileResponse> {
|
|
let url_ = this.baseUrl + "/api/SentryTest/throw-exception";
|
|
url_ = url_.replace(/[?&]$/, "");
|
|
|
|
let options_: RequestInit = {
|
|
method: "GET",
|
|
headers: {
|
|
"Accept": "application/octet-stream"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processSentryTest_ThrowException(_response);
|
|
});
|
|
}
|
|
|
|
protected processSentryTest_ThrowException(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);
|
|
}
|
|
|
|
sentryTest_TestMessage(): Promise<FileResponse> {
|
|
let url_ = this.baseUrl + "/api/SentryTest/test-message";
|
|
url_ = url_.replace(/[?&]$/, "");
|
|
|
|
let options_: RequestInit = {
|
|
method: "GET",
|
|
headers: {
|
|
"Accept": "application/octet-stream"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processSentryTest_TestMessage(_response);
|
|
});
|
|
}
|
|
|
|
protected processSentryTest_TestMessage(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);
|
|
}
|
|
}
|
|
|
|
export class SettingsClient 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";
|
|
}
|
|
|
|
settings_SetupSettings(): Promise<boolean> {
|
|
let url_ = this.baseUrl + "/Settings";
|
|
url_ = url_.replace(/[?&]$/, "");
|
|
|
|
let options_: RequestInit = {
|
|
method: "POST",
|
|
headers: {
|
|
"Accept": "application/json"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processSettings_SetupSettings(_response);
|
|
});
|
|
}
|
|
|
|
protected processSettings_SetupSettings(response: Response): Promise<boolean> {
|
|
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 boolean;
|
|
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<boolean>(null as any);
|
|
}
|
|
|
|
settings_ResetSettings(): Promise<boolean> {
|
|
let url_ = this.baseUrl + "/Settings";
|
|
url_ = url_.replace(/[?&]$/, "");
|
|
|
|
let options_: RequestInit = {
|
|
method: "DELETE",
|
|
headers: {
|
|
"Accept": "application/json"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processSettings_ResetSettings(_response);
|
|
});
|
|
}
|
|
|
|
protected processSettings_ResetSettings(response: Response): Promise<boolean> {
|
|
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 boolean;
|
|
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<boolean>(null as any);
|
|
}
|
|
|
|
settings_CreateDefaultConfiguration(): Promise<boolean> {
|
|
let url_ = this.baseUrl + "/Settings/create-default-config";
|
|
url_ = url_.replace(/[?&]$/, "");
|
|
|
|
let options_: RequestInit = {
|
|
method: "POST",
|
|
headers: {
|
|
"Accept": "application/json"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processSettings_CreateDefaultConfiguration(_response);
|
|
});
|
|
}
|
|
|
|
protected processSettings_CreateDefaultConfiguration(response: Response): Promise<boolean> {
|
|
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 boolean;
|
|
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<boolean>(null as any);
|
|
}
|
|
}
|
|
|
|
export class SqlMonitoringClient 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";
|
|
}
|
|
|
|
sqlMonitoring_GetQueryStatistics(): Promise<FileResponse> {
|
|
let url_ = this.baseUrl + "/api/SqlMonitoring/statistics";
|
|
url_ = url_.replace(/[?&]$/, "");
|
|
|
|
let options_: RequestInit = {
|
|
method: "GET",
|
|
headers: {
|
|
"Accept": "application/octet-stream"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processSqlMonitoring_GetQueryStatistics(_response);
|
|
});
|
|
}
|
|
|
|
protected processSqlMonitoring_GetQueryStatistics(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);
|
|
}
|
|
|
|
sqlMonitoring_GetAlerts(): Promise<FileResponse> {
|
|
let url_ = this.baseUrl + "/api/SqlMonitoring/alerts";
|
|
url_ = url_.replace(/[?&]$/, "");
|
|
|
|
let options_: RequestInit = {
|
|
method: "GET",
|
|
headers: {
|
|
"Accept": "application/octet-stream"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processSqlMonitoring_GetAlerts(_response);
|
|
});
|
|
}
|
|
|
|
protected processSqlMonitoring_GetAlerts(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);
|
|
}
|
|
|
|
sqlMonitoring_ClearTracking(): Promise<FileResponse> {
|
|
let url_ = this.baseUrl + "/api/SqlMonitoring/clear-tracking";
|
|
url_ = url_.replace(/[?&]$/, "");
|
|
|
|
let options_: RequestInit = {
|
|
method: "POST",
|
|
headers: {
|
|
"Accept": "application/octet-stream"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processSqlMonitoring_ClearTracking(_response);
|
|
});
|
|
}
|
|
|
|
protected processSqlMonitoring_ClearTracking(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);
|
|
}
|
|
|
|
sqlMonitoring_GetQueryDetails(repositoryName: string, methodName: string): Promise<FileResponse> {
|
|
let url_ = this.baseUrl + "/api/SqlMonitoring/query-details/{repositoryName}/{methodName}";
|
|
if (repositoryName === undefined || repositoryName === null)
|
|
throw new Error("The parameter 'repositoryName' must be defined.");
|
|
url_ = url_.replace("{repositoryName}", encodeURIComponent("" + repositoryName));
|
|
if (methodName === undefined || methodName === null)
|
|
throw new Error("The parameter 'methodName' must be defined.");
|
|
url_ = url_.replace("{methodName}", encodeURIComponent("" + methodName));
|
|
url_ = url_.replace(/[?&]$/, "");
|
|
|
|
let options_: RequestInit = {
|
|
method: "GET",
|
|
headers: {
|
|
"Accept": "application/octet-stream"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processSqlMonitoring_GetQueryDetails(_response);
|
|
});
|
|
}
|
|
|
|
protected processSqlMonitoring_GetQueryDetails(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);
|
|
}
|
|
|
|
sqlMonitoring_GetMonitoringHealth(): Promise<FileResponse> {
|
|
let url_ = this.baseUrl + "/api/SqlMonitoring/health";
|
|
url_ = url_.replace(/[?&]$/, "");
|
|
|
|
let options_: RequestInit = {
|
|
method: "GET",
|
|
headers: {
|
|
"Accept": "application/octet-stream"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processSqlMonitoring_GetMonitoringHealth(_response);
|
|
});
|
|
}
|
|
|
|
protected processSqlMonitoring_GetMonitoringHealth(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);
|
|
}
|
|
}
|
|
|
|
export class TradingClient 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";
|
|
}
|
|
|
|
trading_GetTrade(accountName: string | null | undefined, ticker: Ticker | undefined, exchangeOrderId: string | null | undefined): Promise<Trade> {
|
|
let url_ = this.baseUrl + "/Trading/GetTrade?";
|
|
if (accountName !== undefined && accountName !== null)
|
|
url_ += "accountName=" + encodeURIComponent("" + accountName) + "&";
|
|
if (ticker === null)
|
|
throw new Error("The parameter 'ticker' cannot be null.");
|
|
else if (ticker !== undefined)
|
|
url_ += "ticker=" + encodeURIComponent("" + ticker) + "&";
|
|
if (exchangeOrderId !== undefined && exchangeOrderId !== null)
|
|
url_ += "exchangeOrderId=" + encodeURIComponent("" + exchangeOrderId) + "&";
|
|
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.processTrading_GetTrade(_response);
|
|
});
|
|
}
|
|
|
|
protected processTrading_GetTrade(response: Response): Promise<Trade> {
|
|
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 Trade;
|
|
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<Trade>(null as any);
|
|
}
|
|
|
|
trading_GetTrades(accountName: string | null | undefined, ticker: Ticker | undefined): Promise<Trade> {
|
|
let url_ = this.baseUrl + "/Trading/GetTrades?";
|
|
if (accountName !== undefined && accountName !== null)
|
|
url_ += "accountName=" + encodeURIComponent("" + accountName) + "&";
|
|
if (ticker === null)
|
|
throw new Error("The parameter 'ticker' cannot be null.");
|
|
else if (ticker !== undefined)
|
|
url_ += "ticker=" + encodeURIComponent("" + ticker) + "&";
|
|
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.processTrading_GetTrades(_response);
|
|
});
|
|
}
|
|
|
|
protected processTrading_GetTrades(response: Response): Promise<Trade> {
|
|
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 Trade;
|
|
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<Trade>(null as any);
|
|
}
|
|
|
|
trading_ClosePosition(identifier: string | undefined): Promise<Position> {
|
|
let url_ = this.baseUrl + "/Trading/ClosePosition?";
|
|
if (identifier === null)
|
|
throw new Error("The parameter 'identifier' cannot be null.");
|
|
else if (identifier !== undefined)
|
|
url_ += "identifier=" + encodeURIComponent("" + identifier) + "&";
|
|
url_ = url_.replace(/[?&]$/, "");
|
|
|
|
let options_: RequestInit = {
|
|
method: "POST",
|
|
headers: {
|
|
"Accept": "application/json"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processTrading_ClosePosition(_response);
|
|
});
|
|
}
|
|
|
|
protected processTrading_ClosePosition(response: Response): Promise<Position> {
|
|
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 Position;
|
|
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<Position>(null as any);
|
|
}
|
|
|
|
trading_Trade(accountName: string | null | undefined, moneyManagementName: string | null | undefined, direction: TradeDirection | undefined, ticker: Ticker | undefined, riskLevel: RiskLevel | undefined, isForPaperTrading: boolean | undefined, openPrice: number | null | undefined, moneyManagement: MoneyManagement | undefined): Promise<Position> {
|
|
let url_ = this.baseUrl + "/Trading/OpenPosition?";
|
|
if (accountName !== undefined && accountName !== null)
|
|
url_ += "accountName=" + encodeURIComponent("" + accountName) + "&";
|
|
if (moneyManagementName !== undefined && moneyManagementName !== null)
|
|
url_ += "moneyManagementName=" + encodeURIComponent("" + moneyManagementName) + "&";
|
|
if (direction === null)
|
|
throw new Error("The parameter 'direction' cannot be null.");
|
|
else if (direction !== undefined)
|
|
url_ += "direction=" + encodeURIComponent("" + direction) + "&";
|
|
if (ticker === null)
|
|
throw new Error("The parameter 'ticker' cannot be null.");
|
|
else if (ticker !== undefined)
|
|
url_ += "ticker=" + encodeURIComponent("" + ticker) + "&";
|
|
if (riskLevel === null)
|
|
throw new Error("The parameter 'riskLevel' cannot be null.");
|
|
else if (riskLevel !== undefined)
|
|
url_ += "riskLevel=" + encodeURIComponent("" + riskLevel) + "&";
|
|
if (isForPaperTrading === null)
|
|
throw new Error("The parameter 'isForPaperTrading' cannot be null.");
|
|
else if (isForPaperTrading !== undefined)
|
|
url_ += "isForPaperTrading=" + encodeURIComponent("" + isForPaperTrading) + "&";
|
|
if (openPrice !== undefined && openPrice !== null)
|
|
url_ += "openPrice=" + encodeURIComponent("" + openPrice) + "&";
|
|
url_ = url_.replace(/[?&]$/, "");
|
|
|
|
const content_ = JSON.stringify(moneyManagement);
|
|
|
|
let options_: RequestInit = {
|
|
body: content_,
|
|
method: "POST",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
"Accept": "application/json"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processTrading_Trade(_response);
|
|
});
|
|
}
|
|
|
|
protected processTrading_Trade(response: Response): Promise<Position> {
|
|
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 Position;
|
|
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<Position>(null as any);
|
|
}
|
|
|
|
trading_InitPrivyWallet(publicAddress: string): Promise<PrivyInitAddressResponse> {
|
|
let url_ = this.baseUrl + "/Trading/InitPrivyWallet";
|
|
url_ = url_.replace(/[?&]$/, "");
|
|
|
|
const content_ = JSON.stringify(publicAddress);
|
|
|
|
let options_: RequestInit = {
|
|
body: content_,
|
|
method: "POST",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
"Accept": "application/json"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processTrading_InitPrivyWallet(_response);
|
|
});
|
|
}
|
|
|
|
protected processTrading_InitPrivyWallet(response: Response): Promise<PrivyInitAddressResponse> {
|
|
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 PrivyInitAddressResponse;
|
|
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<PrivyInitAddressResponse>(null as any);
|
|
}
|
|
|
|
trading_RequestIndicator(request: IndicatorRequestDto): Promise<FileResponse> {
|
|
let url_ = this.baseUrl + "/Trading/RequestIndicator";
|
|
url_ = url_.replace(/[?&]$/, "");
|
|
|
|
const content_ = JSON.stringify(request);
|
|
|
|
let options_: RequestInit = {
|
|
body: content_,
|
|
method: "POST",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
"Accept": "application/octet-stream"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processTrading_RequestIndicator(_response);
|
|
});
|
|
}
|
|
|
|
protected processTrading_RequestIndicator(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);
|
|
}
|
|
}
|
|
|
|
export class UserClient 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";
|
|
}
|
|
|
|
user_CreateToken(login: LoginRequest): Promise<string> {
|
|
let url_ = this.baseUrl + "/User/create-token";
|
|
url_ = url_.replace(/[?&]$/, "");
|
|
|
|
const content_ = JSON.stringify(login);
|
|
|
|
let options_: RequestInit = {
|
|
body: content_,
|
|
method: "POST",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
"Accept": "application/json"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processUser_CreateToken(_response);
|
|
});
|
|
}
|
|
|
|
protected processUser_CreateToken(response: Response): Promise<string> {
|
|
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 string;
|
|
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<string>(null as any);
|
|
}
|
|
|
|
user_GetCurrentUser(): Promise<User> {
|
|
let url_ = this.baseUrl + "/User";
|
|
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.processUser_GetCurrentUser(_response);
|
|
});
|
|
}
|
|
|
|
protected processUser_GetCurrentUser(response: Response): Promise<User> {
|
|
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 User;
|
|
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<User>(null as any);
|
|
}
|
|
|
|
user_UpdateAgentName(agentName: string): Promise<User> {
|
|
let url_ = this.baseUrl + "/User/agent-name";
|
|
url_ = url_.replace(/[?&]$/, "");
|
|
|
|
const content_ = JSON.stringify(agentName);
|
|
|
|
let options_: RequestInit = {
|
|
body: content_,
|
|
method: "PUT",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
"Accept": "application/json"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processUser_UpdateAgentName(_response);
|
|
});
|
|
}
|
|
|
|
protected processUser_UpdateAgentName(response: Response): Promise<User> {
|
|
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 User;
|
|
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<User>(null as any);
|
|
}
|
|
|
|
user_UpdateAvatarUrl(avatarUrl: string): Promise<User> {
|
|
let url_ = this.baseUrl + "/User/avatar";
|
|
url_ = url_.replace(/[?&]$/, "");
|
|
|
|
const content_ = JSON.stringify(avatarUrl);
|
|
|
|
let options_: RequestInit = {
|
|
body: content_,
|
|
method: "PUT",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
"Accept": "application/json"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processUser_UpdateAvatarUrl(_response);
|
|
});
|
|
}
|
|
|
|
protected processUser_UpdateAvatarUrl(response: Response): Promise<User> {
|
|
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 User;
|
|
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<User>(null as any);
|
|
}
|
|
|
|
user_UpdateTelegramChannel(telegramChannel: string): Promise<User> {
|
|
let url_ = this.baseUrl + "/User/telegram-channel";
|
|
url_ = url_.replace(/[?&]$/, "");
|
|
|
|
const content_ = JSON.stringify(telegramChannel);
|
|
|
|
let options_: RequestInit = {
|
|
body: content_,
|
|
method: "PUT",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
"Accept": "application/json"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processUser_UpdateTelegramChannel(_response);
|
|
});
|
|
}
|
|
|
|
protected processUser_UpdateTelegramChannel(response: Response): Promise<User> {
|
|
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 User;
|
|
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<User>(null as any);
|
|
}
|
|
|
|
user_TestTelegramChannel(): Promise<string> {
|
|
let url_ = this.baseUrl + "/User/telegram-channel/test";
|
|
url_ = url_.replace(/[?&]$/, "");
|
|
|
|
let options_: RequestInit = {
|
|
method: "POST",
|
|
headers: {
|
|
"Accept": "application/json"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processUser_TestTelegramChannel(_response);
|
|
});
|
|
}
|
|
|
|
protected processUser_TestTelegramChannel(response: Response): Promise<string> {
|
|
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 string;
|
|
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<string>(null as any);
|
|
}
|
|
}
|
|
|
|
export class WhitelistClient 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";
|
|
}
|
|
|
|
whitelist_GetWhitelistAccounts(pageNumber: number | undefined, pageSize: number | undefined, searchExternalEthereumAccount: string | null | undefined, searchTwitterAccount: string | null | undefined): Promise<PaginatedWhitelistAccountsResponse> {
|
|
let url_ = this.baseUrl + "/Whitelist?";
|
|
if (pageNumber === null)
|
|
throw new Error("The parameter 'pageNumber' cannot be null.");
|
|
else if (pageNumber !== undefined)
|
|
url_ += "pageNumber=" + encodeURIComponent("" + pageNumber) + "&";
|
|
if (pageSize === null)
|
|
throw new Error("The parameter 'pageSize' cannot be null.");
|
|
else if (pageSize !== undefined)
|
|
url_ += "pageSize=" + encodeURIComponent("" + pageSize) + "&";
|
|
if (searchExternalEthereumAccount !== undefined && searchExternalEthereumAccount !== null)
|
|
url_ += "searchExternalEthereumAccount=" + encodeURIComponent("" + searchExternalEthereumAccount) + "&";
|
|
if (searchTwitterAccount !== undefined && searchTwitterAccount !== null)
|
|
url_ += "searchTwitterAccount=" + encodeURIComponent("" + searchTwitterAccount) + "&";
|
|
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.processWhitelist_GetWhitelistAccounts(_response);
|
|
});
|
|
}
|
|
|
|
protected processWhitelist_GetWhitelistAccounts(response: Response): Promise<PaginatedWhitelistAccountsResponse> {
|
|
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 PaginatedWhitelistAccountsResponse;
|
|
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<PaginatedWhitelistAccountsResponse>(null as any);
|
|
}
|
|
|
|
whitelist_SetWhitelisted(id: number): Promise<WhitelistAccount> {
|
|
let url_ = this.baseUrl + "/Whitelist/{id}/whitelist";
|
|
if (id === undefined || id === null)
|
|
throw new Error("The parameter 'id' must be defined.");
|
|
url_ = url_.replace("{id}", encodeURIComponent("" + id));
|
|
url_ = url_.replace(/[?&]$/, "");
|
|
|
|
let options_: RequestInit = {
|
|
method: "POST",
|
|
headers: {
|
|
"Accept": "application/json"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processWhitelist_SetWhitelisted(_response);
|
|
});
|
|
}
|
|
|
|
protected processWhitelist_SetWhitelisted(response: Response): Promise<WhitelistAccount> {
|
|
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 WhitelistAccount;
|
|
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<WhitelistAccount>(null as any);
|
|
}
|
|
|
|
whitelist_ProcessPrivyWebhook(webhook: PrivyWebhookDto): Promise<WhitelistAccount> {
|
|
let url_ = this.baseUrl + "/Whitelist/webhook";
|
|
url_ = url_.replace(/[?&]$/, "");
|
|
|
|
const content_ = JSON.stringify(webhook);
|
|
|
|
let options_: RequestInit = {
|
|
body: content_,
|
|
method: "POST",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
"Accept": "application/json"
|
|
}
|
|
};
|
|
|
|
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
return this.http.fetch(url_, transformedOptions_);
|
|
}).then((_response: Response) => {
|
|
return this.processWhitelist_ProcessPrivyWebhook(_response);
|
|
});
|
|
}
|
|
|
|
protected processWhitelist_ProcessPrivyWebhook(response: Response): Promise<WhitelistAccount> {
|
|
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 WhitelistAccount;
|
|
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<WhitelistAccount>(null as any);
|
|
}
|
|
}
|
|
|
|
export interface Account {
|
|
id?: number;
|
|
name: string;
|
|
exchange: TradingExchanges;
|
|
type: AccountType;
|
|
key?: string | null;
|
|
secret?: string | null;
|
|
user?: User | null;
|
|
balances?: Balance[] | null;
|
|
isGmxInitialized?: boolean;
|
|
isPrivyWallet?: boolean;
|
|
}
|
|
|
|
export enum TradingExchanges {
|
|
Binance = "Binance",
|
|
Kraken = "Kraken",
|
|
Ftx = "Ftx",
|
|
Evm = "Evm",
|
|
GmxV2 = "GmxV2",
|
|
}
|
|
|
|
export enum AccountType {
|
|
Cex = "Cex",
|
|
Trader = "Trader",
|
|
Watch = "Watch",
|
|
Auth = "Auth",
|
|
Privy = "Privy",
|
|
}
|
|
|
|
export interface User {
|
|
id?: number;
|
|
name?: string | null;
|
|
accounts?: Account[] | null;
|
|
agentName?: string | null;
|
|
avatarUrl?: string | null;
|
|
telegramChannel?: string | null;
|
|
ownerWalletAddress?: string | null;
|
|
isAdmin?: boolean;
|
|
lastConnectionDate?: Date | null;
|
|
}
|
|
|
|
export interface Balance {
|
|
tokenImage?: string | null;
|
|
tokenName?: string | null;
|
|
amount?: number;
|
|
price?: number;
|
|
value?: number;
|
|
tokenAdress?: string | null;
|
|
chain?: Chain | null;
|
|
}
|
|
|
|
export interface Chain {
|
|
id?: string | null;
|
|
rpcUrl?: string | null;
|
|
name?: string | null;
|
|
chainId?: number;
|
|
}
|
|
|
|
export interface GmxClaimableSummary {
|
|
claimableFundingFees?: FundingFeesData | null;
|
|
claimableUiFees?: UiFeesData | null;
|
|
rebateStats?: RebateStatsData | null;
|
|
}
|
|
|
|
export interface FundingFeesData {
|
|
totalUsdc?: number;
|
|
}
|
|
|
|
export interface UiFeesData {
|
|
totalUsdc?: number;
|
|
}
|
|
|
|
export interface RebateStatsData {
|
|
totalRebateUsdc?: number;
|
|
discountUsdc?: number;
|
|
rebateFactor?: number;
|
|
discountFactor?: number;
|
|
}
|
|
|
|
export interface SwapInfos {
|
|
success?: boolean;
|
|
hash?: string | null;
|
|
message?: string | null;
|
|
error?: string | null;
|
|
errorType?: string | null;
|
|
suggestion?: string | null;
|
|
}
|
|
|
|
export interface SwapTokensRequest {
|
|
fromTicker: Ticker;
|
|
toTicker: Ticker;
|
|
amount: number;
|
|
orderType?: string | null;
|
|
triggerRatio?: number | null;
|
|
allowedSlippage?: number;
|
|
}
|
|
|
|
export enum Ticker {
|
|
AAVE = "AAVE",
|
|
ADA = "ADA",
|
|
APE = "APE",
|
|
ALGO = "ALGO",
|
|
ARB = "ARB",
|
|
ATOM = "ATOM",
|
|
AVAX = "AVAX",
|
|
BNB = "BNB",
|
|
BTC = "BTC",
|
|
BAL = "BAL",
|
|
CHZ = "CHZ",
|
|
COMP = "COMP",
|
|
CRO = "CRO",
|
|
CRV = "CRV",
|
|
DOGE = "DOGE",
|
|
DOT = "DOT",
|
|
DYDX = "DYDX",
|
|
ENS = "ENS",
|
|
ETC = "ETC",
|
|
ETH = "ETH",
|
|
FIL = "FIL",
|
|
FLM = "FLM",
|
|
FTM = "FTM",
|
|
GALA = "GALA",
|
|
GMX = "GMX",
|
|
GRT = "GRT",
|
|
IMX = "IMX",
|
|
JASMY = "JASMY",
|
|
KSM = "KSM",
|
|
LDO = "LDO",
|
|
LINK = "LINK",
|
|
LRC = "LRC",
|
|
LTC = "LTC",
|
|
MANA = "MANA",
|
|
MATIC = "MATIC",
|
|
MKR = "MKR",
|
|
NEAR = "NEAR",
|
|
OP = "OP",
|
|
PEPE = "PEPE",
|
|
QTUM = "QTUM",
|
|
REN = "REN",
|
|
ROSE = "ROSE",
|
|
RSR = "RSR",
|
|
RUNE = "RUNE",
|
|
SAND = "SAND",
|
|
SOL = "SOL",
|
|
SRM = "SRM",
|
|
SUSHI = "SUSHI",
|
|
THETA = "THETA",
|
|
UNI = "UNI",
|
|
USDC = "USDC",
|
|
USDT = "USDT",
|
|
WIF = "WIF",
|
|
XMR = "XMR",
|
|
XRP = "XRP",
|
|
XTZ = "XTZ",
|
|
SHIB = "SHIB",
|
|
STX = "STX",
|
|
ORDI = "ORDI",
|
|
APT = "APT",
|
|
BOME = "BOME",
|
|
MEME = "MEME",
|
|
FLOKI = "FLOKI",
|
|
MEW = "MEW",
|
|
TAO = "TAO",
|
|
BONK = "BONK",
|
|
WLD = "WLD",
|
|
TBTC = "tBTC",
|
|
WBTC_b = "WBTC_b",
|
|
EIGEN = "EIGEN",
|
|
SUI = "SUI",
|
|
SEI = "SEI",
|
|
USDC_e = "USDC_e",
|
|
DAI = "DAI",
|
|
TIA = "TIA",
|
|
TRX = "TRX",
|
|
TON = "TON",
|
|
PENDLE = "PENDLE",
|
|
WstETH = "wstETH",
|
|
USDe = "USDe",
|
|
SATS = "SATS",
|
|
POL = "POL",
|
|
XLM = "XLM",
|
|
BCH = "BCH",
|
|
ICP = "ICP",
|
|
RENDER = "RENDER",
|
|
INJ = "INJ",
|
|
TRUMP = "TRUMP",
|
|
MELANIA = "MELANIA",
|
|
ENA = "ENA",
|
|
FARTCOIN = "FARTCOIN",
|
|
AI16Z = "AI16Z",
|
|
ANIME = "ANIME",
|
|
BERA = "BERA",
|
|
VIRTUAL = "VIRTUAL",
|
|
PENGU = "PENGU",
|
|
ONDO = "ONDO",
|
|
FET = "FET",
|
|
AIXBT = "AIXBT",
|
|
CAKE = "CAKE",
|
|
S = "S",
|
|
JUP = "JUP",
|
|
HYPE = "HYPE",
|
|
OM = "OM",
|
|
DOLO = "DOLO",
|
|
Unknown = "Unknown",
|
|
}
|
|
|
|
export interface SendTokenRequest {
|
|
recipientAddress: string;
|
|
ticker: Ticker;
|
|
amount: number;
|
|
chainId?: number | null;
|
|
}
|
|
|
|
export interface ExchangeInitializedStatus {
|
|
exchange?: TradingExchanges;
|
|
isInitialized?: boolean;
|
|
}
|
|
|
|
export interface PaginatedBundleBacktestRequestsResponse {
|
|
bundleRequests?: BundleBacktestRequestListItemResponse[];
|
|
totalCount?: number;
|
|
currentPage?: number;
|
|
pageSize?: number;
|
|
totalPages?: number;
|
|
hasNextPage?: boolean;
|
|
hasPreviousPage?: boolean;
|
|
}
|
|
|
|
export interface BundleBacktestRequestListItemResponse {
|
|
requestId?: string;
|
|
name?: string;
|
|
version?: number;
|
|
status?: string;
|
|
createdAt?: Date;
|
|
completedAt?: Date | null;
|
|
updatedAt?: Date;
|
|
totalBacktests?: number;
|
|
completedBacktests?: number;
|
|
failedBacktests?: number;
|
|
progressPercentage?: number;
|
|
userId?: number | null;
|
|
userName?: string | null;
|
|
errorMessage?: string | null;
|
|
currentBacktest?: string | null;
|
|
estimatedTimeRemainingSeconds?: number | null;
|
|
}
|
|
|
|
export enum BundleBacktestRequestSortableColumn {
|
|
RequestId = "RequestId",
|
|
Name = "Name",
|
|
Status = "Status",
|
|
CreatedAt = "CreatedAt",
|
|
CompletedAt = "CompletedAt",
|
|
TotalBacktests = "TotalBacktests",
|
|
CompletedBacktests = "CompletedBacktests",
|
|
FailedBacktests = "FailedBacktests",
|
|
ProgressPercentage = "ProgressPercentage",
|
|
UserId = "UserId",
|
|
UserName = "UserName",
|
|
UpdatedAt = "UpdatedAt",
|
|
}
|
|
|
|
export enum BundleBacktestRequestStatus {
|
|
Pending = "Pending",
|
|
Running = "Running",
|
|
Completed = "Completed",
|
|
Failed = "Failed",
|
|
Cancelled = "Cancelled",
|
|
Saved = "Saved",
|
|
}
|
|
|
|
export interface BundleBacktestRequestSummaryResponse {
|
|
statusSummary?: BundleBacktestRequestStatusSummary[];
|
|
totalRequests?: number;
|
|
}
|
|
|
|
export interface BundleBacktestRequestStatusSummary {
|
|
status?: string;
|
|
count?: number;
|
|
}
|
|
|
|
export interface PaginatedUsersResponse {
|
|
users?: UserListItemResponse[];
|
|
totalCount?: number;
|
|
currentPage?: number;
|
|
pageSize?: number;
|
|
totalPages?: number;
|
|
hasNextPage?: boolean;
|
|
hasPreviousPage?: boolean;
|
|
}
|
|
|
|
export interface UserListItemResponse {
|
|
id?: number;
|
|
name?: string;
|
|
agentName?: string;
|
|
avatarUrl?: string;
|
|
telegramChannel?: string;
|
|
ownerWalletAddress?: string;
|
|
isAdmin?: boolean;
|
|
lastConnectionDate?: Date | null;
|
|
}
|
|
|
|
export enum UserSortableColumn {
|
|
Id = "Id",
|
|
Name = "Name",
|
|
OwnerWalletAddress = "OwnerWalletAddress",
|
|
AgentName = "AgentName",
|
|
}
|
|
|
|
export interface Backtest {
|
|
id: string;
|
|
finalPnl: number;
|
|
winRate: number;
|
|
growthPercentage: number;
|
|
hodlPercentage: number;
|
|
config: TradingBotConfig;
|
|
positions: { [key: string]: Position; };
|
|
signals: { [key: string]: LightSignal; };
|
|
startDate: Date;
|
|
endDate: Date;
|
|
statistics: PerformanceMetrics;
|
|
fees: number;
|
|
user: User;
|
|
score: number;
|
|
requestId?: string;
|
|
metadata?: any | null;
|
|
scoreMessage?: string;
|
|
initialBalance: number;
|
|
netPnl: number;
|
|
positionCount: number;
|
|
}
|
|
|
|
export interface TradingBotConfig {
|
|
accountName: string;
|
|
moneyManagement: LightMoneyManagement;
|
|
ticker: Ticker;
|
|
timeframe: Timeframe;
|
|
isForWatchingOnly: boolean;
|
|
botTradingBalance: number;
|
|
isForBacktest: boolean;
|
|
cooldownPeriod: number;
|
|
maxLossStreak: number;
|
|
flipPosition: boolean;
|
|
name: string;
|
|
riskManagement?: RiskManagement | null;
|
|
scenario?: LightScenario | null;
|
|
scenarioName?: string | null;
|
|
maxPositionTimeHours?: number | null;
|
|
closeEarlyWhenProfitable?: boolean;
|
|
flipOnlyWhenInProfit: boolean;
|
|
useSynthApi?: boolean;
|
|
useForPositionSizing?: boolean;
|
|
useForSignalFiltering?: boolean;
|
|
useForDynamicStopLoss?: boolean;
|
|
isForCopyTrading?: boolean;
|
|
masterBotIdentifier?: string | null;
|
|
masterBotUserId?: number | null;
|
|
}
|
|
|
|
export interface LightMoneyManagement {
|
|
name: string;
|
|
timeframe: Timeframe;
|
|
stopLoss: number;
|
|
takeProfit: number;
|
|
leverage: number;
|
|
}
|
|
|
|
export enum Timeframe {
|
|
FiveMinutes = "FiveMinutes",
|
|
FifteenMinutes = "FifteenMinutes",
|
|
ThirtyMinutes = "ThirtyMinutes",
|
|
OneHour = "OneHour",
|
|
FourHour = "FourHour",
|
|
OneDay = "OneDay",
|
|
OneMinute = "OneMinute",
|
|
}
|
|
|
|
export interface RiskManagement {
|
|
adverseProbabilityThreshold: number;
|
|
favorableProbabilityThreshold: number;
|
|
riskAversion: number;
|
|
kellyMinimumThreshold: number;
|
|
kellyMaximumCap: number;
|
|
maxLiquidationProbability: number;
|
|
signalValidationTimeHorizonHours: number;
|
|
positionMonitoringTimeHorizonHours: number;
|
|
positionWarningThreshold: number;
|
|
positionAutoCloseThreshold: number;
|
|
kellyFractionalMultiplier: number;
|
|
riskTolerance: RiskToleranceLevel;
|
|
useExpectedUtility: boolean;
|
|
useKellyCriterion: boolean;
|
|
}
|
|
|
|
export enum RiskToleranceLevel {
|
|
Conservative = "Conservative",
|
|
Moderate = "Moderate",
|
|
Aggressive = "Aggressive",
|
|
}
|
|
|
|
export interface LightScenario {
|
|
name?: string | null;
|
|
indicators?: LightIndicator[] | null;
|
|
loopbackPeriod?: number | null;
|
|
}
|
|
|
|
export interface LightIndicator {
|
|
name?: string | null;
|
|
type?: IndicatorType;
|
|
signalType?: SignalType;
|
|
minimumHistory?: number;
|
|
period?: number | null;
|
|
fastPeriods?: number | null;
|
|
slowPeriods?: number | null;
|
|
signalPeriods?: number | null;
|
|
multiplier?: number | null;
|
|
smoothPeriods?: number | null;
|
|
stochPeriods?: number | null;
|
|
cyclePeriods?: number | null;
|
|
kFactor?: number | null;
|
|
dFactor?: number | null;
|
|
tenkanPeriods?: number | null;
|
|
kijunPeriods?: number | null;
|
|
senkouBPeriods?: number | null;
|
|
offsetPeriods?: number | null;
|
|
senkouOffset?: number | null;
|
|
chikouOffset?: number | null;
|
|
}
|
|
|
|
export enum IndicatorType {
|
|
RsiDivergence = "RsiDivergence",
|
|
RsiDivergenceConfirm = "RsiDivergenceConfirm",
|
|
MacdCross = "MacdCross",
|
|
EmaCross = "EmaCross",
|
|
ThreeWhiteSoldiers = "ThreeWhiteSoldiers",
|
|
SuperTrend = "SuperTrend",
|
|
ChandelierExit = "ChandelierExit",
|
|
EmaTrend = "EmaTrend",
|
|
Composite = "Composite",
|
|
StochRsiTrend = "StochRsiTrend",
|
|
StochasticCross = "StochasticCross",
|
|
Stc = "Stc",
|
|
StDev = "StDev",
|
|
LaggingStc = "LaggingStc",
|
|
SuperTrendCrossEma = "SuperTrendCrossEma",
|
|
DualEmaCross = "DualEmaCross",
|
|
BollingerBandsPercentBMomentumBreakout = "BollingerBandsPercentBMomentumBreakout",
|
|
IchimokuKumoTrend = "IchimokuKumoTrend",
|
|
}
|
|
|
|
export enum SignalType {
|
|
Signal = "Signal",
|
|
Trend = "Trend",
|
|
Context = "Context",
|
|
}
|
|
|
|
export interface Position {
|
|
date: Date;
|
|
accountId: number;
|
|
originDirection: TradeDirection;
|
|
ticker: Ticker;
|
|
moneyManagement: LightMoneyManagement;
|
|
Open: Trade;
|
|
StopLoss: Trade;
|
|
TakeProfit1: Trade;
|
|
TakeProfit2?: Trade | null;
|
|
ProfitAndLoss?: ProfitAndLoss | null;
|
|
uiFees?: number;
|
|
gasFees?: number;
|
|
status: PositionStatus;
|
|
signalIdentifier?: string | null;
|
|
identifier: string;
|
|
initiator: PositionInitiator;
|
|
user: User;
|
|
initiatorIdentifier: string;
|
|
recoveryAttempted?: boolean;
|
|
}
|
|
|
|
export enum TradeDirection {
|
|
None = "None",
|
|
Short = "Short",
|
|
Long = "Long",
|
|
}
|
|
|
|
export interface Trade {
|
|
fee: number;
|
|
date: Date;
|
|
direction: TradeDirection;
|
|
status: TradeStatus;
|
|
tradeType: TradeType;
|
|
ticker: Ticker;
|
|
quantity: number;
|
|
price: number;
|
|
leverage: number;
|
|
exchangeOrderId: string;
|
|
message: string;
|
|
}
|
|
|
|
export enum TradeStatus {
|
|
PendingOpen = "PendingOpen",
|
|
Requested = "Requested",
|
|
Cancelled = "Cancelled",
|
|
Filled = "Filled",
|
|
}
|
|
|
|
export enum TradeType {
|
|
Limit = "Limit",
|
|
Market = "Market",
|
|
StopMarket = "StopMarket",
|
|
StopLimit = "StopLimit",
|
|
StopLoss = "StopLoss",
|
|
TakeProfit = "TakeProfit",
|
|
StopLossProfit = "StopLossProfit",
|
|
StopLossProfitLimit = "StopLossProfitLimit",
|
|
StopLossLimit = "StopLossLimit",
|
|
TakeProfitLimit = "TakeProfitLimit",
|
|
TrailingStop = "TrailingStop",
|
|
TrailingStopLimit = "TrailingStopLimit",
|
|
StopLossAndLimit = "StopLossAndLimit",
|
|
SettlePosition = "SettlePosition",
|
|
}
|
|
|
|
export interface ProfitAndLoss {
|
|
realized?: number;
|
|
net?: number;
|
|
averageOpenPrice?: number;
|
|
}
|
|
|
|
export enum PositionStatus {
|
|
New = "New",
|
|
Canceled = "Canceled",
|
|
Rejected = "Rejected",
|
|
Updating = "Updating",
|
|
Filled = "Filled",
|
|
Flipped = "Flipped",
|
|
Finished = "Finished",
|
|
}
|
|
|
|
export enum PositionInitiator {
|
|
PaperTrading = "PaperTrading",
|
|
Bot = "Bot",
|
|
User = "User",
|
|
CopyTrading = "CopyTrading",
|
|
}
|
|
|
|
export interface LightSignal {
|
|
status: SignalStatus;
|
|
direction: TradeDirection;
|
|
confidence: Confidence;
|
|
timeframe: Timeframe;
|
|
date: Date;
|
|
candle: Candle;
|
|
identifier: string;
|
|
ticker: Ticker;
|
|
exchange: TradingExchanges;
|
|
indicatorType: IndicatorType;
|
|
signalType: SignalType;
|
|
indicatorName: string;
|
|
}
|
|
|
|
export enum SignalStatus {
|
|
WaitingForPosition = "WaitingForPosition",
|
|
PositionOpen = "PositionOpen",
|
|
Expired = "Expired",
|
|
}
|
|
|
|
export enum Confidence {
|
|
Low = "Low",
|
|
Medium = "Medium",
|
|
High = "High",
|
|
None = "None",
|
|
}
|
|
|
|
export interface Candle {
|
|
exchange: TradingExchanges;
|
|
ticker: Ticker;
|
|
openTime: Date;
|
|
date: Date;
|
|
open: number;
|
|
close: number;
|
|
high: number;
|
|
low: number;
|
|
timeframe: Timeframe;
|
|
volume?: number;
|
|
}
|
|
|
|
export interface PerformanceMetrics {
|
|
count?: number;
|
|
sharpeRatio?: number;
|
|
maxDrawdown?: number;
|
|
maxDrawdownPc?: number;
|
|
maxDrawdownRecoveryTime?: string;
|
|
winningTrades?: number;
|
|
loosingTrades?: number;
|
|
totalPnL?: number;
|
|
}
|
|
|
|
export interface DeleteBacktestsRequest {
|
|
backtestIds: string[];
|
|
}
|
|
|
|
export interface LightBacktestResponse {
|
|
id: string;
|
|
config: TradingBotConfig;
|
|
finalPnl: number;
|
|
winRate: number;
|
|
growthPercentage: number;
|
|
hodlPercentage: number;
|
|
startDate: Date;
|
|
endDate: Date;
|
|
maxDrawdown: number;
|
|
fees: number;
|
|
sharpeRatio: number;
|
|
score: number;
|
|
scoreMessage: string;
|
|
initialBalance: number;
|
|
netPnl: number;
|
|
positionCount: number;
|
|
}
|
|
|
|
export interface PaginatedBacktestsResponse {
|
|
backtests?: LightBacktestResponse[] | null;
|
|
totalCount?: number;
|
|
currentPage?: number;
|
|
pageSize?: number;
|
|
totalPages?: number;
|
|
hasNextPage?: boolean;
|
|
hasPreviousPage?: boolean;
|
|
}
|
|
|
|
export enum BacktestSortableColumn {
|
|
Score = "Score",
|
|
FinalPnl = "FinalPnl",
|
|
NetPnl = "NetPnl",
|
|
WinRate = "WinRate",
|
|
GrowthPercentage = "GrowthPercentage",
|
|
HodlPercentage = "HodlPercentage",
|
|
Duration = "Duration",
|
|
Timeframe = "Timeframe",
|
|
IndicatorsCount = "IndicatorsCount",
|
|
MaxDrawdown = "MaxDrawdown",
|
|
Fees = "Fees",
|
|
SharpeRatio = "SharpeRatio",
|
|
Ticker = "Ticker",
|
|
Name = "Name",
|
|
}
|
|
|
|
export interface LightBacktest {
|
|
id?: string | null;
|
|
config?: TradingBotConfig | null;
|
|
finalPnl?: number;
|
|
winRate?: number;
|
|
growthPercentage?: number;
|
|
hodlPercentage?: number;
|
|
startDate?: Date;
|
|
endDate?: Date;
|
|
maxDrawdown?: number | null;
|
|
fees?: number;
|
|
sharpeRatio?: number | null;
|
|
score?: number;
|
|
scoreMessage?: string | null;
|
|
metadata?: any | null;
|
|
ticker?: string | null;
|
|
initialBalance?: number;
|
|
netPnl?: number;
|
|
positionCount?: number;
|
|
}
|
|
|
|
export interface RunBacktestRequest {
|
|
config?: TradingBotConfigRequest | null;
|
|
startDate?: Date;
|
|
endDate?: Date;
|
|
balance?: number;
|
|
watchOnly?: boolean;
|
|
save?: boolean;
|
|
withCandles?: boolean;
|
|
moneyManagementName?: string | null;
|
|
moneyManagement?: MoneyManagement | null;
|
|
}
|
|
|
|
export interface TradingBotConfigRequest {
|
|
accountName?: string | null;
|
|
ticker: Ticker;
|
|
timeframe: Timeframe;
|
|
isForWatchingOnly: boolean;
|
|
botTradingBalance: number;
|
|
name: string;
|
|
flipPosition: boolean;
|
|
cooldownPeriod?: number | null;
|
|
maxLossStreak?: number;
|
|
scenario?: ScenarioRequest | null;
|
|
scenarioName?: string | null;
|
|
moneyManagementName?: string | null;
|
|
moneyManagement?: MoneyManagementRequest | null;
|
|
maxPositionTimeHours?: number | null;
|
|
closeEarlyWhenProfitable?: boolean;
|
|
flipOnlyWhenInProfit?: boolean;
|
|
useSynthApi?: boolean;
|
|
useForPositionSizing?: boolean;
|
|
useForSignalFiltering?: boolean;
|
|
useForDynamicStopLoss?: boolean;
|
|
}
|
|
|
|
export interface ScenarioRequest {
|
|
name: string;
|
|
indicators: IndicatorRequest[];
|
|
loopbackPeriod?: number | null;
|
|
}
|
|
|
|
export interface IndicatorRequest {
|
|
name: string;
|
|
type: IndicatorType;
|
|
signalType: SignalType;
|
|
minimumHistory?: number;
|
|
period?: number | null;
|
|
fastPeriods?: number | null;
|
|
slowPeriods?: number | null;
|
|
signalPeriods?: number | null;
|
|
multiplier?: number | null;
|
|
smoothPeriods?: number | null;
|
|
stochPeriods?: number | null;
|
|
cyclePeriods?: number | null;
|
|
}
|
|
|
|
export interface MoneyManagementRequest {
|
|
name: string;
|
|
timeframe: Timeframe;
|
|
stopLoss: number;
|
|
takeProfit: number;
|
|
leverage: number;
|
|
}
|
|
|
|
export interface MoneyManagement extends LightMoneyManagement {
|
|
user?: User | null;
|
|
}
|
|
|
|
export interface BundleBacktestRequest {
|
|
requestId: string;
|
|
user: User;
|
|
createdAt: Date;
|
|
completedAt?: Date | null;
|
|
status: BundleBacktestRequestStatus;
|
|
name: string;
|
|
version: number;
|
|
universalConfigJson: string;
|
|
dateTimeRangesJson: string;
|
|
moneyManagementVariantsJson: string;
|
|
tickerVariantsJson: string;
|
|
results?: string[];
|
|
totalBacktests: number;
|
|
completedBacktests: number;
|
|
failedBacktests: number;
|
|
progressPercentage?: number;
|
|
errorMessage?: string | null;
|
|
progressInfo?: string | null;
|
|
currentBacktest?: string | null;
|
|
estimatedTimeRemainingSeconds?: number | null;
|
|
updatedAt: Date;
|
|
}
|
|
|
|
export interface RunBundleBacktestRequest {
|
|
name: string;
|
|
universalConfig: BundleBacktestUniversalConfig;
|
|
dateTimeRanges: DateTimeRange[];
|
|
moneyManagementVariants: MoneyManagementVariant[];
|
|
tickerVariants: Ticker[];
|
|
saveAsTemplate: boolean;
|
|
}
|
|
|
|
export interface BundleBacktestUniversalConfig {
|
|
timeframe: Timeframe;
|
|
isForWatchingOnly: boolean;
|
|
botTradingBalance: number;
|
|
botName: string;
|
|
flipPosition: boolean;
|
|
cooldownPeriod?: number | null;
|
|
maxLossStreak?: number;
|
|
scenario?: ScenarioRequest | null;
|
|
scenarioName?: string | null;
|
|
maxPositionTimeHours?: number | null;
|
|
closeEarlyWhenProfitable?: boolean;
|
|
flipOnlyWhenInProfit?: boolean;
|
|
useSynthApi?: boolean;
|
|
useForPositionSizing?: boolean;
|
|
useForSignalFiltering?: boolean;
|
|
useForDynamicStopLoss?: boolean;
|
|
watchOnly?: boolean;
|
|
save?: boolean;
|
|
withCandles?: boolean;
|
|
}
|
|
|
|
export interface DateTimeRange {
|
|
startDate: Date;
|
|
endDate: Date;
|
|
}
|
|
|
|
export interface MoneyManagementVariant {
|
|
moneyManagement?: MoneyManagementRequest;
|
|
}
|
|
|
|
export interface BundleBacktestRequestViewModel {
|
|
requestId: string;
|
|
createdAt: Date;
|
|
completedAt?: Date | null;
|
|
status: BundleBacktestRequestStatus;
|
|
name: string;
|
|
version: number;
|
|
universalConfig: BundleBacktestUniversalConfig;
|
|
dateTimeRanges: DateTimeRange[];
|
|
moneyManagementVariants: MoneyManagementVariant[];
|
|
tickerVariants: Ticker[];
|
|
results?: string[];
|
|
totalBacktests: number;
|
|
completedBacktests: number;
|
|
failedBacktests: number;
|
|
progressPercentage?: number;
|
|
errorMessage?: string | null;
|
|
progressInfo?: string | null;
|
|
currentBacktest?: string | null;
|
|
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;
|
|
createdAt: Date;
|
|
completedAt?: Date | null;
|
|
status: GeneticRequestStatus;
|
|
ticker: Ticker;
|
|
timeframe: Timeframe;
|
|
startDate: Date;
|
|
endDate: Date;
|
|
balance: number;
|
|
populationSize: number;
|
|
generations: number;
|
|
mutationRate: number;
|
|
selectionMethod: GeneticSelectionMethod;
|
|
crossoverMethod: GeneticCrossoverMethod;
|
|
mutationMethod: GeneticMutationMethod;
|
|
elitismPercentage: number;
|
|
maxTakeProfit: number;
|
|
eligibleIndicators: IndicatorType[];
|
|
results?: Backtest[] | null;
|
|
bestFitness?: number | null;
|
|
bestIndividual?: string | null;
|
|
errorMessage?: string | null;
|
|
progressInfo?: string | null;
|
|
bestChromosome?: string | null;
|
|
currentGeneration?: number;
|
|
bestFitnessSoFar?: number | null;
|
|
}
|
|
|
|
export enum GeneticRequestStatus {
|
|
Pending = "Pending",
|
|
Running = "Running",
|
|
Completed = "Completed",
|
|
Failed = "Failed",
|
|
Cancelled = "Cancelled",
|
|
}
|
|
|
|
export enum GeneticSelectionMethod {
|
|
Elite = "Elite",
|
|
Roulette = "Roulette",
|
|
StochasticUniversalSampling = "StochasticUniversalSampling",
|
|
Tournament = "Tournament",
|
|
Truncation = "Truncation",
|
|
}
|
|
|
|
export enum GeneticCrossoverMethod {
|
|
AlternatingPosition = "AlternatingPosition",
|
|
CutAndSplice = "CutAndSplice",
|
|
Cycle = "Cycle",
|
|
OnePoint = "OnePoint",
|
|
OrderBased = "OrderBased",
|
|
Ordered = "Ordered",
|
|
PartiallyMapped = "PartiallyMapped",
|
|
PositionBased = "PositionBased",
|
|
ThreeParent = "ThreeParent",
|
|
TwoPoint = "TwoPoint",
|
|
Uniform = "Uniform",
|
|
VotingRecombination = "VotingRecombination",
|
|
}
|
|
|
|
export enum GeneticMutationMethod {
|
|
Displacement = "Displacement",
|
|
FlipBit = "FlipBit",
|
|
Insertion = "Insertion",
|
|
PartialShuffle = "PartialShuffle",
|
|
ReverseSequence = "ReverseSequence",
|
|
Twors = "Twors",
|
|
Uniform = "Uniform",
|
|
}
|
|
|
|
export interface RunGeneticRequest {
|
|
ticker?: Ticker;
|
|
timeframe?: Timeframe;
|
|
startDate?: Date;
|
|
endDate?: Date;
|
|
balance?: number;
|
|
populationSize?: number;
|
|
generations?: number;
|
|
mutationRate?: number;
|
|
selectionMethod?: GeneticSelectionMethod;
|
|
crossoverMethod?: GeneticCrossoverMethod;
|
|
mutationMethod?: GeneticMutationMethod;
|
|
elitismPercentage?: number;
|
|
maxTakeProfit?: number;
|
|
eligibleIndicators?: IndicatorType[] | null;
|
|
}
|
|
|
|
export interface StartBotRequest {
|
|
config?: TradingBotConfigRequest | null;
|
|
}
|
|
|
|
export interface StartCopyTradingRequest {
|
|
masterBotIdentifier?: string;
|
|
botTradingBalance?: number;
|
|
}
|
|
|
|
export interface SaveBotRequest extends StartBotRequest {
|
|
}
|
|
|
|
export enum BotStatus {
|
|
Saved = "Saved",
|
|
Stopped = "Stopped",
|
|
Running = "Running",
|
|
}
|
|
|
|
export interface TradingBotResponse {
|
|
status: string;
|
|
signals: { [key: string]: LightSignal; };
|
|
positions: { [key: string]: Position; };
|
|
candles: Candle[];
|
|
winRate: number;
|
|
profitAndLoss: number;
|
|
roi: number;
|
|
identifier: string;
|
|
agentName: string;
|
|
createDate: Date;
|
|
startupTime: Date;
|
|
name: string;
|
|
ticker: Ticker;
|
|
masterAgentName?: string | null;
|
|
}
|
|
|
|
export interface PaginatedResponseOfTradingBotResponse {
|
|
items?: TradingBotResponse[] | null;
|
|
totalCount?: number;
|
|
pageNumber?: number;
|
|
pageSize?: number;
|
|
totalPages?: number;
|
|
hasPreviousPage?: boolean;
|
|
hasNextPage?: boolean;
|
|
}
|
|
|
|
export enum BotSortableColumn {
|
|
CreateDate = "CreateDate",
|
|
Name = "Name",
|
|
Ticker = "Ticker",
|
|
Status = "Status",
|
|
StartupTime = "StartupTime",
|
|
Roi = "Roi",
|
|
Pnl = "Pnl",
|
|
WinRate = "WinRate",
|
|
AgentName = "AgentName",
|
|
}
|
|
|
|
export interface CreateManualSignalRequest {
|
|
identifier?: string;
|
|
direction?: TradeDirection;
|
|
}
|
|
|
|
export interface ClosePositionRequest {
|
|
identifier?: string;
|
|
positionId?: string;
|
|
}
|
|
|
|
export interface UpdateBotConfigRequest {
|
|
identifier: string;
|
|
config: TradingBotConfigRequest;
|
|
moneyManagementName?: string | null;
|
|
moneyManagement?: MoneyManagement | null;
|
|
}
|
|
|
|
export interface TickerInfos {
|
|
ticker?: Ticker;
|
|
imageUrl?: string | null;
|
|
name?: string | null;
|
|
}
|
|
|
|
export interface SpotlightOverview {
|
|
spotlights: Spotlight[];
|
|
dateTime: Date;
|
|
identifier?: string;
|
|
scenarioCount?: number;
|
|
}
|
|
|
|
export interface Spotlight {
|
|
scenario: Scenario;
|
|
tickerSignals: TickerSignal[];
|
|
}
|
|
|
|
export interface Scenario {
|
|
name?: string | null;
|
|
indicators?: IndicatorBase[] | null;
|
|
loopbackPeriod?: number | null;
|
|
user?: User | null;
|
|
}
|
|
|
|
export interface IndicatorBase {
|
|
name?: string | null;
|
|
type?: IndicatorType;
|
|
signalType?: SignalType;
|
|
minimumHistory?: number;
|
|
period?: number | null;
|
|
fastPeriods?: number | null;
|
|
slowPeriods?: number | null;
|
|
signalPeriods?: number | null;
|
|
multiplier?: number | null;
|
|
smoothPeriods?: number | null;
|
|
stochPeriods?: number | null;
|
|
cyclePeriods?: number | null;
|
|
kFactor?: number | null;
|
|
dFactor?: number | null;
|
|
tenkanPeriods?: number | null;
|
|
kijunPeriods?: number | null;
|
|
senkouBPeriods?: number | null;
|
|
offsetPeriods?: number | null;
|
|
senkouOffset?: number | null;
|
|
chikouOffset?: number | null;
|
|
user?: User | null;
|
|
}
|
|
|
|
export interface TickerSignal {
|
|
ticker: Ticker;
|
|
fiveMinutes: LightSignal[];
|
|
fifteenMinutes: LightSignal[];
|
|
oneHour: LightSignal[];
|
|
fourHour: LightSignal[];
|
|
oneDay: LightSignal[];
|
|
}
|
|
|
|
export interface CandlesWithIndicatorsResponse {
|
|
candles?: Candle[] | null;
|
|
indicatorsValues?: { [key in keyof typeof IndicatorType]?: IndicatorsResultBase; } | null;
|
|
}
|
|
|
|
export interface IndicatorsResultBase {
|
|
ema?: EmaResult[] | null;
|
|
fastEma?: EmaResult[] | null;
|
|
slowEma?: EmaResult[] | null;
|
|
macd?: MacdResult[] | null;
|
|
rsi?: RsiResult[] | null;
|
|
stoch?: StochResult[] | null;
|
|
stochRsi?: StochRsiResult[] | null;
|
|
bollingerBands?: BollingerBandsResult[] | null;
|
|
chandelierShort?: ChandelierResult[] | null;
|
|
stc?: StcResult[] | null;
|
|
stdDev?: StdDevResult[] | null;
|
|
superTrend?: SuperTrendResult[] | null;
|
|
chandelierLong?: ChandelierResult[] | null;
|
|
ichimoku?: IchimokuResult[] | null;
|
|
}
|
|
|
|
export interface ResultBase {
|
|
date?: Date;
|
|
}
|
|
|
|
export interface EmaResult extends ResultBase {
|
|
ema?: number | null;
|
|
"skender.Stock.Indicators.IReusableResult.Value"?: number | null;
|
|
}
|
|
|
|
export interface MacdResult extends ResultBase {
|
|
macd?: number | null;
|
|
signal?: number | null;
|
|
histogram?: number | null;
|
|
fastEma?: number | null;
|
|
slowEma?: number | null;
|
|
"skender.Stock.Indicators.IReusableResult.Value"?: number | null;
|
|
}
|
|
|
|
export interface RsiResult extends ResultBase {
|
|
rsi?: number | null;
|
|
"skender.Stock.Indicators.IReusableResult.Value"?: number | null;
|
|
}
|
|
|
|
/** Stochastic indicator results includes aliases for those who prefer the simpler K,D,J outputs. See documentation for more information. */
|
|
export interface StochResult extends ResultBase {
|
|
oscillator?: number | null;
|
|
signal?: number | null;
|
|
percentJ?: number | null;
|
|
k?: number | null;
|
|
d?: number | null;
|
|
j?: number | null;
|
|
"skender.Stock.Indicators.IReusableResult.Value"?: number | null;
|
|
}
|
|
|
|
export interface StochRsiResult extends ResultBase {
|
|
stochRsi?: number | null;
|
|
signal?: number | null;
|
|
"skender.Stock.Indicators.IReusableResult.Value"?: number | null;
|
|
}
|
|
|
|
export interface BollingerBandsResult extends ResultBase {
|
|
sma?: number | null;
|
|
upperBand?: number | null;
|
|
lowerBand?: number | null;
|
|
percentB?: number | null;
|
|
zScore?: number | null;
|
|
width?: number | null;
|
|
"skender.Stock.Indicators.IReusableResult.Value"?: number | null;
|
|
}
|
|
|
|
export interface ChandelierResult extends ResultBase {
|
|
chandelierExit?: number | null;
|
|
"skender.Stock.Indicators.IReusableResult.Value"?: number | null;
|
|
}
|
|
|
|
export interface StcResult extends ResultBase {
|
|
stc?: number | null;
|
|
"skender.Stock.Indicators.IReusableResult.Value"?: number | null;
|
|
}
|
|
|
|
export interface StdDevResult extends ResultBase {
|
|
stdDev?: number | null;
|
|
mean?: number | null;
|
|
zScore?: number | null;
|
|
stdDevSma?: number | null;
|
|
"skender.Stock.Indicators.IReusableResult.Value"?: number | null;
|
|
}
|
|
|
|
export interface SuperTrendResult extends ResultBase {
|
|
superTrend?: number | null;
|
|
upperBand?: number | null;
|
|
lowerBand?: number | null;
|
|
}
|
|
|
|
export interface IchimokuResult extends ResultBase {
|
|
tenkanSen?: number | null;
|
|
kijunSen?: number | null;
|
|
senkouSpanA?: number | null;
|
|
senkouSpanB?: number | null;
|
|
chikouSpan?: number | null;
|
|
}
|
|
|
|
export interface GetCandlesWithIndicatorsRequest {
|
|
ticker?: Ticker;
|
|
startDate?: Date;
|
|
endDate?: Date;
|
|
timeframe?: Timeframe;
|
|
scenario?: ScenarioRequest | null;
|
|
}
|
|
|
|
export interface StrategiesStatisticsViewModel {
|
|
totalStrategiesRunning?: number;
|
|
changeInLast24Hours?: number;
|
|
}
|
|
|
|
export interface TopStrategiesViewModel {
|
|
topStrategies?: StrategyPerformance[] | null;
|
|
}
|
|
|
|
export interface StrategyPerformance {
|
|
strategyName?: string | null;
|
|
pnL?: number;
|
|
netPnL?: number;
|
|
agentName?: string | null;
|
|
}
|
|
|
|
export interface TopStrategiesByRoiViewModel {
|
|
topStrategiesByRoi?: StrategyRoiPerformance[] | null;
|
|
}
|
|
|
|
export interface StrategyRoiPerformance {
|
|
strategyName?: string | null;
|
|
roi?: number;
|
|
pnL?: number;
|
|
netPnL?: number;
|
|
volume?: number;
|
|
}
|
|
|
|
export interface UserStrategyDetailsViewModel {
|
|
name?: string | null;
|
|
state?: BotStatus;
|
|
pnL?: number;
|
|
netPnL?: number;
|
|
roiPercentage?: number;
|
|
runtime?: Date | null;
|
|
totalRuntimeSeconds?: number;
|
|
lastStartTime?: Date | null;
|
|
lastStopTime?: Date | null;
|
|
accumulatedRunTimeSeconds?: number;
|
|
winRate?: number;
|
|
totalVolumeTraded?: number;
|
|
volumeLast24H?: number;
|
|
wins?: number;
|
|
losses?: number;
|
|
positions?: PositionViewModel[] | null;
|
|
identifier?: string;
|
|
walletBalances?: { [key: string]: number; } | null;
|
|
ticker?: Ticker;
|
|
masterAgentName?: string | null;
|
|
}
|
|
|
|
export interface PositionViewModel {
|
|
date: Date;
|
|
accountId: number;
|
|
originDirection: TradeDirection;
|
|
ticker: Ticker;
|
|
Open: Trade;
|
|
StopLoss: Trade;
|
|
TakeProfit1: Trade;
|
|
ProfitAndLoss?: ProfitAndLoss | null;
|
|
uiFees?: number;
|
|
gasFees?: number;
|
|
status: PositionStatus;
|
|
signalIdentifier?: string | null;
|
|
identifier: string;
|
|
}
|
|
|
|
export interface PlatformSummaryViewModel {
|
|
lastUpdated?: Date;
|
|
lastSnapshot?: Date;
|
|
hasPendingChanges?: boolean;
|
|
totalAgents?: number;
|
|
totalActiveStrategies?: number;
|
|
totalPlatformPnL?: number;
|
|
totalPlatformVolume?: number;
|
|
openInterest?: number;
|
|
totalPositionCount?: number;
|
|
totalPlatformFees?: number;
|
|
dailySnapshots?: DailySnapshot[] | null;
|
|
volumeByAsset?: { [key in keyof typeof Ticker]?: number; } | null;
|
|
positionCountByAsset?: { [key in keyof typeof Ticker]?: number; } | null;
|
|
positionCountByDirection?: { [key in keyof typeof TradeDirection]?: number; } | null;
|
|
}
|
|
|
|
export interface DailySnapshot {
|
|
date?: Date;
|
|
totalAgents?: number;
|
|
totalStrategies?: number;
|
|
totalVolume?: number;
|
|
totalPnL?: number;
|
|
netPnL?: number;
|
|
totalOpenInterest?: number;
|
|
totalPositionCount?: number;
|
|
}
|
|
|
|
export interface PaginatedAgentIndexResponse {
|
|
agentSummaries?: AgentSummaryViewModel[] | null;
|
|
totalCount?: number;
|
|
currentPage?: number;
|
|
pageSize?: number;
|
|
totalPages?: number;
|
|
hasNextPage?: boolean;
|
|
hasPreviousPage?: boolean;
|
|
timeFilter?: string | null;
|
|
sortBy?: SortableFields;
|
|
sortOrder?: string | null;
|
|
filteredAgentNames?: string | null;
|
|
}
|
|
|
|
export interface AgentSummaryViewModel {
|
|
agentName?: string | null;
|
|
totalPnL?: number;
|
|
netPnL?: number;
|
|
totalROI?: number;
|
|
wins?: number;
|
|
losses?: number;
|
|
activeStrategiesCount?: number;
|
|
totalVolume?: number;
|
|
totalBalance?: number;
|
|
totalFees?: number;
|
|
backtestCount?: number;
|
|
}
|
|
|
|
export enum SortableFields {
|
|
NetPnL = "NetPnL",
|
|
TotalROI = "TotalROI",
|
|
Wins = "Wins",
|
|
Losses = "Losses",
|
|
AgentName = "AgentName",
|
|
CreatedAt = "CreatedAt",
|
|
UpdatedAt = "UpdatedAt",
|
|
TotalVolume = "TotalVolume",
|
|
TotalBalance = "TotalBalance",
|
|
}
|
|
|
|
export interface AgentBalanceHistory {
|
|
userId?: number;
|
|
agentName?: string | null;
|
|
agentBalances?: AgentBalance[] | null;
|
|
}
|
|
|
|
export interface AgentBalance {
|
|
userId?: number;
|
|
totalBalanceValue?: number;
|
|
usdcWalletValue?: number;
|
|
usdcInPositionsValue?: number;
|
|
botsAllocationUsdValue?: number;
|
|
pnL?: number;
|
|
time?: Date;
|
|
}
|
|
|
|
export interface JobStatusResponse {
|
|
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[];
|
|
loopbackPeriod?: number | null;
|
|
userName: string;
|
|
}
|
|
|
|
export interface IndicatorViewModel {
|
|
name: string;
|
|
type: IndicatorType;
|
|
signalType: SignalType;
|
|
minimumHistory: number;
|
|
period?: number | null;
|
|
fastPeriods?: number | null;
|
|
slowPeriods?: number | null;
|
|
signalPeriods?: number | null;
|
|
multiplier?: number | null;
|
|
smoothPeriods?: number | null;
|
|
stochPeriods?: number | null;
|
|
cyclePeriods?: number | null;
|
|
userName: string;
|
|
}
|
|
|
|
export enum RiskLevel {
|
|
Low = "Low",
|
|
Medium = "Medium",
|
|
High = "High",
|
|
Adaptive = "Adaptive",
|
|
}
|
|
|
|
export interface PrivyInitAddressResponse {
|
|
success?: boolean;
|
|
usdcHash?: string | null;
|
|
orderVaultHash?: string | null;
|
|
exchangeRouterHash?: string | null;
|
|
error?: string | null;
|
|
address?: string | null;
|
|
isAlreadyInitialized?: boolean;
|
|
}
|
|
|
|
export interface IndicatorRequestDto {
|
|
indicatorName: string;
|
|
strategyDescription: string;
|
|
documentationUrl?: string | null;
|
|
imageUrl?: string | null;
|
|
requesterName: string;
|
|
}
|
|
|
|
export interface LoginRequest {
|
|
name: string;
|
|
address: string;
|
|
signature: string;
|
|
message: string;
|
|
ownerWalletAddress?: string | null;
|
|
}
|
|
|
|
export interface PaginatedWhitelistAccountsResponse {
|
|
accounts?: WhitelistAccount[] | null;
|
|
totalCount?: number;
|
|
pageNumber?: number;
|
|
pageSize?: number;
|
|
totalPages?: number;
|
|
}
|
|
|
|
export interface WhitelistAccount {
|
|
id?: number;
|
|
privyId?: string | null;
|
|
privyCreationDate?: Date;
|
|
embeddedWallet?: string | null;
|
|
externalEthereumAccount?: string | null;
|
|
twitterAccount?: string | null;
|
|
isWhitelisted?: boolean;
|
|
createdAt?: Date;
|
|
updatedAt?: Date | null;
|
|
}
|
|
|
|
export interface PrivyWebhookDto {
|
|
type?: string | null;
|
|
user?: PrivyUserDto | null;
|
|
wallet?: PrivyWalletDto | null;
|
|
}
|
|
|
|
export interface PrivyUserDto {
|
|
created_at?: number;
|
|
has_accepted_terms?: boolean;
|
|
id?: string | null;
|
|
is_guest?: boolean;
|
|
linked_accounts?: PrivyLinkedAccountDto[] | null;
|
|
mfa_methods?: any[] | null;
|
|
}
|
|
|
|
export interface PrivyLinkedAccountDto {
|
|
address?: string | null;
|
|
first_verified_at?: number | null;
|
|
latest_verified_at?: number | null;
|
|
type?: string | null;
|
|
verified_at?: number | null;
|
|
}
|
|
|
|
export interface PrivyWalletDto {
|
|
type?: string | null;
|
|
address?: string | null;
|
|
chain_type?: string | null;
|
|
}
|
|
|
|
export interface FileResponse {
|
|
data: Blob;
|
|
status: number;
|
|
fileName?: string;
|
|
headers?: { [name: string]: any };
|
|
}
|
|
|
|
export class ApiException extends Error {
|
|
override message: string;
|
|
status: number;
|
|
response: string;
|
|
headers: { [key: string]: any; };
|
|
result: any;
|
|
|
|
constructor(message: string, status: number, response: string, headers: { [key: string]: any; }, result: any) {
|
|
super();
|
|
|
|
this.message = message;
|
|
this.status = status;
|
|
this.response = response;
|
|
this.headers = headers;
|
|
this.result = result;
|
|
}
|
|
|
|
protected isApiException = true;
|
|
|
|
static isApiException(obj: any): obj is ApiException {
|
|
return obj.isApiException === true;
|
|
}
|
|
}
|
|
|
|
function throwException(message: string, status: number, response: string, headers: { [key: string]: any; }, result?: any): any {
|
|
if (result !== null && result !== undefined)
|
|
throw result;
|
|
else
|
|
throw new ApiException(message, status, response, headers, null);
|
|
} |