reportify-sdk 0.3.31 → 0.3.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +8 -4
- package/dist/index.d.ts +8 -4
- package/dist/index.js +33 -9
- package/dist/index.mjs +33 -9
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -736,10 +736,11 @@ interface BacktestParams {
|
|
|
736
736
|
minCommissionAmount?: number;
|
|
737
737
|
slippage?: number;
|
|
738
738
|
stopLoss?: number;
|
|
739
|
-
positionSize?: number;
|
|
740
|
-
maxPositions?: number;
|
|
739
|
+
positionSize?: number | null;
|
|
740
|
+
maxPositions?: number | null;
|
|
741
741
|
minVolume?: number;
|
|
742
742
|
autoClose?: boolean;
|
|
743
|
+
cheatOnOpen?: boolean;
|
|
743
744
|
signalFactors?: Record<string, string>;
|
|
744
745
|
}
|
|
745
746
|
interface KlineParams {
|
|
@@ -783,10 +784,11 @@ interface BacktestUploadParams {
|
|
|
783
784
|
sellCommission?: number;
|
|
784
785
|
minCommissionAmount?: number;
|
|
785
786
|
slippage?: number;
|
|
786
|
-
positionSize?: number;
|
|
787
|
-
maxPositions?: number;
|
|
787
|
+
positionSize?: number | null;
|
|
788
|
+
maxPositions?: number | null;
|
|
788
789
|
minVolume?: number;
|
|
789
790
|
autoClose?: boolean;
|
|
791
|
+
cheatOnOpen?: boolean;
|
|
790
792
|
signalFactors?: Record<string, string>;
|
|
791
793
|
}
|
|
792
794
|
interface BacktestResult {
|
|
@@ -847,6 +849,7 @@ interface BacktestResult {
|
|
|
847
849
|
*/
|
|
848
850
|
declare class QuantModule {
|
|
849
851
|
private client;
|
|
852
|
+
private static readonly BACKTEST_TIMEOUT_MS;
|
|
850
853
|
constructor(client: Reportify);
|
|
851
854
|
/**
|
|
852
855
|
* Get list of available factors (variables, functions, and indicators)
|
|
@@ -1971,6 +1974,7 @@ declare class Reportify {
|
|
|
1971
1974
|
params?: Record<string, unknown>;
|
|
1972
1975
|
body?: Record<string, unknown>;
|
|
1973
1976
|
formData?: FormData;
|
|
1977
|
+
timeoutMs?: number;
|
|
1974
1978
|
}): Promise<T>;
|
|
1975
1979
|
/**
|
|
1976
1980
|
* Make a GET request
|
package/dist/index.d.ts
CHANGED
|
@@ -736,10 +736,11 @@ interface BacktestParams {
|
|
|
736
736
|
minCommissionAmount?: number;
|
|
737
737
|
slippage?: number;
|
|
738
738
|
stopLoss?: number;
|
|
739
|
-
positionSize?: number;
|
|
740
|
-
maxPositions?: number;
|
|
739
|
+
positionSize?: number | null;
|
|
740
|
+
maxPositions?: number | null;
|
|
741
741
|
minVolume?: number;
|
|
742
742
|
autoClose?: boolean;
|
|
743
|
+
cheatOnOpen?: boolean;
|
|
743
744
|
signalFactors?: Record<string, string>;
|
|
744
745
|
}
|
|
745
746
|
interface KlineParams {
|
|
@@ -783,10 +784,11 @@ interface BacktestUploadParams {
|
|
|
783
784
|
sellCommission?: number;
|
|
784
785
|
minCommissionAmount?: number;
|
|
785
786
|
slippage?: number;
|
|
786
|
-
positionSize?: number;
|
|
787
|
-
maxPositions?: number;
|
|
787
|
+
positionSize?: number | null;
|
|
788
|
+
maxPositions?: number | null;
|
|
788
789
|
minVolume?: number;
|
|
789
790
|
autoClose?: boolean;
|
|
791
|
+
cheatOnOpen?: boolean;
|
|
790
792
|
signalFactors?: Record<string, string>;
|
|
791
793
|
}
|
|
792
794
|
interface BacktestResult {
|
|
@@ -847,6 +849,7 @@ interface BacktestResult {
|
|
|
847
849
|
*/
|
|
848
850
|
declare class QuantModule {
|
|
849
851
|
private client;
|
|
852
|
+
private static readonly BACKTEST_TIMEOUT_MS;
|
|
850
853
|
constructor(client: Reportify);
|
|
851
854
|
/**
|
|
852
855
|
* Get list of available factors (variables, functions, and indicators)
|
|
@@ -1971,6 +1974,7 @@ declare class Reportify {
|
|
|
1971
1974
|
params?: Record<string, unknown>;
|
|
1972
1975
|
body?: Record<string, unknown>;
|
|
1973
1976
|
formData?: FormData;
|
|
1977
|
+
timeoutMs?: number;
|
|
1974
1978
|
}): Promise<T>;
|
|
1975
1979
|
/**
|
|
1976
1980
|
* Make a GET request
|
package/dist/index.js
CHANGED
|
@@ -614,10 +614,11 @@ var DocsModule = class {
|
|
|
614
614
|
};
|
|
615
615
|
|
|
616
616
|
// src/quant.ts
|
|
617
|
-
var QuantModule = class {
|
|
617
|
+
var QuantModule = class _QuantModule {
|
|
618
618
|
constructor(client) {
|
|
619
619
|
this.client = client;
|
|
620
620
|
}
|
|
621
|
+
static BACKTEST_TIMEOUT_MS = 12e4;
|
|
621
622
|
// ===========================================================================
|
|
622
623
|
// Factors (includes technical indicators and fundamental factors)
|
|
623
624
|
// ===========================================================================
|
|
@@ -963,8 +964,6 @@ var QuantModule = class {
|
|
|
963
964
|
min_commission_amount: params.minCommissionAmount ?? 0,
|
|
964
965
|
slippage: params.slippage ?? 0,
|
|
965
966
|
stop_loss: params.stopLoss ?? 0,
|
|
966
|
-
position_size: params.positionSize ?? 0.2,
|
|
967
|
-
max_positions: params.maxPositions ?? 5,
|
|
968
967
|
min_volume: params.minVolume ?? 100,
|
|
969
968
|
auto_close: params.autoClose ?? true
|
|
970
969
|
};
|
|
@@ -983,10 +982,22 @@ var QuantModule = class {
|
|
|
983
982
|
if (params.exitFormula !== void 0) {
|
|
984
983
|
body.exit_formula = params.exitFormula;
|
|
985
984
|
}
|
|
985
|
+
if (params.positionSize !== void 0) {
|
|
986
|
+
body.position_size = params.positionSize;
|
|
987
|
+
}
|
|
988
|
+
if (params.maxPositions !== void 0) {
|
|
989
|
+
body.max_positions = params.maxPositions;
|
|
990
|
+
}
|
|
991
|
+
if (params.cheatOnOpen !== void 0) {
|
|
992
|
+
body.cheat_on_open = params.cheatOnOpen;
|
|
993
|
+
}
|
|
986
994
|
if (params.signalFactors !== void 0) {
|
|
987
995
|
body.signal_factors = params.signalFactors;
|
|
988
996
|
}
|
|
989
|
-
return this.client.
|
|
997
|
+
return this.client.request("POST", "/v1/quant/backtest", {
|
|
998
|
+
body,
|
|
999
|
+
timeoutMs: _QuantModule.BACKTEST_TIMEOUT_MS
|
|
1000
|
+
});
|
|
990
1001
|
}
|
|
991
1002
|
/**
|
|
992
1003
|
* Upload an Excel file to run backtest
|
|
@@ -1042,9 +1053,7 @@ var QuantModule = class {
|
|
|
1042
1053
|
formData.append("sell_commission", String(params.sellCommission ?? 0));
|
|
1043
1054
|
formData.append("min_commission_amount", String(params.minCommissionAmount ?? 0));
|
|
1044
1055
|
formData.append("slippage", String(params.slippage ?? 0));
|
|
1045
|
-
formData.append("
|
|
1046
|
-
formData.append("max_positions", String(params.maxPositions ?? 5));
|
|
1047
|
-
formData.append("min_volume", String(params.minVolume ?? 100));
|
|
1056
|
+
formData.append("min_volume", String(params.minVolume ?? 1));
|
|
1048
1057
|
formData.append("auto_close", String(params.autoClose ?? true));
|
|
1049
1058
|
if (params.startDate !== void 0) {
|
|
1050
1059
|
formData.append("start_date", params.startDate);
|
|
@@ -1061,10 +1070,22 @@ var QuantModule = class {
|
|
|
1061
1070
|
if (params.exitFormula !== void 0) {
|
|
1062
1071
|
formData.append("exit_formula", params.exitFormula);
|
|
1063
1072
|
}
|
|
1073
|
+
if (params.positionSize !== void 0 && params.positionSize !== null) {
|
|
1074
|
+
formData.append("position_size", String(params.positionSize));
|
|
1075
|
+
}
|
|
1076
|
+
if (params.maxPositions !== void 0 && params.maxPositions !== null) {
|
|
1077
|
+
formData.append("max_positions", String(params.maxPositions));
|
|
1078
|
+
}
|
|
1079
|
+
if (params.cheatOnOpen !== void 0) {
|
|
1080
|
+
formData.append("cheat_on_open", String(params.cheatOnOpen));
|
|
1081
|
+
}
|
|
1064
1082
|
if (params.signalFactors !== void 0) {
|
|
1065
1083
|
formData.append("signal_factors", JSON.stringify(params.signalFactors));
|
|
1066
1084
|
}
|
|
1067
|
-
return this.client.request("POST", "/v1/quant/backtest/upload", {
|
|
1085
|
+
return this.client.request("POST", "/v1/quant/backtest/upload", {
|
|
1086
|
+
formData,
|
|
1087
|
+
timeoutMs: _QuantModule.BACKTEST_TIMEOUT_MS
|
|
1088
|
+
});
|
|
1068
1089
|
}
|
|
1069
1090
|
};
|
|
1070
1091
|
|
|
@@ -2128,7 +2149,10 @@ var Reportify = class {
|
|
|
2128
2149
|
});
|
|
2129
2150
|
}
|
|
2130
2151
|
const controller = new AbortController();
|
|
2131
|
-
const timeoutId = setTimeout(
|
|
2152
|
+
const timeoutId = setTimeout(
|
|
2153
|
+
() => controller.abort(),
|
|
2154
|
+
options.timeoutMs ?? this.timeout
|
|
2155
|
+
);
|
|
2132
2156
|
const headers = {
|
|
2133
2157
|
Authorization: `Bearer ${this.apiKey}`,
|
|
2134
2158
|
"User-Agent": "reportify-sdk-js/0.3.10"
|
package/dist/index.mjs
CHANGED
|
@@ -570,10 +570,11 @@ var DocsModule = class {
|
|
|
570
570
|
};
|
|
571
571
|
|
|
572
572
|
// src/quant.ts
|
|
573
|
-
var QuantModule = class {
|
|
573
|
+
var QuantModule = class _QuantModule {
|
|
574
574
|
constructor(client) {
|
|
575
575
|
this.client = client;
|
|
576
576
|
}
|
|
577
|
+
static BACKTEST_TIMEOUT_MS = 12e4;
|
|
577
578
|
// ===========================================================================
|
|
578
579
|
// Factors (includes technical indicators and fundamental factors)
|
|
579
580
|
// ===========================================================================
|
|
@@ -919,8 +920,6 @@ var QuantModule = class {
|
|
|
919
920
|
min_commission_amount: params.minCommissionAmount ?? 0,
|
|
920
921
|
slippage: params.slippage ?? 0,
|
|
921
922
|
stop_loss: params.stopLoss ?? 0,
|
|
922
|
-
position_size: params.positionSize ?? 0.2,
|
|
923
|
-
max_positions: params.maxPositions ?? 5,
|
|
924
923
|
min_volume: params.minVolume ?? 100,
|
|
925
924
|
auto_close: params.autoClose ?? true
|
|
926
925
|
};
|
|
@@ -939,10 +938,22 @@ var QuantModule = class {
|
|
|
939
938
|
if (params.exitFormula !== void 0) {
|
|
940
939
|
body.exit_formula = params.exitFormula;
|
|
941
940
|
}
|
|
941
|
+
if (params.positionSize !== void 0) {
|
|
942
|
+
body.position_size = params.positionSize;
|
|
943
|
+
}
|
|
944
|
+
if (params.maxPositions !== void 0) {
|
|
945
|
+
body.max_positions = params.maxPositions;
|
|
946
|
+
}
|
|
947
|
+
if (params.cheatOnOpen !== void 0) {
|
|
948
|
+
body.cheat_on_open = params.cheatOnOpen;
|
|
949
|
+
}
|
|
942
950
|
if (params.signalFactors !== void 0) {
|
|
943
951
|
body.signal_factors = params.signalFactors;
|
|
944
952
|
}
|
|
945
|
-
return this.client.
|
|
953
|
+
return this.client.request("POST", "/v1/quant/backtest", {
|
|
954
|
+
body,
|
|
955
|
+
timeoutMs: _QuantModule.BACKTEST_TIMEOUT_MS
|
|
956
|
+
});
|
|
946
957
|
}
|
|
947
958
|
/**
|
|
948
959
|
* Upload an Excel file to run backtest
|
|
@@ -998,9 +1009,7 @@ var QuantModule = class {
|
|
|
998
1009
|
formData.append("sell_commission", String(params.sellCommission ?? 0));
|
|
999
1010
|
formData.append("min_commission_amount", String(params.minCommissionAmount ?? 0));
|
|
1000
1011
|
formData.append("slippage", String(params.slippage ?? 0));
|
|
1001
|
-
formData.append("
|
|
1002
|
-
formData.append("max_positions", String(params.maxPositions ?? 5));
|
|
1003
|
-
formData.append("min_volume", String(params.minVolume ?? 100));
|
|
1012
|
+
formData.append("min_volume", String(params.minVolume ?? 1));
|
|
1004
1013
|
formData.append("auto_close", String(params.autoClose ?? true));
|
|
1005
1014
|
if (params.startDate !== void 0) {
|
|
1006
1015
|
formData.append("start_date", params.startDate);
|
|
@@ -1017,10 +1026,22 @@ var QuantModule = class {
|
|
|
1017
1026
|
if (params.exitFormula !== void 0) {
|
|
1018
1027
|
formData.append("exit_formula", params.exitFormula);
|
|
1019
1028
|
}
|
|
1029
|
+
if (params.positionSize !== void 0 && params.positionSize !== null) {
|
|
1030
|
+
formData.append("position_size", String(params.positionSize));
|
|
1031
|
+
}
|
|
1032
|
+
if (params.maxPositions !== void 0 && params.maxPositions !== null) {
|
|
1033
|
+
formData.append("max_positions", String(params.maxPositions));
|
|
1034
|
+
}
|
|
1035
|
+
if (params.cheatOnOpen !== void 0) {
|
|
1036
|
+
formData.append("cheat_on_open", String(params.cheatOnOpen));
|
|
1037
|
+
}
|
|
1020
1038
|
if (params.signalFactors !== void 0) {
|
|
1021
1039
|
formData.append("signal_factors", JSON.stringify(params.signalFactors));
|
|
1022
1040
|
}
|
|
1023
|
-
return this.client.request("POST", "/v1/quant/backtest/upload", {
|
|
1041
|
+
return this.client.request("POST", "/v1/quant/backtest/upload", {
|
|
1042
|
+
formData,
|
|
1043
|
+
timeoutMs: _QuantModule.BACKTEST_TIMEOUT_MS
|
|
1044
|
+
});
|
|
1024
1045
|
}
|
|
1025
1046
|
};
|
|
1026
1047
|
|
|
@@ -2084,7 +2105,10 @@ var Reportify = class {
|
|
|
2084
2105
|
});
|
|
2085
2106
|
}
|
|
2086
2107
|
const controller = new AbortController();
|
|
2087
|
-
const timeoutId = setTimeout(
|
|
2108
|
+
const timeoutId = setTimeout(
|
|
2109
|
+
() => controller.abort(),
|
|
2110
|
+
options.timeoutMs ?? this.timeout
|
|
2111
|
+
);
|
|
2088
2112
|
const headers = {
|
|
2089
2113
|
Authorization: `Bearer ${this.apiKey}`,
|
|
2090
2114
|
"User-Agent": "reportify-sdk-js/0.3.10"
|