reportify-sdk 0.3.1 → 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 +49 -46
- package/dist/index.d.ts +49 -46
- package/dist/index.js +50 -48
- package/dist/index.mjs +50 -48
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -744,19 +744,6 @@ interface OHLCVData {
|
|
|
744
744
|
volume: number;
|
|
745
745
|
[key: string]: unknown;
|
|
746
746
|
}
|
|
747
|
-
type FinancialType = 'income' | 'cashflow' | 'balancesheet' | 'equity';
|
|
748
|
-
interface FinancialsParams {
|
|
749
|
-
financialType: FinancialType;
|
|
750
|
-
symbol: string;
|
|
751
|
-
market?: StockMarket;
|
|
752
|
-
startYear?: number;
|
|
753
|
-
endYear?: number;
|
|
754
|
-
}
|
|
755
|
-
interface FinancialData {
|
|
756
|
-
symbol: string;
|
|
757
|
-
report_period: string;
|
|
758
|
-
[key: string]: unknown;
|
|
759
|
-
}
|
|
760
747
|
interface BacktestParams {
|
|
761
748
|
startDate: string;
|
|
762
749
|
endDate: string;
|
|
@@ -813,6 +800,8 @@ declare class QuantModule {
|
|
|
813
800
|
/**
|
|
814
801
|
* Get list of available technical indicators
|
|
815
802
|
*
|
|
803
|
+
* All indicators are functions and require parentheses when used (e.g., MA(20), RSI(14), MACD()).
|
|
804
|
+
*
|
|
816
805
|
* @returns Array of indicator definitions
|
|
817
806
|
*
|
|
818
807
|
* @example
|
|
@@ -828,6 +817,10 @@ declare class QuantModule {
|
|
|
828
817
|
/**
|
|
829
818
|
* Compute indicator values for given symbols
|
|
830
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
|
+
*
|
|
831
824
|
* @param params - Indicator computation parameters
|
|
832
825
|
* @returns Array of indicator data
|
|
833
826
|
*
|
|
@@ -844,12 +837,22 @@ declare class QuantModule {
|
|
|
844
837
|
* symbols: ['000001'],
|
|
845
838
|
* formula: 'MACD()'
|
|
846
839
|
* });
|
|
840
|
+
*
|
|
841
|
+
* // Standard deviation
|
|
842
|
+
* const data = await client.quant.computeIndicators({
|
|
843
|
+
* symbols: ['000001'],
|
|
844
|
+
* formula: 'STD(CLOSE, 20)'
|
|
845
|
+
* });
|
|
847
846
|
* ```
|
|
848
847
|
*/
|
|
849
848
|
computeIndicators(params: IndicatorComputeParams): Promise<IndicatorData[]>;
|
|
850
849
|
/**
|
|
851
850
|
* Get list of available factors (variables and functions)
|
|
852
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
|
+
*
|
|
853
856
|
* @returns Array of factor definitions organized by level
|
|
854
857
|
*/
|
|
855
858
|
listFactors(): Promise<FactorMeta[]>;
|
|
@@ -858,6 +861,10 @@ declare class QuantModule {
|
|
|
858
861
|
*
|
|
859
862
|
* Uses Mai-language syntax compatible with TongDaXin/TongHuaShun.
|
|
860
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
|
+
*
|
|
861
868
|
* @param params - Factor computation parameters
|
|
862
869
|
* @returns Array of factor data
|
|
863
870
|
*
|
|
@@ -880,12 +887,22 @@ declare class QuantModule {
|
|
|
880
887
|
* symbols: ['000001'],
|
|
881
888
|
* formula: 'CLOSE > MA(20)'
|
|
882
889
|
* });
|
|
890
|
+
*
|
|
891
|
+
* // Fundamental factors (note: functions require parentheses)
|
|
892
|
+
* const data = await client.quant.computeFactors({
|
|
893
|
+
* symbols: ['000001'],
|
|
894
|
+
* formula: 'PE()'
|
|
895
|
+
* });
|
|
883
896
|
* ```
|
|
884
897
|
*/
|
|
885
898
|
computeFactors(params: FactorComputeParams): Promise<IndicatorData[]>;
|
|
886
899
|
/**
|
|
887
900
|
* Screen stocks based on factor formula
|
|
888
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
|
+
*
|
|
889
906
|
* @param params - Screening parameters
|
|
890
907
|
* @returns Array of stocks that passed the filter
|
|
891
908
|
*
|
|
@@ -905,6 +922,11 @@ declare class QuantModule {
|
|
|
905
922
|
* const stocks = await client.quant.screen({
|
|
906
923
|
* formula: '(CLOSE > MA(20)) & (MA(20) > MA(60))'
|
|
907
924
|
* });
|
|
925
|
+
*
|
|
926
|
+
* // Fundamental screening (note: functions require parentheses)
|
|
927
|
+
* const stocks = await client.quant.screen({
|
|
928
|
+
* formula: '(PE() < 20) & (ROE() > 0.15)'
|
|
929
|
+
* });
|
|
908
930
|
* ```
|
|
909
931
|
*/
|
|
910
932
|
screen(params: ScreenParams): Promise<ScreenedStock[]>;
|
|
@@ -938,40 +960,13 @@ declare class QuantModule {
|
|
|
938
960
|
* ```
|
|
939
961
|
*/
|
|
940
962
|
ohlcvBatch(params: BatchOHLCVParams): Promise<OHLCVData[]>;
|
|
941
|
-
/**
|
|
942
|
-
* Get historical financial statement data for a single symbol
|
|
943
|
-
*
|
|
944
|
-
* @param params - Financials parameters
|
|
945
|
-
* @returns Array of financial data sorted by report period
|
|
946
|
-
*
|
|
947
|
-
* @example
|
|
948
|
-
* ```typescript
|
|
949
|
-
* // Get income statement
|
|
950
|
-
* const data = await client.quant.financials({
|
|
951
|
-
* financialType: 'income',
|
|
952
|
-
* symbol: '000001'
|
|
953
|
-
* });
|
|
954
|
-
*
|
|
955
|
-
* // Get balance sheet for specific years
|
|
956
|
-
* const data = await client.quant.financials({
|
|
957
|
-
* financialType: 'balancesheet',
|
|
958
|
-
* symbol: '600519',
|
|
959
|
-
* startYear: 2020,
|
|
960
|
-
* endYear: 2024
|
|
961
|
-
* });
|
|
962
|
-
*
|
|
963
|
-
* // Get cash flow statement for HK stock
|
|
964
|
-
* const data = await client.quant.financials({
|
|
965
|
-
* financialType: 'cashflow',
|
|
966
|
-
* symbol: '00700',
|
|
967
|
-
* market: 'hk'
|
|
968
|
-
* });
|
|
969
|
-
* ```
|
|
970
|
-
*/
|
|
971
|
-
financials(params: FinancialsParams): Promise<FinancialData[]>;
|
|
972
963
|
/**
|
|
973
964
|
* Execute strategy backtest
|
|
974
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
|
+
*
|
|
975
970
|
* @param params - Backtest parameters
|
|
976
971
|
* @returns Backtest results
|
|
977
972
|
*
|
|
@@ -999,11 +994,19 @@ declare class QuantModule {
|
|
|
999
994
|
* exitFormula: 'CROSSDOWN(MA(5), MA(20))' // Sell signal
|
|
1000
995
|
* });
|
|
1001
996
|
*
|
|
1002
|
-
* //
|
|
997
|
+
* // Fundamental screening backtest (note: functions require parentheses)
|
|
1003
998
|
* const result3 = await client.quant.backtest({
|
|
1004
999
|
* startDate: '2023-01-01',
|
|
1005
1000
|
* endDate: '2024-01-01',
|
|
1006
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',
|
|
1007
1010
|
* entryFormula: 'RSI(14) < 30',
|
|
1008
1011
|
* exitFormula: 'RSI(14) > 70',
|
|
1009
1012
|
* labels: { rsi: 'RSI(14)', ma20: 'MA(20)' }
|
|
@@ -1548,4 +1551,4 @@ declare class Reportify {
|
|
|
1548
1551
|
getBytes(path: string): Promise<ArrayBuffer>;
|
|
1549
1552
|
}
|
|
1550
1553
|
|
|
1551
|
-
export { APIError, type AgentConversation, type AgentMessage, AgentModule, AuthenticationError, type BacktestParams, type BacktestResult, type BatchOHLCVParams, type Calendar, type Channel, ChannelsModule, type ChatCompletionOptions, type ChatCompletionResponse, type ChatMode, ChatModule, type Chunk, type ChunkSearchOptions, type CompanyInfo, type CompanyOverview, type Concept, type ConceptDoc, type ConceptEvent, type ConceptFeed, type ConceptStock, ConceptsModule, type DocsListOptions, DocsModule, type Document, type DocumentInput, type EarningsEvent, type EarningsSearchOptions, type FactorComputeParams, type FactorMeta, type
|
|
1554
|
+
export { APIError, type AgentConversation, type AgentMessage, AgentModule, AuthenticationError, type BacktestParams, type BacktestResult, type BatchOHLCVParams, type Calendar, type Channel, ChannelsModule, type ChatCompletionOptions, type ChatCompletionResponse, type ChatMode, ChatModule, type Chunk, type ChunkSearchOptions, type CompanyInfo, type CompanyOverview, type Concept, type ConceptDoc, type ConceptEvent, type ConceptFeed, type ConceptStock, ConceptsModule, type DocsListOptions, DocsModule, type Document, type DocumentInput, type EarningsEvent, type EarningsSearchOptions, type FactorComputeParams, type FactorMeta, type FinancialStatement, type FollowedCompany, type IPOEvent, type IPOStatus, type IndexConstituent, type IndexFund, type IndicatorComputeParams, type IndicatorData, type IndicatorMeta, type IndustryConstituent, KBModule, type KBSearchOptions, type Market, NotFoundError, type OHLCVData, type OHLCVParams, type PaginatedResponse, type Period, type PriceData, QuantModule, type Quote, RateLimitError, Reportify, type ReportifyConfig, ReportifyError, type ScreenParams, type ScreenedStock, SearchModule, type SearchOptions, type Shareholder, type ShareholderType, type StockInfo, type StockMarket, StockModule, TimelineModule, type TimelineOptions, type UploadDocRequest, UserModule };
|
package/dist/index.d.ts
CHANGED
|
@@ -744,19 +744,6 @@ interface OHLCVData {
|
|
|
744
744
|
volume: number;
|
|
745
745
|
[key: string]: unknown;
|
|
746
746
|
}
|
|
747
|
-
type FinancialType = 'income' | 'cashflow' | 'balancesheet' | 'equity';
|
|
748
|
-
interface FinancialsParams {
|
|
749
|
-
financialType: FinancialType;
|
|
750
|
-
symbol: string;
|
|
751
|
-
market?: StockMarket;
|
|
752
|
-
startYear?: number;
|
|
753
|
-
endYear?: number;
|
|
754
|
-
}
|
|
755
|
-
interface FinancialData {
|
|
756
|
-
symbol: string;
|
|
757
|
-
report_period: string;
|
|
758
|
-
[key: string]: unknown;
|
|
759
|
-
}
|
|
760
747
|
interface BacktestParams {
|
|
761
748
|
startDate: string;
|
|
762
749
|
endDate: string;
|
|
@@ -813,6 +800,8 @@ declare class QuantModule {
|
|
|
813
800
|
/**
|
|
814
801
|
* Get list of available technical indicators
|
|
815
802
|
*
|
|
803
|
+
* All indicators are functions and require parentheses when used (e.g., MA(20), RSI(14), MACD()).
|
|
804
|
+
*
|
|
816
805
|
* @returns Array of indicator definitions
|
|
817
806
|
*
|
|
818
807
|
* @example
|
|
@@ -828,6 +817,10 @@ declare class QuantModule {
|
|
|
828
817
|
/**
|
|
829
818
|
* Compute indicator values for given symbols
|
|
830
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
|
+
*
|
|
831
824
|
* @param params - Indicator computation parameters
|
|
832
825
|
* @returns Array of indicator data
|
|
833
826
|
*
|
|
@@ -844,12 +837,22 @@ declare class QuantModule {
|
|
|
844
837
|
* symbols: ['000001'],
|
|
845
838
|
* formula: 'MACD()'
|
|
846
839
|
* });
|
|
840
|
+
*
|
|
841
|
+
* // Standard deviation
|
|
842
|
+
* const data = await client.quant.computeIndicators({
|
|
843
|
+
* symbols: ['000001'],
|
|
844
|
+
* formula: 'STD(CLOSE, 20)'
|
|
845
|
+
* });
|
|
847
846
|
* ```
|
|
848
847
|
*/
|
|
849
848
|
computeIndicators(params: IndicatorComputeParams): Promise<IndicatorData[]>;
|
|
850
849
|
/**
|
|
851
850
|
* Get list of available factors (variables and functions)
|
|
852
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
|
+
*
|
|
853
856
|
* @returns Array of factor definitions organized by level
|
|
854
857
|
*/
|
|
855
858
|
listFactors(): Promise<FactorMeta[]>;
|
|
@@ -858,6 +861,10 @@ declare class QuantModule {
|
|
|
858
861
|
*
|
|
859
862
|
* Uses Mai-language syntax compatible with TongDaXin/TongHuaShun.
|
|
860
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
|
+
*
|
|
861
868
|
* @param params - Factor computation parameters
|
|
862
869
|
* @returns Array of factor data
|
|
863
870
|
*
|
|
@@ -880,12 +887,22 @@ declare class QuantModule {
|
|
|
880
887
|
* symbols: ['000001'],
|
|
881
888
|
* formula: 'CLOSE > MA(20)'
|
|
882
889
|
* });
|
|
890
|
+
*
|
|
891
|
+
* // Fundamental factors (note: functions require parentheses)
|
|
892
|
+
* const data = await client.quant.computeFactors({
|
|
893
|
+
* symbols: ['000001'],
|
|
894
|
+
* formula: 'PE()'
|
|
895
|
+
* });
|
|
883
896
|
* ```
|
|
884
897
|
*/
|
|
885
898
|
computeFactors(params: FactorComputeParams): Promise<IndicatorData[]>;
|
|
886
899
|
/**
|
|
887
900
|
* Screen stocks based on factor formula
|
|
888
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
|
+
*
|
|
889
906
|
* @param params - Screening parameters
|
|
890
907
|
* @returns Array of stocks that passed the filter
|
|
891
908
|
*
|
|
@@ -905,6 +922,11 @@ declare class QuantModule {
|
|
|
905
922
|
* const stocks = await client.quant.screen({
|
|
906
923
|
* formula: '(CLOSE > MA(20)) & (MA(20) > MA(60))'
|
|
907
924
|
* });
|
|
925
|
+
*
|
|
926
|
+
* // Fundamental screening (note: functions require parentheses)
|
|
927
|
+
* const stocks = await client.quant.screen({
|
|
928
|
+
* formula: '(PE() < 20) & (ROE() > 0.15)'
|
|
929
|
+
* });
|
|
908
930
|
* ```
|
|
909
931
|
*/
|
|
910
932
|
screen(params: ScreenParams): Promise<ScreenedStock[]>;
|
|
@@ -938,40 +960,13 @@ declare class QuantModule {
|
|
|
938
960
|
* ```
|
|
939
961
|
*/
|
|
940
962
|
ohlcvBatch(params: BatchOHLCVParams): Promise<OHLCVData[]>;
|
|
941
|
-
/**
|
|
942
|
-
* Get historical financial statement data for a single symbol
|
|
943
|
-
*
|
|
944
|
-
* @param params - Financials parameters
|
|
945
|
-
* @returns Array of financial data sorted by report period
|
|
946
|
-
*
|
|
947
|
-
* @example
|
|
948
|
-
* ```typescript
|
|
949
|
-
* // Get income statement
|
|
950
|
-
* const data = await client.quant.financials({
|
|
951
|
-
* financialType: 'income',
|
|
952
|
-
* symbol: '000001'
|
|
953
|
-
* });
|
|
954
|
-
*
|
|
955
|
-
* // Get balance sheet for specific years
|
|
956
|
-
* const data = await client.quant.financials({
|
|
957
|
-
* financialType: 'balancesheet',
|
|
958
|
-
* symbol: '600519',
|
|
959
|
-
* startYear: 2020,
|
|
960
|
-
* endYear: 2024
|
|
961
|
-
* });
|
|
962
|
-
*
|
|
963
|
-
* // Get cash flow statement for HK stock
|
|
964
|
-
* const data = await client.quant.financials({
|
|
965
|
-
* financialType: 'cashflow',
|
|
966
|
-
* symbol: '00700',
|
|
967
|
-
* market: 'hk'
|
|
968
|
-
* });
|
|
969
|
-
* ```
|
|
970
|
-
*/
|
|
971
|
-
financials(params: FinancialsParams): Promise<FinancialData[]>;
|
|
972
963
|
/**
|
|
973
964
|
* Execute strategy backtest
|
|
974
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
|
+
*
|
|
975
970
|
* @param params - Backtest parameters
|
|
976
971
|
* @returns Backtest results
|
|
977
972
|
*
|
|
@@ -999,11 +994,19 @@ declare class QuantModule {
|
|
|
999
994
|
* exitFormula: 'CROSSDOWN(MA(5), MA(20))' // Sell signal
|
|
1000
995
|
* });
|
|
1001
996
|
*
|
|
1002
|
-
* //
|
|
997
|
+
* // Fundamental screening backtest (note: functions require parentheses)
|
|
1003
998
|
* const result3 = await client.quant.backtest({
|
|
1004
999
|
* startDate: '2023-01-01',
|
|
1005
1000
|
* endDate: '2024-01-01',
|
|
1006
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',
|
|
1007
1010
|
* entryFormula: 'RSI(14) < 30',
|
|
1008
1011
|
* exitFormula: 'RSI(14) > 70',
|
|
1009
1012
|
* labels: { rsi: 'RSI(14)', ma20: 'MA(20)' }
|
|
@@ -1548,4 +1551,4 @@ declare class Reportify {
|
|
|
1548
1551
|
getBytes(path: string): Promise<ArrayBuffer>;
|
|
1549
1552
|
}
|
|
1550
1553
|
|
|
1551
|
-
export { APIError, type AgentConversation, type AgentMessage, AgentModule, AuthenticationError, type BacktestParams, type BacktestResult, type BatchOHLCVParams, type Calendar, type Channel, ChannelsModule, type ChatCompletionOptions, type ChatCompletionResponse, type ChatMode, ChatModule, type Chunk, type ChunkSearchOptions, type CompanyInfo, type CompanyOverview, type Concept, type ConceptDoc, type ConceptEvent, type ConceptFeed, type ConceptStock, ConceptsModule, type DocsListOptions, DocsModule, type Document, type DocumentInput, type EarningsEvent, type EarningsSearchOptions, type FactorComputeParams, type FactorMeta, type
|
|
1554
|
+
export { APIError, type AgentConversation, type AgentMessage, AgentModule, AuthenticationError, type BacktestParams, type BacktestResult, type BatchOHLCVParams, type Calendar, type Channel, ChannelsModule, type ChatCompletionOptions, type ChatCompletionResponse, type ChatMode, ChatModule, type Chunk, type ChunkSearchOptions, type CompanyInfo, type CompanyOverview, type Concept, type ConceptDoc, type ConceptEvent, type ConceptFeed, type ConceptStock, ConceptsModule, type DocsListOptions, DocsModule, type Document, type DocumentInput, type EarningsEvent, type EarningsSearchOptions, type FactorComputeParams, type FactorMeta, type FinancialStatement, type FollowedCompany, type IPOEvent, type IPOStatus, type IndexConstituent, type IndexFund, type IndicatorComputeParams, type IndicatorData, type IndicatorMeta, type IndustryConstituent, KBModule, type KBSearchOptions, type Market, NotFoundError, type OHLCVData, type OHLCVParams, type PaginatedResponse, type Period, type PriceData, QuantModule, type Quote, RateLimitError, Reportify, type ReportifyConfig, ReportifyError, type ScreenParams, type ScreenedStock, SearchModule, type SearchOptions, type Shareholder, type ShareholderType, type StockInfo, type StockMarket, StockModule, TimelineModule, type TimelineOptions, type UploadDocRequest, UserModule };
|
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) {
|
|
@@ -841,56 +876,15 @@ var QuantModule = class {
|
|
|
841
876
|
return response.datas || [];
|
|
842
877
|
}
|
|
843
878
|
// ===========================================================================
|
|
844
|
-
// Financials
|
|
845
|
-
// ===========================================================================
|
|
846
|
-
/**
|
|
847
|
-
* Get historical financial statement data for a single symbol
|
|
848
|
-
*
|
|
849
|
-
* @param params - Financials parameters
|
|
850
|
-
* @returns Array of financial data sorted by report period
|
|
851
|
-
*
|
|
852
|
-
* @example
|
|
853
|
-
* ```typescript
|
|
854
|
-
* // Get income statement
|
|
855
|
-
* const data = await client.quant.financials({
|
|
856
|
-
* financialType: 'income',
|
|
857
|
-
* symbol: '000001'
|
|
858
|
-
* });
|
|
859
|
-
*
|
|
860
|
-
* // Get balance sheet for specific years
|
|
861
|
-
* const data = await client.quant.financials({
|
|
862
|
-
* financialType: 'balancesheet',
|
|
863
|
-
* symbol: '600519',
|
|
864
|
-
* startYear: 2020,
|
|
865
|
-
* endYear: 2024
|
|
866
|
-
* });
|
|
867
|
-
*
|
|
868
|
-
* // Get cash flow statement for HK stock
|
|
869
|
-
* const data = await client.quant.financials({
|
|
870
|
-
* financialType: 'cashflow',
|
|
871
|
-
* symbol: '00700',
|
|
872
|
-
* market: 'hk'
|
|
873
|
-
* });
|
|
874
|
-
* ```
|
|
875
|
-
*/
|
|
876
|
-
async financials(params) {
|
|
877
|
-
const response = await this.client.get(
|
|
878
|
-
`/v1/quant/financials/${params.financialType}`,
|
|
879
|
-
{
|
|
880
|
-
symbol: params.symbol,
|
|
881
|
-
market: params.market || "cn",
|
|
882
|
-
start_year: params.startYear,
|
|
883
|
-
end_year: params.endYear
|
|
884
|
-
}
|
|
885
|
-
);
|
|
886
|
-
return response.datas || [];
|
|
887
|
-
}
|
|
888
|
-
// ===========================================================================
|
|
889
879
|
// Backtest
|
|
890
880
|
// ===========================================================================
|
|
891
881
|
/**
|
|
892
882
|
* Execute strategy backtest
|
|
893
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
|
+
*
|
|
894
888
|
* @param params - Backtest parameters
|
|
895
889
|
* @returns Backtest results
|
|
896
890
|
*
|
|
@@ -918,11 +912,19 @@ var QuantModule = class {
|
|
|
918
912
|
* exitFormula: 'CROSSDOWN(MA(5), MA(20))' // Sell signal
|
|
919
913
|
* });
|
|
920
914
|
*
|
|
921
|
-
* //
|
|
915
|
+
* // Fundamental screening backtest (note: functions require parentheses)
|
|
922
916
|
* const result3 = await client.quant.backtest({
|
|
923
917
|
* startDate: '2023-01-01',
|
|
924
918
|
* endDate: '2024-01-01',
|
|
925
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',
|
|
926
928
|
* entryFormula: 'RSI(14) < 30',
|
|
927
929
|
* exitFormula: 'RSI(14) > 70',
|
|
928
930
|
* labels: { rsi: 'RSI(14)', ma20: 'MA(20)' }
|
|
@@ -1709,7 +1711,7 @@ var Reportify = class {
|
|
|
1709
1711
|
headers: {
|
|
1710
1712
|
Authorization: `Bearer ${this.apiKey}`,
|
|
1711
1713
|
"Content-Type": "application/json",
|
|
1712
|
-
"User-Agent": "reportify-sdk-js/0.3.
|
|
1714
|
+
"User-Agent": "reportify-sdk-js/0.3.3"
|
|
1713
1715
|
},
|
|
1714
1716
|
body: options.body ? JSON.stringify(options.body) : void 0,
|
|
1715
1717
|
signal: controller.signal
|
|
@@ -1770,7 +1772,7 @@ var Reportify = class {
|
|
|
1770
1772
|
headers: {
|
|
1771
1773
|
Authorization: `Bearer ${this.apiKey}`,
|
|
1772
1774
|
"Content-Type": "application/json",
|
|
1773
|
-
"User-Agent": "reportify-sdk-typescript/0.3.
|
|
1775
|
+
"User-Agent": "reportify-sdk-typescript/0.3.3"
|
|
1774
1776
|
}
|
|
1775
1777
|
});
|
|
1776
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) {
|
|
@@ -799,56 +834,15 @@ var QuantModule = class {
|
|
|
799
834
|
return response.datas || [];
|
|
800
835
|
}
|
|
801
836
|
// ===========================================================================
|
|
802
|
-
// Financials
|
|
803
|
-
// ===========================================================================
|
|
804
|
-
/**
|
|
805
|
-
* Get historical financial statement data for a single symbol
|
|
806
|
-
*
|
|
807
|
-
* @param params - Financials parameters
|
|
808
|
-
* @returns Array of financial data sorted by report period
|
|
809
|
-
*
|
|
810
|
-
* @example
|
|
811
|
-
* ```typescript
|
|
812
|
-
* // Get income statement
|
|
813
|
-
* const data = await client.quant.financials({
|
|
814
|
-
* financialType: 'income',
|
|
815
|
-
* symbol: '000001'
|
|
816
|
-
* });
|
|
817
|
-
*
|
|
818
|
-
* // Get balance sheet for specific years
|
|
819
|
-
* const data = await client.quant.financials({
|
|
820
|
-
* financialType: 'balancesheet',
|
|
821
|
-
* symbol: '600519',
|
|
822
|
-
* startYear: 2020,
|
|
823
|
-
* endYear: 2024
|
|
824
|
-
* });
|
|
825
|
-
*
|
|
826
|
-
* // Get cash flow statement for HK stock
|
|
827
|
-
* const data = await client.quant.financials({
|
|
828
|
-
* financialType: 'cashflow',
|
|
829
|
-
* symbol: '00700',
|
|
830
|
-
* market: 'hk'
|
|
831
|
-
* });
|
|
832
|
-
* ```
|
|
833
|
-
*/
|
|
834
|
-
async financials(params) {
|
|
835
|
-
const response = await this.client.get(
|
|
836
|
-
`/v1/quant/financials/${params.financialType}`,
|
|
837
|
-
{
|
|
838
|
-
symbol: params.symbol,
|
|
839
|
-
market: params.market || "cn",
|
|
840
|
-
start_year: params.startYear,
|
|
841
|
-
end_year: params.endYear
|
|
842
|
-
}
|
|
843
|
-
);
|
|
844
|
-
return response.datas || [];
|
|
845
|
-
}
|
|
846
|
-
// ===========================================================================
|
|
847
837
|
// Backtest
|
|
848
838
|
// ===========================================================================
|
|
849
839
|
/**
|
|
850
840
|
* Execute strategy backtest
|
|
851
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
|
+
*
|
|
852
846
|
* @param params - Backtest parameters
|
|
853
847
|
* @returns Backtest results
|
|
854
848
|
*
|
|
@@ -876,11 +870,19 @@ var QuantModule = class {
|
|
|
876
870
|
* exitFormula: 'CROSSDOWN(MA(5), MA(20))' // Sell signal
|
|
877
871
|
* });
|
|
878
872
|
*
|
|
879
|
-
* //
|
|
873
|
+
* // Fundamental screening backtest (note: functions require parentheses)
|
|
880
874
|
* const result3 = await client.quant.backtest({
|
|
881
875
|
* startDate: '2023-01-01',
|
|
882
876
|
* endDate: '2024-01-01',
|
|
883
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',
|
|
884
886
|
* entryFormula: 'RSI(14) < 30',
|
|
885
887
|
* exitFormula: 'RSI(14) > 70',
|
|
886
888
|
* labels: { rsi: 'RSI(14)', ma20: 'MA(20)' }
|
|
@@ -1667,7 +1669,7 @@ var Reportify = class {
|
|
|
1667
1669
|
headers: {
|
|
1668
1670
|
Authorization: `Bearer ${this.apiKey}`,
|
|
1669
1671
|
"Content-Type": "application/json",
|
|
1670
|
-
"User-Agent": "reportify-sdk-js/0.3.
|
|
1672
|
+
"User-Agent": "reportify-sdk-js/0.3.3"
|
|
1671
1673
|
},
|
|
1672
1674
|
body: options.body ? JSON.stringify(options.body) : void 0,
|
|
1673
1675
|
signal: controller.signal
|
|
@@ -1728,7 +1730,7 @@ var Reportify = class {
|
|
|
1728
1730
|
headers: {
|
|
1729
1731
|
Authorization: `Bearer ${this.apiKey}`,
|
|
1730
1732
|
"Content-Type": "application/json",
|
|
1731
|
-
"User-Agent": "reportify-sdk-typescript/0.3.
|
|
1733
|
+
"User-Agent": "reportify-sdk-typescript/0.3.3"
|
|
1732
1734
|
}
|
|
1733
1735
|
});
|
|
1734
1736
|
if (!response.ok) {
|