reportify-sdk 0.3.2 → 0.3.3
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 +48 -1
- package/dist/index.d.ts +48 -1
- package/dist/index.js +50 -3
- package/dist/index.mjs +50 -3
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -800,6 +800,8 @@ declare class QuantModule {
|
|
|
800
800
|
/**
|
|
801
801
|
* Get list of available technical indicators
|
|
802
802
|
*
|
|
803
|
+
* All indicators are functions and require parentheses when used (e.g., MA(20), RSI(14), MACD()).
|
|
804
|
+
*
|
|
803
805
|
* @returns Array of indicator definitions
|
|
804
806
|
*
|
|
805
807
|
* @example
|
|
@@ -815,6 +817,10 @@ declare class QuantModule {
|
|
|
815
817
|
/**
|
|
816
818
|
* Compute indicator values for given symbols
|
|
817
819
|
*
|
|
820
|
+
* Variables vs Functions:
|
|
821
|
+
* - Variables (no parentheses): CLOSE, OPEN, HIGH, LOW, VOLUME (aliases: C, O, H, L, V, VOL)
|
|
822
|
+
* - Functions (with parentheses): MA(20), RSI(14), MACD(), etc.
|
|
823
|
+
*
|
|
818
824
|
* @param params - Indicator computation parameters
|
|
819
825
|
* @returns Array of indicator data
|
|
820
826
|
*
|
|
@@ -831,12 +837,22 @@ declare class QuantModule {
|
|
|
831
837
|
* symbols: ['000001'],
|
|
832
838
|
* formula: 'MACD()'
|
|
833
839
|
* });
|
|
840
|
+
*
|
|
841
|
+
* // Standard deviation
|
|
842
|
+
* const data = await client.quant.computeIndicators({
|
|
843
|
+
* symbols: ['000001'],
|
|
844
|
+
* formula: 'STD(CLOSE, 20)'
|
|
845
|
+
* });
|
|
834
846
|
* ```
|
|
835
847
|
*/
|
|
836
848
|
computeIndicators(params: IndicatorComputeParams): Promise<IndicatorData[]>;
|
|
837
849
|
/**
|
|
838
850
|
* Get list of available factors (variables and functions)
|
|
839
851
|
*
|
|
852
|
+
* Variables vs Functions:
|
|
853
|
+
* - Variables (no parentheses): CLOSE, OPEN, HIGH, LOW, VOLUME, PE_TTM, ROE_TTM, etc.
|
|
854
|
+
* - Functions (with parentheses): MA(20), PE(), ROE(), RSI(14), etc.
|
|
855
|
+
*
|
|
840
856
|
* @returns Array of factor definitions organized by level
|
|
841
857
|
*/
|
|
842
858
|
listFactors(): Promise<FactorMeta[]>;
|
|
@@ -845,6 +861,10 @@ declare class QuantModule {
|
|
|
845
861
|
*
|
|
846
862
|
* Uses Mai-language syntax compatible with TongDaXin/TongHuaShun.
|
|
847
863
|
*
|
|
864
|
+
* Variables vs Functions:
|
|
865
|
+
* - Variables (no parentheses): CLOSE, OPEN, HIGH, LOW, VOLUME
|
|
866
|
+
* - Functions (with parentheses): MA(20), PE(), ROE(), RSI(14), etc.
|
|
867
|
+
*
|
|
848
868
|
* @param params - Factor computation parameters
|
|
849
869
|
* @returns Array of factor data
|
|
850
870
|
*
|
|
@@ -867,12 +887,22 @@ declare class QuantModule {
|
|
|
867
887
|
* symbols: ['000001'],
|
|
868
888
|
* formula: 'CLOSE > MA(20)'
|
|
869
889
|
* });
|
|
890
|
+
*
|
|
891
|
+
* // Fundamental factors (note: functions require parentheses)
|
|
892
|
+
* const data = await client.quant.computeFactors({
|
|
893
|
+
* symbols: ['000001'],
|
|
894
|
+
* formula: 'PE()'
|
|
895
|
+
* });
|
|
870
896
|
* ```
|
|
871
897
|
*/
|
|
872
898
|
computeFactors(params: FactorComputeParams): Promise<IndicatorData[]>;
|
|
873
899
|
/**
|
|
874
900
|
* Screen stocks based on factor formula
|
|
875
901
|
*
|
|
902
|
+
* Variables vs Functions:
|
|
903
|
+
* - Variables (no parentheses): CLOSE, OPEN, HIGH, LOW, VOLUME
|
|
904
|
+
* - Functions (with parentheses): MA(20), PE(), ROE(), RSI(14), etc.
|
|
905
|
+
*
|
|
876
906
|
* @param params - Screening parameters
|
|
877
907
|
* @returns Array of stocks that passed the filter
|
|
878
908
|
*
|
|
@@ -892,6 +922,11 @@ declare class QuantModule {
|
|
|
892
922
|
* const stocks = await client.quant.screen({
|
|
893
923
|
* formula: '(CLOSE > MA(20)) & (MA(20) > MA(60))'
|
|
894
924
|
* });
|
|
925
|
+
*
|
|
926
|
+
* // Fundamental screening (note: functions require parentheses)
|
|
927
|
+
* const stocks = await client.quant.screen({
|
|
928
|
+
* formula: '(PE() < 20) & (ROE() > 0.15)'
|
|
929
|
+
* });
|
|
895
930
|
* ```
|
|
896
931
|
*/
|
|
897
932
|
screen(params: ScreenParams): Promise<ScreenedStock[]>;
|
|
@@ -928,6 +963,10 @@ declare class QuantModule {
|
|
|
928
963
|
/**
|
|
929
964
|
* Execute strategy backtest
|
|
930
965
|
*
|
|
966
|
+
* Variables vs Functions:
|
|
967
|
+
* - Variables (no parentheses): CLOSE, OPEN, HIGH, LOW, VOLUME
|
|
968
|
+
* - Functions (with parentheses): MA(20), PE(), ROE(), RSI(14), etc.
|
|
969
|
+
*
|
|
931
970
|
* @param params - Backtest parameters
|
|
932
971
|
* @returns Backtest results
|
|
933
972
|
*
|
|
@@ -955,11 +994,19 @@ declare class QuantModule {
|
|
|
955
994
|
* exitFormula: 'CROSSDOWN(MA(5), MA(20))' // Sell signal
|
|
956
995
|
* });
|
|
957
996
|
*
|
|
958
|
-
* //
|
|
997
|
+
* // Fundamental screening backtest (note: functions require parentheses)
|
|
959
998
|
* const result3 = await client.quant.backtest({
|
|
960
999
|
* startDate: '2023-01-01',
|
|
961
1000
|
* endDate: '2024-01-01',
|
|
962
1001
|
* symbol: '000001',
|
|
1002
|
+
* entryFormula: '(PE() < 20) & (ROE() > 0.15)'
|
|
1003
|
+
* });
|
|
1004
|
+
*
|
|
1005
|
+
* // With custom labels for analysis
|
|
1006
|
+
* const result4 = await client.quant.backtest({
|
|
1007
|
+
* startDate: '2023-01-01',
|
|
1008
|
+
* endDate: '2024-01-01',
|
|
1009
|
+
* symbol: '000001',
|
|
963
1010
|
* entryFormula: 'RSI(14) < 30',
|
|
964
1011
|
* exitFormula: 'RSI(14) > 70',
|
|
965
1012
|
* labels: { rsi: 'RSI(14)', ma20: 'MA(20)' }
|
package/dist/index.d.ts
CHANGED
|
@@ -800,6 +800,8 @@ declare class QuantModule {
|
|
|
800
800
|
/**
|
|
801
801
|
* Get list of available technical indicators
|
|
802
802
|
*
|
|
803
|
+
* All indicators are functions and require parentheses when used (e.g., MA(20), RSI(14), MACD()).
|
|
804
|
+
*
|
|
803
805
|
* @returns Array of indicator definitions
|
|
804
806
|
*
|
|
805
807
|
* @example
|
|
@@ -815,6 +817,10 @@ declare class QuantModule {
|
|
|
815
817
|
/**
|
|
816
818
|
* Compute indicator values for given symbols
|
|
817
819
|
*
|
|
820
|
+
* Variables vs Functions:
|
|
821
|
+
* - Variables (no parentheses): CLOSE, OPEN, HIGH, LOW, VOLUME (aliases: C, O, H, L, V, VOL)
|
|
822
|
+
* - Functions (with parentheses): MA(20), RSI(14), MACD(), etc.
|
|
823
|
+
*
|
|
818
824
|
* @param params - Indicator computation parameters
|
|
819
825
|
* @returns Array of indicator data
|
|
820
826
|
*
|
|
@@ -831,12 +837,22 @@ declare class QuantModule {
|
|
|
831
837
|
* symbols: ['000001'],
|
|
832
838
|
* formula: 'MACD()'
|
|
833
839
|
* });
|
|
840
|
+
*
|
|
841
|
+
* // Standard deviation
|
|
842
|
+
* const data = await client.quant.computeIndicators({
|
|
843
|
+
* symbols: ['000001'],
|
|
844
|
+
* formula: 'STD(CLOSE, 20)'
|
|
845
|
+
* });
|
|
834
846
|
* ```
|
|
835
847
|
*/
|
|
836
848
|
computeIndicators(params: IndicatorComputeParams): Promise<IndicatorData[]>;
|
|
837
849
|
/**
|
|
838
850
|
* Get list of available factors (variables and functions)
|
|
839
851
|
*
|
|
852
|
+
* Variables vs Functions:
|
|
853
|
+
* - Variables (no parentheses): CLOSE, OPEN, HIGH, LOW, VOLUME, PE_TTM, ROE_TTM, etc.
|
|
854
|
+
* - Functions (with parentheses): MA(20), PE(), ROE(), RSI(14), etc.
|
|
855
|
+
*
|
|
840
856
|
* @returns Array of factor definitions organized by level
|
|
841
857
|
*/
|
|
842
858
|
listFactors(): Promise<FactorMeta[]>;
|
|
@@ -845,6 +861,10 @@ declare class QuantModule {
|
|
|
845
861
|
*
|
|
846
862
|
* Uses Mai-language syntax compatible with TongDaXin/TongHuaShun.
|
|
847
863
|
*
|
|
864
|
+
* Variables vs Functions:
|
|
865
|
+
* - Variables (no parentheses): CLOSE, OPEN, HIGH, LOW, VOLUME
|
|
866
|
+
* - Functions (with parentheses): MA(20), PE(), ROE(), RSI(14), etc.
|
|
867
|
+
*
|
|
848
868
|
* @param params - Factor computation parameters
|
|
849
869
|
* @returns Array of factor data
|
|
850
870
|
*
|
|
@@ -867,12 +887,22 @@ declare class QuantModule {
|
|
|
867
887
|
* symbols: ['000001'],
|
|
868
888
|
* formula: 'CLOSE > MA(20)'
|
|
869
889
|
* });
|
|
890
|
+
*
|
|
891
|
+
* // Fundamental factors (note: functions require parentheses)
|
|
892
|
+
* const data = await client.quant.computeFactors({
|
|
893
|
+
* symbols: ['000001'],
|
|
894
|
+
* formula: 'PE()'
|
|
895
|
+
* });
|
|
870
896
|
* ```
|
|
871
897
|
*/
|
|
872
898
|
computeFactors(params: FactorComputeParams): Promise<IndicatorData[]>;
|
|
873
899
|
/**
|
|
874
900
|
* Screen stocks based on factor formula
|
|
875
901
|
*
|
|
902
|
+
* Variables vs Functions:
|
|
903
|
+
* - Variables (no parentheses): CLOSE, OPEN, HIGH, LOW, VOLUME
|
|
904
|
+
* - Functions (with parentheses): MA(20), PE(), ROE(), RSI(14), etc.
|
|
905
|
+
*
|
|
876
906
|
* @param params - Screening parameters
|
|
877
907
|
* @returns Array of stocks that passed the filter
|
|
878
908
|
*
|
|
@@ -892,6 +922,11 @@ declare class QuantModule {
|
|
|
892
922
|
* const stocks = await client.quant.screen({
|
|
893
923
|
* formula: '(CLOSE > MA(20)) & (MA(20) > MA(60))'
|
|
894
924
|
* });
|
|
925
|
+
*
|
|
926
|
+
* // Fundamental screening (note: functions require parentheses)
|
|
927
|
+
* const stocks = await client.quant.screen({
|
|
928
|
+
* formula: '(PE() < 20) & (ROE() > 0.15)'
|
|
929
|
+
* });
|
|
895
930
|
* ```
|
|
896
931
|
*/
|
|
897
932
|
screen(params: ScreenParams): Promise<ScreenedStock[]>;
|
|
@@ -928,6 +963,10 @@ declare class QuantModule {
|
|
|
928
963
|
/**
|
|
929
964
|
* Execute strategy backtest
|
|
930
965
|
*
|
|
966
|
+
* Variables vs Functions:
|
|
967
|
+
* - Variables (no parentheses): CLOSE, OPEN, HIGH, LOW, VOLUME
|
|
968
|
+
* - Functions (with parentheses): MA(20), PE(), ROE(), RSI(14), etc.
|
|
969
|
+
*
|
|
931
970
|
* @param params - Backtest parameters
|
|
932
971
|
* @returns Backtest results
|
|
933
972
|
*
|
|
@@ -955,11 +994,19 @@ declare class QuantModule {
|
|
|
955
994
|
* exitFormula: 'CROSSDOWN(MA(5), MA(20))' // Sell signal
|
|
956
995
|
* });
|
|
957
996
|
*
|
|
958
|
-
* //
|
|
997
|
+
* // Fundamental screening backtest (note: functions require parentheses)
|
|
959
998
|
* const result3 = await client.quant.backtest({
|
|
960
999
|
* startDate: '2023-01-01',
|
|
961
1000
|
* endDate: '2024-01-01',
|
|
962
1001
|
* symbol: '000001',
|
|
1002
|
+
* entryFormula: '(PE() < 20) & (ROE() > 0.15)'
|
|
1003
|
+
* });
|
|
1004
|
+
*
|
|
1005
|
+
* // With custom labels for analysis
|
|
1006
|
+
* const result4 = await client.quant.backtest({
|
|
1007
|
+
* startDate: '2023-01-01',
|
|
1008
|
+
* endDate: '2024-01-01',
|
|
1009
|
+
* symbol: '000001',
|
|
963
1010
|
* entryFormula: 'RSI(14) < 30',
|
|
964
1011
|
* exitFormula: 'RSI(14) > 70',
|
|
965
1012
|
* labels: { rsi: 'RSI(14)', ma20: 'MA(20)' }
|
package/dist/index.js
CHANGED
|
@@ -663,6 +663,8 @@ var QuantModule = class {
|
|
|
663
663
|
/**
|
|
664
664
|
* Get list of available technical indicators
|
|
665
665
|
*
|
|
666
|
+
* All indicators are functions and require parentheses when used (e.g., MA(20), RSI(14), MACD()).
|
|
667
|
+
*
|
|
666
668
|
* @returns Array of indicator definitions
|
|
667
669
|
*
|
|
668
670
|
* @example
|
|
@@ -680,6 +682,10 @@ var QuantModule = class {
|
|
|
680
682
|
/**
|
|
681
683
|
* Compute indicator values for given symbols
|
|
682
684
|
*
|
|
685
|
+
* Variables vs Functions:
|
|
686
|
+
* - Variables (no parentheses): CLOSE, OPEN, HIGH, LOW, VOLUME (aliases: C, O, H, L, V, VOL)
|
|
687
|
+
* - Functions (with parentheses): MA(20), RSI(14), MACD(), etc.
|
|
688
|
+
*
|
|
683
689
|
* @param params - Indicator computation parameters
|
|
684
690
|
* @returns Array of indicator data
|
|
685
691
|
*
|
|
@@ -696,6 +702,12 @@ var QuantModule = class {
|
|
|
696
702
|
* symbols: ['000001'],
|
|
697
703
|
* formula: 'MACD()'
|
|
698
704
|
* });
|
|
705
|
+
*
|
|
706
|
+
* // Standard deviation
|
|
707
|
+
* const data = await client.quant.computeIndicators({
|
|
708
|
+
* symbols: ['000001'],
|
|
709
|
+
* formula: 'STD(CLOSE, 20)'
|
|
710
|
+
* });
|
|
699
711
|
* ```
|
|
700
712
|
*/
|
|
701
713
|
async computeIndicators(params) {
|
|
@@ -714,6 +726,10 @@ var QuantModule = class {
|
|
|
714
726
|
/**
|
|
715
727
|
* Get list of available factors (variables and functions)
|
|
716
728
|
*
|
|
729
|
+
* Variables vs Functions:
|
|
730
|
+
* - Variables (no parentheses): CLOSE, OPEN, HIGH, LOW, VOLUME, PE_TTM, ROE_TTM, etc.
|
|
731
|
+
* - Functions (with parentheses): MA(20), PE(), ROE(), RSI(14), etc.
|
|
732
|
+
*
|
|
717
733
|
* @returns Array of factor definitions organized by level
|
|
718
734
|
*/
|
|
719
735
|
async listFactors() {
|
|
@@ -724,6 +740,10 @@ var QuantModule = class {
|
|
|
724
740
|
*
|
|
725
741
|
* Uses Mai-language syntax compatible with TongDaXin/TongHuaShun.
|
|
726
742
|
*
|
|
743
|
+
* Variables vs Functions:
|
|
744
|
+
* - Variables (no parentheses): CLOSE, OPEN, HIGH, LOW, VOLUME
|
|
745
|
+
* - Functions (with parentheses): MA(20), PE(), ROE(), RSI(14), etc.
|
|
746
|
+
*
|
|
727
747
|
* @param params - Factor computation parameters
|
|
728
748
|
* @returns Array of factor data
|
|
729
749
|
*
|
|
@@ -746,6 +766,12 @@ var QuantModule = class {
|
|
|
746
766
|
* symbols: ['000001'],
|
|
747
767
|
* formula: 'CLOSE > MA(20)'
|
|
748
768
|
* });
|
|
769
|
+
*
|
|
770
|
+
* // Fundamental factors (note: functions require parentheses)
|
|
771
|
+
* const data = await client.quant.computeFactors({
|
|
772
|
+
* symbols: ['000001'],
|
|
773
|
+
* formula: 'PE()'
|
|
774
|
+
* });
|
|
749
775
|
* ```
|
|
750
776
|
*/
|
|
751
777
|
async computeFactors(params) {
|
|
@@ -761,6 +787,10 @@ var QuantModule = class {
|
|
|
761
787
|
/**
|
|
762
788
|
* Screen stocks based on factor formula
|
|
763
789
|
*
|
|
790
|
+
* Variables vs Functions:
|
|
791
|
+
* - Variables (no parentheses): CLOSE, OPEN, HIGH, LOW, VOLUME
|
|
792
|
+
* - Functions (with parentheses): MA(20), PE(), ROE(), RSI(14), etc.
|
|
793
|
+
*
|
|
764
794
|
* @param params - Screening parameters
|
|
765
795
|
* @returns Array of stocks that passed the filter
|
|
766
796
|
*
|
|
@@ -780,6 +810,11 @@ var QuantModule = class {
|
|
|
780
810
|
* const stocks = await client.quant.screen({
|
|
781
811
|
* formula: '(CLOSE > MA(20)) & (MA(20) > MA(60))'
|
|
782
812
|
* });
|
|
813
|
+
*
|
|
814
|
+
* // Fundamental screening (note: functions require parentheses)
|
|
815
|
+
* const stocks = await client.quant.screen({
|
|
816
|
+
* formula: '(PE() < 20) & (ROE() > 0.15)'
|
|
817
|
+
* });
|
|
783
818
|
* ```
|
|
784
819
|
*/
|
|
785
820
|
async screen(params) {
|
|
@@ -846,6 +881,10 @@ var QuantModule = class {
|
|
|
846
881
|
/**
|
|
847
882
|
* Execute strategy backtest
|
|
848
883
|
*
|
|
884
|
+
* Variables vs Functions:
|
|
885
|
+
* - Variables (no parentheses): CLOSE, OPEN, HIGH, LOW, VOLUME
|
|
886
|
+
* - Functions (with parentheses): MA(20), PE(), ROE(), RSI(14), etc.
|
|
887
|
+
*
|
|
849
888
|
* @param params - Backtest parameters
|
|
850
889
|
* @returns Backtest results
|
|
851
890
|
*
|
|
@@ -873,11 +912,19 @@ var QuantModule = class {
|
|
|
873
912
|
* exitFormula: 'CROSSDOWN(MA(5), MA(20))' // Sell signal
|
|
874
913
|
* });
|
|
875
914
|
*
|
|
876
|
-
* //
|
|
915
|
+
* // Fundamental screening backtest (note: functions require parentheses)
|
|
877
916
|
* const result3 = await client.quant.backtest({
|
|
878
917
|
* startDate: '2023-01-01',
|
|
879
918
|
* endDate: '2024-01-01',
|
|
880
919
|
* symbol: '000001',
|
|
920
|
+
* entryFormula: '(PE() < 20) & (ROE() > 0.15)'
|
|
921
|
+
* });
|
|
922
|
+
*
|
|
923
|
+
* // With custom labels for analysis
|
|
924
|
+
* const result4 = await client.quant.backtest({
|
|
925
|
+
* startDate: '2023-01-01',
|
|
926
|
+
* endDate: '2024-01-01',
|
|
927
|
+
* symbol: '000001',
|
|
881
928
|
* entryFormula: 'RSI(14) < 30',
|
|
882
929
|
* exitFormula: 'RSI(14) > 70',
|
|
883
930
|
* labels: { rsi: 'RSI(14)', ma20: 'MA(20)' }
|
|
@@ -1664,7 +1711,7 @@ var Reportify = class {
|
|
|
1664
1711
|
headers: {
|
|
1665
1712
|
Authorization: `Bearer ${this.apiKey}`,
|
|
1666
1713
|
"Content-Type": "application/json",
|
|
1667
|
-
"User-Agent": "reportify-sdk-js/0.3.
|
|
1714
|
+
"User-Agent": "reportify-sdk-js/0.3.3"
|
|
1668
1715
|
},
|
|
1669
1716
|
body: options.body ? JSON.stringify(options.body) : void 0,
|
|
1670
1717
|
signal: controller.signal
|
|
@@ -1725,7 +1772,7 @@ var Reportify = class {
|
|
|
1725
1772
|
headers: {
|
|
1726
1773
|
Authorization: `Bearer ${this.apiKey}`,
|
|
1727
1774
|
"Content-Type": "application/json",
|
|
1728
|
-
"User-Agent": "reportify-sdk-typescript/0.3.
|
|
1775
|
+
"User-Agent": "reportify-sdk-typescript/0.3.3"
|
|
1729
1776
|
}
|
|
1730
1777
|
});
|
|
1731
1778
|
if (!response.ok) {
|
package/dist/index.mjs
CHANGED
|
@@ -621,6 +621,8 @@ var QuantModule = class {
|
|
|
621
621
|
/**
|
|
622
622
|
* Get list of available technical indicators
|
|
623
623
|
*
|
|
624
|
+
* All indicators are functions and require parentheses when used (e.g., MA(20), RSI(14), MACD()).
|
|
625
|
+
*
|
|
624
626
|
* @returns Array of indicator definitions
|
|
625
627
|
*
|
|
626
628
|
* @example
|
|
@@ -638,6 +640,10 @@ var QuantModule = class {
|
|
|
638
640
|
/**
|
|
639
641
|
* Compute indicator values for given symbols
|
|
640
642
|
*
|
|
643
|
+
* Variables vs Functions:
|
|
644
|
+
* - Variables (no parentheses): CLOSE, OPEN, HIGH, LOW, VOLUME (aliases: C, O, H, L, V, VOL)
|
|
645
|
+
* - Functions (with parentheses): MA(20), RSI(14), MACD(), etc.
|
|
646
|
+
*
|
|
641
647
|
* @param params - Indicator computation parameters
|
|
642
648
|
* @returns Array of indicator data
|
|
643
649
|
*
|
|
@@ -654,6 +660,12 @@ var QuantModule = class {
|
|
|
654
660
|
* symbols: ['000001'],
|
|
655
661
|
* formula: 'MACD()'
|
|
656
662
|
* });
|
|
663
|
+
*
|
|
664
|
+
* // Standard deviation
|
|
665
|
+
* const data = await client.quant.computeIndicators({
|
|
666
|
+
* symbols: ['000001'],
|
|
667
|
+
* formula: 'STD(CLOSE, 20)'
|
|
668
|
+
* });
|
|
657
669
|
* ```
|
|
658
670
|
*/
|
|
659
671
|
async computeIndicators(params) {
|
|
@@ -672,6 +684,10 @@ var QuantModule = class {
|
|
|
672
684
|
/**
|
|
673
685
|
* Get list of available factors (variables and functions)
|
|
674
686
|
*
|
|
687
|
+
* Variables vs Functions:
|
|
688
|
+
* - Variables (no parentheses): CLOSE, OPEN, HIGH, LOW, VOLUME, PE_TTM, ROE_TTM, etc.
|
|
689
|
+
* - Functions (with parentheses): MA(20), PE(), ROE(), RSI(14), etc.
|
|
690
|
+
*
|
|
675
691
|
* @returns Array of factor definitions organized by level
|
|
676
692
|
*/
|
|
677
693
|
async listFactors() {
|
|
@@ -682,6 +698,10 @@ var QuantModule = class {
|
|
|
682
698
|
*
|
|
683
699
|
* Uses Mai-language syntax compatible with TongDaXin/TongHuaShun.
|
|
684
700
|
*
|
|
701
|
+
* Variables vs Functions:
|
|
702
|
+
* - Variables (no parentheses): CLOSE, OPEN, HIGH, LOW, VOLUME
|
|
703
|
+
* - Functions (with parentheses): MA(20), PE(), ROE(), RSI(14), etc.
|
|
704
|
+
*
|
|
685
705
|
* @param params - Factor computation parameters
|
|
686
706
|
* @returns Array of factor data
|
|
687
707
|
*
|
|
@@ -704,6 +724,12 @@ var QuantModule = class {
|
|
|
704
724
|
* symbols: ['000001'],
|
|
705
725
|
* formula: 'CLOSE > MA(20)'
|
|
706
726
|
* });
|
|
727
|
+
*
|
|
728
|
+
* // Fundamental factors (note: functions require parentheses)
|
|
729
|
+
* const data = await client.quant.computeFactors({
|
|
730
|
+
* symbols: ['000001'],
|
|
731
|
+
* formula: 'PE()'
|
|
732
|
+
* });
|
|
707
733
|
* ```
|
|
708
734
|
*/
|
|
709
735
|
async computeFactors(params) {
|
|
@@ -719,6 +745,10 @@ var QuantModule = class {
|
|
|
719
745
|
/**
|
|
720
746
|
* Screen stocks based on factor formula
|
|
721
747
|
*
|
|
748
|
+
* Variables vs Functions:
|
|
749
|
+
* - Variables (no parentheses): CLOSE, OPEN, HIGH, LOW, VOLUME
|
|
750
|
+
* - Functions (with parentheses): MA(20), PE(), ROE(), RSI(14), etc.
|
|
751
|
+
*
|
|
722
752
|
* @param params - Screening parameters
|
|
723
753
|
* @returns Array of stocks that passed the filter
|
|
724
754
|
*
|
|
@@ -738,6 +768,11 @@ var QuantModule = class {
|
|
|
738
768
|
* const stocks = await client.quant.screen({
|
|
739
769
|
* formula: '(CLOSE > MA(20)) & (MA(20) > MA(60))'
|
|
740
770
|
* });
|
|
771
|
+
*
|
|
772
|
+
* // Fundamental screening (note: functions require parentheses)
|
|
773
|
+
* const stocks = await client.quant.screen({
|
|
774
|
+
* formula: '(PE() < 20) & (ROE() > 0.15)'
|
|
775
|
+
* });
|
|
741
776
|
* ```
|
|
742
777
|
*/
|
|
743
778
|
async screen(params) {
|
|
@@ -804,6 +839,10 @@ var QuantModule = class {
|
|
|
804
839
|
/**
|
|
805
840
|
* Execute strategy backtest
|
|
806
841
|
*
|
|
842
|
+
* Variables vs Functions:
|
|
843
|
+
* - Variables (no parentheses): CLOSE, OPEN, HIGH, LOW, VOLUME
|
|
844
|
+
* - Functions (with parentheses): MA(20), PE(), ROE(), RSI(14), etc.
|
|
845
|
+
*
|
|
807
846
|
* @param params - Backtest parameters
|
|
808
847
|
* @returns Backtest results
|
|
809
848
|
*
|
|
@@ -831,11 +870,19 @@ var QuantModule = class {
|
|
|
831
870
|
* exitFormula: 'CROSSDOWN(MA(5), MA(20))' // Sell signal
|
|
832
871
|
* });
|
|
833
872
|
*
|
|
834
|
-
* //
|
|
873
|
+
* // Fundamental screening backtest (note: functions require parentheses)
|
|
835
874
|
* const result3 = await client.quant.backtest({
|
|
836
875
|
* startDate: '2023-01-01',
|
|
837
876
|
* endDate: '2024-01-01',
|
|
838
877
|
* symbol: '000001',
|
|
878
|
+
* entryFormula: '(PE() < 20) & (ROE() > 0.15)'
|
|
879
|
+
* });
|
|
880
|
+
*
|
|
881
|
+
* // With custom labels for analysis
|
|
882
|
+
* const result4 = await client.quant.backtest({
|
|
883
|
+
* startDate: '2023-01-01',
|
|
884
|
+
* endDate: '2024-01-01',
|
|
885
|
+
* symbol: '000001',
|
|
839
886
|
* entryFormula: 'RSI(14) < 30',
|
|
840
887
|
* exitFormula: 'RSI(14) > 70',
|
|
841
888
|
* labels: { rsi: 'RSI(14)', ma20: 'MA(20)' }
|
|
@@ -1622,7 +1669,7 @@ var Reportify = class {
|
|
|
1622
1669
|
headers: {
|
|
1623
1670
|
Authorization: `Bearer ${this.apiKey}`,
|
|
1624
1671
|
"Content-Type": "application/json",
|
|
1625
|
-
"User-Agent": "reportify-sdk-js/0.3.
|
|
1672
|
+
"User-Agent": "reportify-sdk-js/0.3.3"
|
|
1626
1673
|
},
|
|
1627
1674
|
body: options.body ? JSON.stringify(options.body) : void 0,
|
|
1628
1675
|
signal: controller.signal
|
|
@@ -1683,7 +1730,7 @@ var Reportify = class {
|
|
|
1683
1730
|
headers: {
|
|
1684
1731
|
Authorization: `Bearer ${this.apiKey}`,
|
|
1685
1732
|
"Content-Type": "application/json",
|
|
1686
|
-
"User-Agent": "reportify-sdk-typescript/0.3.
|
|
1733
|
+
"User-Agent": "reportify-sdk-typescript/0.3.3"
|
|
1687
1734
|
}
|
|
1688
1735
|
});
|
|
1689
1736
|
if (!response.ok) {
|