reportify-sdk 0.3.33 → 0.3.34
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/README.md +3 -1
- package/dist/index.d.mts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +3 -6
- package/dist/index.mjs +3 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -120,11 +120,13 @@ const ohlcvBatch = await client.quant.ohlcvBatch({ symbols: ['000001', '600519']
|
|
|
120
120
|
const result = await client.quant.backtest({
|
|
121
121
|
startDate: '2023-01-01',
|
|
122
122
|
endDate: '2024-01-01',
|
|
123
|
-
|
|
123
|
+
symbols: ['000001'],
|
|
124
124
|
entryFormula: 'CROSS(MA(CLOSE, 5), MA(CLOSE, 20))',
|
|
125
125
|
exitFormula: 'CROSSDOWN(MA(CLOSE, 5), MA(CLOSE, 20))'
|
|
126
126
|
});
|
|
127
127
|
console.log(`Total Return: ${(result.total_return_pct * 100).toFixed(2)}%`);
|
|
128
|
+
console.log(`Sharpe: ${result.sharpe_ratio.toFixed(3)}`);
|
|
129
|
+
console.log(`Alpha/Beta: ${result.alpha.toFixed(3)}/${result.beta.toFixed(3)}`);
|
|
128
130
|
```
|
|
129
131
|
|
|
130
132
|
### Concepts
|
package/dist/index.d.mts
CHANGED
|
@@ -817,6 +817,15 @@ interface BacktestResult {
|
|
|
817
817
|
cumulative_pnl: number;
|
|
818
818
|
}>;
|
|
819
819
|
portfolio_value: Record<string, number>;
|
|
820
|
+
benchmark_value: Record<string, number>;
|
|
821
|
+
benchmark_return_pct: number;
|
|
822
|
+
sharpe_ratio: number;
|
|
823
|
+
alpha: number;
|
|
824
|
+
beta: number;
|
|
825
|
+
max_drawdown_start: string | null;
|
|
826
|
+
max_drawdown_end: string | null;
|
|
827
|
+
daily_returns: Record<string, number>;
|
|
828
|
+
drawdown_series: Record<string, number>;
|
|
820
829
|
error_msg: string | null;
|
|
821
830
|
}
|
|
822
831
|
/**
|
|
@@ -849,7 +858,6 @@ interface BacktestResult {
|
|
|
849
858
|
*/
|
|
850
859
|
declare class QuantModule {
|
|
851
860
|
private client;
|
|
852
|
-
private static readonly BACKTEST_TIMEOUT_MS;
|
|
853
861
|
constructor(client: Reportify);
|
|
854
862
|
/**
|
|
855
863
|
* Get list of available factors (variables, functions, and indicators)
|
package/dist/index.d.ts
CHANGED
|
@@ -817,6 +817,15 @@ interface BacktestResult {
|
|
|
817
817
|
cumulative_pnl: number;
|
|
818
818
|
}>;
|
|
819
819
|
portfolio_value: Record<string, number>;
|
|
820
|
+
benchmark_value: Record<string, number>;
|
|
821
|
+
benchmark_return_pct: number;
|
|
822
|
+
sharpe_ratio: number;
|
|
823
|
+
alpha: number;
|
|
824
|
+
beta: number;
|
|
825
|
+
max_drawdown_start: string | null;
|
|
826
|
+
max_drawdown_end: string | null;
|
|
827
|
+
daily_returns: Record<string, number>;
|
|
828
|
+
drawdown_series: Record<string, number>;
|
|
820
829
|
error_msg: string | null;
|
|
821
830
|
}
|
|
822
831
|
/**
|
|
@@ -849,7 +858,6 @@ interface BacktestResult {
|
|
|
849
858
|
*/
|
|
850
859
|
declare class QuantModule {
|
|
851
860
|
private client;
|
|
852
|
-
private static readonly BACKTEST_TIMEOUT_MS;
|
|
853
861
|
constructor(client: Reportify);
|
|
854
862
|
/**
|
|
855
863
|
* Get list of available factors (variables, functions, and indicators)
|
package/dist/index.js
CHANGED
|
@@ -614,11 +614,10 @@ var DocsModule = class {
|
|
|
614
614
|
};
|
|
615
615
|
|
|
616
616
|
// src/quant.ts
|
|
617
|
-
var QuantModule = class
|
|
617
|
+
var QuantModule = class {
|
|
618
618
|
constructor(client) {
|
|
619
619
|
this.client = client;
|
|
620
620
|
}
|
|
621
|
-
static BACKTEST_TIMEOUT_MS = 12e4;
|
|
622
621
|
// ===========================================================================
|
|
623
622
|
// Factors (includes technical indicators and fundamental factors)
|
|
624
623
|
// ===========================================================================
|
|
@@ -997,8 +996,7 @@ var QuantModule = class _QuantModule {
|
|
|
997
996
|
body.signal_factors = params.signalFactors;
|
|
998
997
|
}
|
|
999
998
|
return this.client.request("POST", "/v1/quant/backtest", {
|
|
1000
|
-
body
|
|
1001
|
-
timeoutMs: _QuantModule.BACKTEST_TIMEOUT_MS
|
|
999
|
+
body
|
|
1002
1000
|
});
|
|
1003
1001
|
}
|
|
1004
1002
|
/**
|
|
@@ -1085,8 +1083,7 @@ var QuantModule = class _QuantModule {
|
|
|
1085
1083
|
formData.append("signal_factors", JSON.stringify(params.signalFactors));
|
|
1086
1084
|
}
|
|
1087
1085
|
return this.client.request("POST", "/v1/quant/backtest/upload", {
|
|
1088
|
-
formData
|
|
1089
|
-
timeoutMs: _QuantModule.BACKTEST_TIMEOUT_MS
|
|
1086
|
+
formData
|
|
1090
1087
|
});
|
|
1091
1088
|
}
|
|
1092
1089
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -570,11 +570,10 @@ var DocsModule = class {
|
|
|
570
570
|
};
|
|
571
571
|
|
|
572
572
|
// src/quant.ts
|
|
573
|
-
var QuantModule = class
|
|
573
|
+
var QuantModule = class {
|
|
574
574
|
constructor(client) {
|
|
575
575
|
this.client = client;
|
|
576
576
|
}
|
|
577
|
-
static BACKTEST_TIMEOUT_MS = 12e4;
|
|
578
577
|
// ===========================================================================
|
|
579
578
|
// Factors (includes technical indicators and fundamental factors)
|
|
580
579
|
// ===========================================================================
|
|
@@ -953,8 +952,7 @@ var QuantModule = class _QuantModule {
|
|
|
953
952
|
body.signal_factors = params.signalFactors;
|
|
954
953
|
}
|
|
955
954
|
return this.client.request("POST", "/v1/quant/backtest", {
|
|
956
|
-
body
|
|
957
|
-
timeoutMs: _QuantModule.BACKTEST_TIMEOUT_MS
|
|
955
|
+
body
|
|
958
956
|
});
|
|
959
957
|
}
|
|
960
958
|
/**
|
|
@@ -1041,8 +1039,7 @@ var QuantModule = class _QuantModule {
|
|
|
1041
1039
|
formData.append("signal_factors", JSON.stringify(params.signalFactors));
|
|
1042
1040
|
}
|
|
1043
1041
|
return this.client.request("POST", "/v1/quant/backtest/upload", {
|
|
1044
|
-
formData
|
|
1045
|
-
timeoutMs: _QuantModule.BACKTEST_TIMEOUT_MS
|
|
1042
|
+
formData
|
|
1046
1043
|
});
|
|
1047
1044
|
}
|
|
1048
1045
|
};
|