reportify-sdk 0.3.3 → 0.3.5
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 +4 -5
- package/dist/index.d.mts +13 -33
- package/dist/index.d.ts +13 -33
- package/dist/index.js +16 -43
- package/dist/index.mjs +16 -43
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -58,8 +58,7 @@ const quote = await client.stock.quote('US:AAPL');
|
|
|
58
58
|
const overview = await client.stock.overview('US:AAPL');
|
|
59
59
|
const shareholders = await client.stock.shareholders('US:AAPL');
|
|
60
60
|
|
|
61
|
-
//
|
|
62
|
-
const stocks = await client.stock.screener({ country: 'US', marketCapMoreThan: 1e10 });
|
|
61
|
+
// Earnings calendar
|
|
63
62
|
const earnings = await client.stock.earningsCalendar({ market: 'us', startDate: '2024-01-01', endDate: '2024-01-31' });
|
|
64
63
|
```
|
|
65
64
|
|
|
@@ -114,7 +113,7 @@ const macd = await client.quant.computeIndicators({
|
|
|
114
113
|
|
|
115
114
|
// Screen stocks by formula
|
|
116
115
|
const oversold = await client.quant.screen({ formula: 'RSI(14) < 30' });
|
|
117
|
-
const goldenCross = await client.quant.screen({ formula: 'CROSS(MA(5), MA(20))' });
|
|
116
|
+
const goldenCross = await client.quant.screen({ formula: 'CROSS(MA(CLOSE, 5), MA(CLOSE, 20))' });
|
|
118
117
|
|
|
119
118
|
// Get OHLCV data
|
|
120
119
|
const ohlcv = await client.quant.ohlcv({ symbol: '000001', startDate: '2024-01-01' });
|
|
@@ -125,8 +124,8 @@ const result = await client.quant.backtest({
|
|
|
125
124
|
startDate: '2023-01-01',
|
|
126
125
|
endDate: '2024-01-01',
|
|
127
126
|
symbol: '000001',
|
|
128
|
-
entryFormula: 'CROSS(MA(5), MA(20))',
|
|
129
|
-
exitFormula: 'CROSSDOWN(MA(5), MA(20))'
|
|
127
|
+
entryFormula: 'CROSS(MA(CLOSE, 5), MA(CLOSE, 20))',
|
|
128
|
+
exitFormula: 'CROSSDOWN(MA(CLOSE, 5), MA(CLOSE, 20))'
|
|
130
129
|
});
|
|
131
130
|
console.log(`Total Return: ${(result.total_return_pct * 100).toFixed(2)}%`);
|
|
132
131
|
```
|
package/dist/index.d.mts
CHANGED
|
@@ -424,26 +424,6 @@ declare class StockModule {
|
|
|
424
424
|
startDate?: string;
|
|
425
425
|
endDate?: string;
|
|
426
426
|
}): Promise<PriceData[]>;
|
|
427
|
-
/**
|
|
428
|
-
* Screen stocks based on various criteria
|
|
429
|
-
*/
|
|
430
|
-
screener(options?: {
|
|
431
|
-
marketCapMoreThan?: number;
|
|
432
|
-
marketCapLowerThan?: number;
|
|
433
|
-
priceMoreThan?: number;
|
|
434
|
-
priceLowerThan?: number;
|
|
435
|
-
changePercentageMoreThan?: number;
|
|
436
|
-
changePercentageLowerThan?: number;
|
|
437
|
-
volumeMoreThan?: number;
|
|
438
|
-
volumeLowerThan?: number;
|
|
439
|
-
country?: string;
|
|
440
|
-
exchange?: string;
|
|
441
|
-
dividendYieldMoreThan?: number;
|
|
442
|
-
dividendYieldLowerThan?: number;
|
|
443
|
-
peTtmMoreThan?: number;
|
|
444
|
-
peTtmLowerThan?: number;
|
|
445
|
-
limit?: number;
|
|
446
|
-
}): Promise<CompanyOverview[]>;
|
|
447
427
|
/**
|
|
448
428
|
* Get earnings announcement calendar
|
|
449
429
|
*
|
|
@@ -800,7 +780,7 @@ declare class QuantModule {
|
|
|
800
780
|
/**
|
|
801
781
|
* Get list of available technical indicators
|
|
802
782
|
*
|
|
803
|
-
* All indicators are functions and require parentheses when used (e.g., MA(20), RSI(14), MACD()).
|
|
783
|
+
* All indicators are functions and require parentheses when used (e.g., MA(CLOSE, 20), RSI(14), MACD()).
|
|
804
784
|
*
|
|
805
785
|
* @returns Array of indicator definitions
|
|
806
786
|
*
|
|
@@ -819,7 +799,7 @@ declare class QuantModule {
|
|
|
819
799
|
*
|
|
820
800
|
* Variables vs Functions:
|
|
821
801
|
* - Variables (no parentheses): CLOSE, OPEN, HIGH, LOW, VOLUME (aliases: C, O, H, L, V, VOL)
|
|
822
|
-
* - Functions (
|
|
802
|
+
* - Functions (TongDaXin style: col first, n second): MA(CLOSE, 20), RSI(14), MACD(), etc.
|
|
823
803
|
*
|
|
824
804
|
* @param params - Indicator computation parameters
|
|
825
805
|
* @returns Array of indicator data
|
|
@@ -851,7 +831,7 @@ declare class QuantModule {
|
|
|
851
831
|
*
|
|
852
832
|
* Variables vs Functions:
|
|
853
833
|
* - Variables (no parentheses): CLOSE, OPEN, HIGH, LOW, VOLUME, PE_TTM, ROE_TTM, etc.
|
|
854
|
-
* - Functions (
|
|
834
|
+
* - Functions (TongDaXin style: col first, n second): MA(CLOSE, 20), PE(), ROE(), RSI(14), etc.
|
|
855
835
|
*
|
|
856
836
|
* @returns Array of factor definitions organized by level
|
|
857
837
|
*/
|
|
@@ -863,7 +843,7 @@ declare class QuantModule {
|
|
|
863
843
|
*
|
|
864
844
|
* Variables vs Functions:
|
|
865
845
|
* - Variables (no parentheses): CLOSE, OPEN, HIGH, LOW, VOLUME
|
|
866
|
-
* - Functions (
|
|
846
|
+
* - Functions (TongDaXin style: col first, n second): MA(CLOSE, 20), PE(), ROE(), RSI(14), etc.
|
|
867
847
|
*
|
|
868
848
|
* @param params - Factor computation parameters
|
|
869
849
|
* @returns Array of factor data
|
|
@@ -885,7 +865,7 @@ declare class QuantModule {
|
|
|
885
865
|
* // Close above 20-day MA
|
|
886
866
|
* const data = await client.quant.computeFactors({
|
|
887
867
|
* symbols: ['000001'],
|
|
888
|
-
* formula: 'CLOSE > MA(20)'
|
|
868
|
+
* formula: 'CLOSE > MA(CLOSE, 20)'
|
|
889
869
|
* });
|
|
890
870
|
*
|
|
891
871
|
* // Fundamental factors (note: functions require parentheses)
|
|
@@ -901,7 +881,7 @@ declare class QuantModule {
|
|
|
901
881
|
*
|
|
902
882
|
* Variables vs Functions:
|
|
903
883
|
* - Variables (no parentheses): CLOSE, OPEN, HIGH, LOW, VOLUME
|
|
904
|
-
* - Functions (
|
|
884
|
+
* - Functions (TongDaXin style: col first, n second): MA(CLOSE, 20), PE(), ROE(), RSI(14), etc.
|
|
905
885
|
*
|
|
906
886
|
* @param params - Screening parameters
|
|
907
887
|
* @returns Array of stocks that passed the filter
|
|
@@ -915,12 +895,12 @@ declare class QuantModule {
|
|
|
915
895
|
*
|
|
916
896
|
* // Golden cross
|
|
917
897
|
* const stocks = await client.quant.screen({
|
|
918
|
-
* formula: 'CROSS(MA(5), MA(10))'
|
|
898
|
+
* formula: 'CROSS(MA(CLOSE, 5), MA(CLOSE, 10))'
|
|
919
899
|
* });
|
|
920
900
|
*
|
|
921
901
|
* // Uptrend
|
|
922
902
|
* const stocks = await client.quant.screen({
|
|
923
|
-
* formula: '(CLOSE > MA(20)) & (MA(20) > MA(60))'
|
|
903
|
+
* formula: '(CLOSE > MA(CLOSE, 20)) & (MA(CLOSE, 20) > MA(CLOSE, 60))'
|
|
924
904
|
* });
|
|
925
905
|
*
|
|
926
906
|
* // Fundamental screening (note: functions require parentheses)
|
|
@@ -965,7 +945,7 @@ declare class QuantModule {
|
|
|
965
945
|
*
|
|
966
946
|
* Variables vs Functions:
|
|
967
947
|
* - Variables (no parentheses): CLOSE, OPEN, HIGH, LOW, VOLUME
|
|
968
|
-
* - Functions (
|
|
948
|
+
* - Functions (TongDaXin style: col first, n second): MA(CLOSE, 20), PE(), ROE(), RSI(14), etc.
|
|
969
949
|
*
|
|
970
950
|
* @param params - Backtest parameters
|
|
971
951
|
* @returns Backtest results
|
|
@@ -977,7 +957,7 @@ declare class QuantModule {
|
|
|
977
957
|
* startDate: '2023-01-01',
|
|
978
958
|
* endDate: '2024-01-01',
|
|
979
959
|
* symbol: '000001',
|
|
980
|
-
* entryFormula: 'CROSS(MA(5), MA(20))', // Buy when MA5 crosses above MA20
|
|
960
|
+
* entryFormula: 'CROSS(MA(CLOSE, 5), MA(CLOSE, 20))', // Buy when MA5 crosses above MA20
|
|
981
961
|
* initialCash: 100000
|
|
982
962
|
* });
|
|
983
963
|
*
|
|
@@ -990,8 +970,8 @@ declare class QuantModule {
|
|
|
990
970
|
* startDate: '2023-01-01',
|
|
991
971
|
* endDate: '2024-01-01',
|
|
992
972
|
* symbol: '000001',
|
|
993
|
-
* entryFormula: 'CROSS(MA(5), MA(20))', // Buy signal
|
|
994
|
-
* exitFormula: 'CROSSDOWN(MA(5), MA(20))' // Sell signal
|
|
973
|
+
* entryFormula: 'CROSS(MA(CLOSE, 5), MA(CLOSE, 20))', // Buy signal
|
|
974
|
+
* exitFormula: 'CROSSDOWN(MA(CLOSE, 5), MA(CLOSE, 20))' // Sell signal
|
|
995
975
|
* });
|
|
996
976
|
*
|
|
997
977
|
* // Fundamental screening backtest (note: functions require parentheses)
|
|
@@ -1009,7 +989,7 @@ declare class QuantModule {
|
|
|
1009
989
|
* symbol: '000001',
|
|
1010
990
|
* entryFormula: 'RSI(14) < 30',
|
|
1011
991
|
* exitFormula: 'RSI(14) > 70',
|
|
1012
|
-
* labels: { rsi: 'RSI(14)', ma20: 'MA(20)' }
|
|
992
|
+
* labels: { rsi: 'RSI(14)', ma20: 'MA(CLOSE, 20)' }
|
|
1013
993
|
* });
|
|
1014
994
|
* ```
|
|
1015
995
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -424,26 +424,6 @@ declare class StockModule {
|
|
|
424
424
|
startDate?: string;
|
|
425
425
|
endDate?: string;
|
|
426
426
|
}): Promise<PriceData[]>;
|
|
427
|
-
/**
|
|
428
|
-
* Screen stocks based on various criteria
|
|
429
|
-
*/
|
|
430
|
-
screener(options?: {
|
|
431
|
-
marketCapMoreThan?: number;
|
|
432
|
-
marketCapLowerThan?: number;
|
|
433
|
-
priceMoreThan?: number;
|
|
434
|
-
priceLowerThan?: number;
|
|
435
|
-
changePercentageMoreThan?: number;
|
|
436
|
-
changePercentageLowerThan?: number;
|
|
437
|
-
volumeMoreThan?: number;
|
|
438
|
-
volumeLowerThan?: number;
|
|
439
|
-
country?: string;
|
|
440
|
-
exchange?: string;
|
|
441
|
-
dividendYieldMoreThan?: number;
|
|
442
|
-
dividendYieldLowerThan?: number;
|
|
443
|
-
peTtmMoreThan?: number;
|
|
444
|
-
peTtmLowerThan?: number;
|
|
445
|
-
limit?: number;
|
|
446
|
-
}): Promise<CompanyOverview[]>;
|
|
447
427
|
/**
|
|
448
428
|
* Get earnings announcement calendar
|
|
449
429
|
*
|
|
@@ -800,7 +780,7 @@ declare class QuantModule {
|
|
|
800
780
|
/**
|
|
801
781
|
* Get list of available technical indicators
|
|
802
782
|
*
|
|
803
|
-
* All indicators are functions and require parentheses when used (e.g., MA(20), RSI(14), MACD()).
|
|
783
|
+
* All indicators are functions and require parentheses when used (e.g., MA(CLOSE, 20), RSI(14), MACD()).
|
|
804
784
|
*
|
|
805
785
|
* @returns Array of indicator definitions
|
|
806
786
|
*
|
|
@@ -819,7 +799,7 @@ declare class QuantModule {
|
|
|
819
799
|
*
|
|
820
800
|
* Variables vs Functions:
|
|
821
801
|
* - Variables (no parentheses): CLOSE, OPEN, HIGH, LOW, VOLUME (aliases: C, O, H, L, V, VOL)
|
|
822
|
-
* - Functions (
|
|
802
|
+
* - Functions (TongDaXin style: col first, n second): MA(CLOSE, 20), RSI(14), MACD(), etc.
|
|
823
803
|
*
|
|
824
804
|
* @param params - Indicator computation parameters
|
|
825
805
|
* @returns Array of indicator data
|
|
@@ -851,7 +831,7 @@ declare class QuantModule {
|
|
|
851
831
|
*
|
|
852
832
|
* Variables vs Functions:
|
|
853
833
|
* - Variables (no parentheses): CLOSE, OPEN, HIGH, LOW, VOLUME, PE_TTM, ROE_TTM, etc.
|
|
854
|
-
* - Functions (
|
|
834
|
+
* - Functions (TongDaXin style: col first, n second): MA(CLOSE, 20), PE(), ROE(), RSI(14), etc.
|
|
855
835
|
*
|
|
856
836
|
* @returns Array of factor definitions organized by level
|
|
857
837
|
*/
|
|
@@ -863,7 +843,7 @@ declare class QuantModule {
|
|
|
863
843
|
*
|
|
864
844
|
* Variables vs Functions:
|
|
865
845
|
* - Variables (no parentheses): CLOSE, OPEN, HIGH, LOW, VOLUME
|
|
866
|
-
* - Functions (
|
|
846
|
+
* - Functions (TongDaXin style: col first, n second): MA(CLOSE, 20), PE(), ROE(), RSI(14), etc.
|
|
867
847
|
*
|
|
868
848
|
* @param params - Factor computation parameters
|
|
869
849
|
* @returns Array of factor data
|
|
@@ -885,7 +865,7 @@ declare class QuantModule {
|
|
|
885
865
|
* // Close above 20-day MA
|
|
886
866
|
* const data = await client.quant.computeFactors({
|
|
887
867
|
* symbols: ['000001'],
|
|
888
|
-
* formula: 'CLOSE > MA(20)'
|
|
868
|
+
* formula: 'CLOSE > MA(CLOSE, 20)'
|
|
889
869
|
* });
|
|
890
870
|
*
|
|
891
871
|
* // Fundamental factors (note: functions require parentheses)
|
|
@@ -901,7 +881,7 @@ declare class QuantModule {
|
|
|
901
881
|
*
|
|
902
882
|
* Variables vs Functions:
|
|
903
883
|
* - Variables (no parentheses): CLOSE, OPEN, HIGH, LOW, VOLUME
|
|
904
|
-
* - Functions (
|
|
884
|
+
* - Functions (TongDaXin style: col first, n second): MA(CLOSE, 20), PE(), ROE(), RSI(14), etc.
|
|
905
885
|
*
|
|
906
886
|
* @param params - Screening parameters
|
|
907
887
|
* @returns Array of stocks that passed the filter
|
|
@@ -915,12 +895,12 @@ declare class QuantModule {
|
|
|
915
895
|
*
|
|
916
896
|
* // Golden cross
|
|
917
897
|
* const stocks = await client.quant.screen({
|
|
918
|
-
* formula: 'CROSS(MA(5), MA(10))'
|
|
898
|
+
* formula: 'CROSS(MA(CLOSE, 5), MA(CLOSE, 10))'
|
|
919
899
|
* });
|
|
920
900
|
*
|
|
921
901
|
* // Uptrend
|
|
922
902
|
* const stocks = await client.quant.screen({
|
|
923
|
-
* formula: '(CLOSE > MA(20)) & (MA(20) > MA(60))'
|
|
903
|
+
* formula: '(CLOSE > MA(CLOSE, 20)) & (MA(CLOSE, 20) > MA(CLOSE, 60))'
|
|
924
904
|
* });
|
|
925
905
|
*
|
|
926
906
|
* // Fundamental screening (note: functions require parentheses)
|
|
@@ -965,7 +945,7 @@ declare class QuantModule {
|
|
|
965
945
|
*
|
|
966
946
|
* Variables vs Functions:
|
|
967
947
|
* - Variables (no parentheses): CLOSE, OPEN, HIGH, LOW, VOLUME
|
|
968
|
-
* - Functions (
|
|
948
|
+
* - Functions (TongDaXin style: col first, n second): MA(CLOSE, 20), PE(), ROE(), RSI(14), etc.
|
|
969
949
|
*
|
|
970
950
|
* @param params - Backtest parameters
|
|
971
951
|
* @returns Backtest results
|
|
@@ -977,7 +957,7 @@ declare class QuantModule {
|
|
|
977
957
|
* startDate: '2023-01-01',
|
|
978
958
|
* endDate: '2024-01-01',
|
|
979
959
|
* symbol: '000001',
|
|
980
|
-
* entryFormula: 'CROSS(MA(5), MA(20))', // Buy when MA5 crosses above MA20
|
|
960
|
+
* entryFormula: 'CROSS(MA(CLOSE, 5), MA(CLOSE, 20))', // Buy when MA5 crosses above MA20
|
|
981
961
|
* initialCash: 100000
|
|
982
962
|
* });
|
|
983
963
|
*
|
|
@@ -990,8 +970,8 @@ declare class QuantModule {
|
|
|
990
970
|
* startDate: '2023-01-01',
|
|
991
971
|
* endDate: '2024-01-01',
|
|
992
972
|
* symbol: '000001',
|
|
993
|
-
* entryFormula: 'CROSS(MA(5), MA(20))', // Buy signal
|
|
994
|
-
* exitFormula: 'CROSSDOWN(MA(5), MA(20))' // Sell signal
|
|
973
|
+
* entryFormula: 'CROSS(MA(CLOSE, 5), MA(CLOSE, 20))', // Buy signal
|
|
974
|
+
* exitFormula: 'CROSSDOWN(MA(CLOSE, 5), MA(CLOSE, 20))' // Sell signal
|
|
995
975
|
* });
|
|
996
976
|
*
|
|
997
977
|
* // Fundamental screening backtest (note: functions require parentheses)
|
|
@@ -1009,7 +989,7 @@ declare class QuantModule {
|
|
|
1009
989
|
* symbol: '000001',
|
|
1010
990
|
* entryFormula: 'RSI(14) < 30',
|
|
1011
991
|
* exitFormula: 'RSI(14) > 70',
|
|
1012
|
-
* labels: { rsi: 'RSI(14)', ma20: 'MA(20)' }
|
|
992
|
+
* labels: { rsi: 'RSI(14)', ma20: 'MA(CLOSE, 20)' }
|
|
1013
993
|
* });
|
|
1014
994
|
* ```
|
|
1015
995
|
*/
|
package/dist/index.js
CHANGED
|
@@ -265,35 +265,8 @@ var StockModule = class {
|
|
|
265
265
|
return this.normalizeArrayResponse(response);
|
|
266
266
|
}
|
|
267
267
|
// ===========================================================================
|
|
268
|
-
//
|
|
268
|
+
// Calendar
|
|
269
269
|
// ===========================================================================
|
|
270
|
-
/**
|
|
271
|
-
* Screen stocks based on various criteria
|
|
272
|
-
*/
|
|
273
|
-
async screener(options = {}) {
|
|
274
|
-
const body = {
|
|
275
|
-
limit: options.limit || 100
|
|
276
|
-
};
|
|
277
|
-
if (options.marketCapMoreThan !== void 0) body.market_cap_more_than = options.marketCapMoreThan;
|
|
278
|
-
if (options.marketCapLowerThan !== void 0) body.market_cap_lower_than = options.marketCapLowerThan;
|
|
279
|
-
if (options.priceMoreThan !== void 0) body.price_more_than = options.priceMoreThan;
|
|
280
|
-
if (options.priceLowerThan !== void 0) body.price_lower_than = options.priceLowerThan;
|
|
281
|
-
if (options.changePercentageMoreThan !== void 0) body.change_percentage_more_than = options.changePercentageMoreThan;
|
|
282
|
-
if (options.changePercentageLowerThan !== void 0) body.change_percentage_lower_than = options.changePercentageLowerThan;
|
|
283
|
-
if (options.volumeMoreThan !== void 0) body.volume_more_than = options.volumeMoreThan;
|
|
284
|
-
if (options.volumeLowerThan !== void 0) body.volume_lower_than = options.volumeLowerThan;
|
|
285
|
-
if (options.country) body.country = options.country;
|
|
286
|
-
if (options.exchange) body.exchange = options.exchange;
|
|
287
|
-
if (options.dividendYieldMoreThan !== void 0) body.dividend_yield_more_than = options.dividendYieldMoreThan;
|
|
288
|
-
if (options.dividendYieldLowerThan !== void 0) body.dividend_yield_lower_than = options.dividendYieldLowerThan;
|
|
289
|
-
if (options.peTtmMoreThan !== void 0) body.pe_ttm_more_than = options.peTtmMoreThan;
|
|
290
|
-
if (options.peTtmLowerThan !== void 0) body.pe_ttm_lower_than = options.peTtmLowerThan;
|
|
291
|
-
const response = await this.client.post(
|
|
292
|
-
"/v1/stock/screener",
|
|
293
|
-
body
|
|
294
|
-
);
|
|
295
|
-
return this.normalizeArrayResponse(response);
|
|
296
|
-
}
|
|
297
270
|
/**
|
|
298
271
|
* Get earnings announcement calendar
|
|
299
272
|
*
|
|
@@ -663,7 +636,7 @@ var QuantModule = class {
|
|
|
663
636
|
/**
|
|
664
637
|
* Get list of available technical indicators
|
|
665
638
|
*
|
|
666
|
-
* All indicators are functions and require parentheses when used (e.g., MA(20), RSI(14), MACD()).
|
|
639
|
+
* All indicators are functions and require parentheses when used (e.g., MA(CLOSE, 20), RSI(14), MACD()).
|
|
667
640
|
*
|
|
668
641
|
* @returns Array of indicator definitions
|
|
669
642
|
*
|
|
@@ -684,7 +657,7 @@ var QuantModule = class {
|
|
|
684
657
|
*
|
|
685
658
|
* Variables vs Functions:
|
|
686
659
|
* - Variables (no parentheses): CLOSE, OPEN, HIGH, LOW, VOLUME (aliases: C, O, H, L, V, VOL)
|
|
687
|
-
* - Functions (
|
|
660
|
+
* - Functions (TongDaXin style: col first, n second): MA(CLOSE, 20), RSI(14), MACD(), etc.
|
|
688
661
|
*
|
|
689
662
|
* @param params - Indicator computation parameters
|
|
690
663
|
* @returns Array of indicator data
|
|
@@ -728,7 +701,7 @@ var QuantModule = class {
|
|
|
728
701
|
*
|
|
729
702
|
* Variables vs Functions:
|
|
730
703
|
* - Variables (no parentheses): CLOSE, OPEN, HIGH, LOW, VOLUME, PE_TTM, ROE_TTM, etc.
|
|
731
|
-
* - Functions (
|
|
704
|
+
* - Functions (TongDaXin style: col first, n second): MA(CLOSE, 20), PE(), ROE(), RSI(14), etc.
|
|
732
705
|
*
|
|
733
706
|
* @returns Array of factor definitions organized by level
|
|
734
707
|
*/
|
|
@@ -742,7 +715,7 @@ var QuantModule = class {
|
|
|
742
715
|
*
|
|
743
716
|
* Variables vs Functions:
|
|
744
717
|
* - Variables (no parentheses): CLOSE, OPEN, HIGH, LOW, VOLUME
|
|
745
|
-
* - Functions (
|
|
718
|
+
* - Functions (TongDaXin style: col first, n second): MA(CLOSE, 20), PE(), ROE(), RSI(14), etc.
|
|
746
719
|
*
|
|
747
720
|
* @param params - Factor computation parameters
|
|
748
721
|
* @returns Array of factor data
|
|
@@ -764,7 +737,7 @@ var QuantModule = class {
|
|
|
764
737
|
* // Close above 20-day MA
|
|
765
738
|
* const data = await client.quant.computeFactors({
|
|
766
739
|
* symbols: ['000001'],
|
|
767
|
-
* formula: 'CLOSE > MA(20)'
|
|
740
|
+
* formula: 'CLOSE > MA(CLOSE, 20)'
|
|
768
741
|
* });
|
|
769
742
|
*
|
|
770
743
|
* // Fundamental factors (note: functions require parentheses)
|
|
@@ -789,7 +762,7 @@ var QuantModule = class {
|
|
|
789
762
|
*
|
|
790
763
|
* Variables vs Functions:
|
|
791
764
|
* - Variables (no parentheses): CLOSE, OPEN, HIGH, LOW, VOLUME
|
|
792
|
-
* - Functions (
|
|
765
|
+
* - Functions (TongDaXin style: col first, n second): MA(CLOSE, 20), PE(), ROE(), RSI(14), etc.
|
|
793
766
|
*
|
|
794
767
|
* @param params - Screening parameters
|
|
795
768
|
* @returns Array of stocks that passed the filter
|
|
@@ -803,12 +776,12 @@ var QuantModule = class {
|
|
|
803
776
|
*
|
|
804
777
|
* // Golden cross
|
|
805
778
|
* const stocks = await client.quant.screen({
|
|
806
|
-
* formula: 'CROSS(MA(5), MA(10))'
|
|
779
|
+
* formula: 'CROSS(MA(CLOSE, 5), MA(CLOSE, 10))'
|
|
807
780
|
* });
|
|
808
781
|
*
|
|
809
782
|
* // Uptrend
|
|
810
783
|
* const stocks = await client.quant.screen({
|
|
811
|
-
* formula: '(CLOSE > MA(20)) & (MA(20) > MA(60))'
|
|
784
|
+
* formula: '(CLOSE > MA(CLOSE, 20)) & (MA(CLOSE, 20) > MA(CLOSE, 60))'
|
|
812
785
|
* });
|
|
813
786
|
*
|
|
814
787
|
* // Fundamental screening (note: functions require parentheses)
|
|
@@ -883,7 +856,7 @@ var QuantModule = class {
|
|
|
883
856
|
*
|
|
884
857
|
* Variables vs Functions:
|
|
885
858
|
* - Variables (no parentheses): CLOSE, OPEN, HIGH, LOW, VOLUME
|
|
886
|
-
* - Functions (
|
|
859
|
+
* - Functions (TongDaXin style: col first, n second): MA(CLOSE, 20), PE(), ROE(), RSI(14), etc.
|
|
887
860
|
*
|
|
888
861
|
* @param params - Backtest parameters
|
|
889
862
|
* @returns Backtest results
|
|
@@ -895,7 +868,7 @@ var QuantModule = class {
|
|
|
895
868
|
* startDate: '2023-01-01',
|
|
896
869
|
* endDate: '2024-01-01',
|
|
897
870
|
* symbol: '000001',
|
|
898
|
-
* entryFormula: 'CROSS(MA(5), MA(20))', // Buy when MA5 crosses above MA20
|
|
871
|
+
* entryFormula: 'CROSS(MA(CLOSE, 5), MA(CLOSE, 20))', // Buy when MA5 crosses above MA20
|
|
899
872
|
* initialCash: 100000
|
|
900
873
|
* });
|
|
901
874
|
*
|
|
@@ -908,8 +881,8 @@ var QuantModule = class {
|
|
|
908
881
|
* startDate: '2023-01-01',
|
|
909
882
|
* endDate: '2024-01-01',
|
|
910
883
|
* symbol: '000001',
|
|
911
|
-
* entryFormula: 'CROSS(MA(5), MA(20))', // Buy signal
|
|
912
|
-
* exitFormula: 'CROSSDOWN(MA(5), MA(20))' // Sell signal
|
|
884
|
+
* entryFormula: 'CROSS(MA(CLOSE, 5), MA(CLOSE, 20))', // Buy signal
|
|
885
|
+
* exitFormula: 'CROSSDOWN(MA(CLOSE, 5), MA(CLOSE, 20))' // Sell signal
|
|
913
886
|
* });
|
|
914
887
|
*
|
|
915
888
|
* // Fundamental screening backtest (note: functions require parentheses)
|
|
@@ -927,7 +900,7 @@ var QuantModule = class {
|
|
|
927
900
|
* symbol: '000001',
|
|
928
901
|
* entryFormula: 'RSI(14) < 30',
|
|
929
902
|
* exitFormula: 'RSI(14) > 70',
|
|
930
|
-
* labels: { rsi: 'RSI(14)', ma20: 'MA(20)' }
|
|
903
|
+
* labels: { rsi: 'RSI(14)', ma20: 'MA(CLOSE, 20)' }
|
|
931
904
|
* });
|
|
932
905
|
* ```
|
|
933
906
|
*/
|
|
@@ -1711,7 +1684,7 @@ var Reportify = class {
|
|
|
1711
1684
|
headers: {
|
|
1712
1685
|
Authorization: `Bearer ${this.apiKey}`,
|
|
1713
1686
|
"Content-Type": "application/json",
|
|
1714
|
-
"User-Agent": "reportify-sdk-js/0.3.
|
|
1687
|
+
"User-Agent": "reportify-sdk-js/0.3.5"
|
|
1715
1688
|
},
|
|
1716
1689
|
body: options.body ? JSON.stringify(options.body) : void 0,
|
|
1717
1690
|
signal: controller.signal
|
|
@@ -1772,7 +1745,7 @@ var Reportify = class {
|
|
|
1772
1745
|
headers: {
|
|
1773
1746
|
Authorization: `Bearer ${this.apiKey}`,
|
|
1774
1747
|
"Content-Type": "application/json",
|
|
1775
|
-
"User-Agent": "reportify-sdk-typescript/0.3.
|
|
1748
|
+
"User-Agent": "reportify-sdk-typescript/0.3.5"
|
|
1776
1749
|
}
|
|
1777
1750
|
});
|
|
1778
1751
|
if (!response.ok) {
|
package/dist/index.mjs
CHANGED
|
@@ -223,35 +223,8 @@ var StockModule = class {
|
|
|
223
223
|
return this.normalizeArrayResponse(response);
|
|
224
224
|
}
|
|
225
225
|
// ===========================================================================
|
|
226
|
-
//
|
|
226
|
+
// Calendar
|
|
227
227
|
// ===========================================================================
|
|
228
|
-
/**
|
|
229
|
-
* Screen stocks based on various criteria
|
|
230
|
-
*/
|
|
231
|
-
async screener(options = {}) {
|
|
232
|
-
const body = {
|
|
233
|
-
limit: options.limit || 100
|
|
234
|
-
};
|
|
235
|
-
if (options.marketCapMoreThan !== void 0) body.market_cap_more_than = options.marketCapMoreThan;
|
|
236
|
-
if (options.marketCapLowerThan !== void 0) body.market_cap_lower_than = options.marketCapLowerThan;
|
|
237
|
-
if (options.priceMoreThan !== void 0) body.price_more_than = options.priceMoreThan;
|
|
238
|
-
if (options.priceLowerThan !== void 0) body.price_lower_than = options.priceLowerThan;
|
|
239
|
-
if (options.changePercentageMoreThan !== void 0) body.change_percentage_more_than = options.changePercentageMoreThan;
|
|
240
|
-
if (options.changePercentageLowerThan !== void 0) body.change_percentage_lower_than = options.changePercentageLowerThan;
|
|
241
|
-
if (options.volumeMoreThan !== void 0) body.volume_more_than = options.volumeMoreThan;
|
|
242
|
-
if (options.volumeLowerThan !== void 0) body.volume_lower_than = options.volumeLowerThan;
|
|
243
|
-
if (options.country) body.country = options.country;
|
|
244
|
-
if (options.exchange) body.exchange = options.exchange;
|
|
245
|
-
if (options.dividendYieldMoreThan !== void 0) body.dividend_yield_more_than = options.dividendYieldMoreThan;
|
|
246
|
-
if (options.dividendYieldLowerThan !== void 0) body.dividend_yield_lower_than = options.dividendYieldLowerThan;
|
|
247
|
-
if (options.peTtmMoreThan !== void 0) body.pe_ttm_more_than = options.peTtmMoreThan;
|
|
248
|
-
if (options.peTtmLowerThan !== void 0) body.pe_ttm_lower_than = options.peTtmLowerThan;
|
|
249
|
-
const response = await this.client.post(
|
|
250
|
-
"/v1/stock/screener",
|
|
251
|
-
body
|
|
252
|
-
);
|
|
253
|
-
return this.normalizeArrayResponse(response);
|
|
254
|
-
}
|
|
255
228
|
/**
|
|
256
229
|
* Get earnings announcement calendar
|
|
257
230
|
*
|
|
@@ -621,7 +594,7 @@ var QuantModule = class {
|
|
|
621
594
|
/**
|
|
622
595
|
* Get list of available technical indicators
|
|
623
596
|
*
|
|
624
|
-
* All indicators are functions and require parentheses when used (e.g., MA(20), RSI(14), MACD()).
|
|
597
|
+
* All indicators are functions and require parentheses when used (e.g., MA(CLOSE, 20), RSI(14), MACD()).
|
|
625
598
|
*
|
|
626
599
|
* @returns Array of indicator definitions
|
|
627
600
|
*
|
|
@@ -642,7 +615,7 @@ var QuantModule = class {
|
|
|
642
615
|
*
|
|
643
616
|
* Variables vs Functions:
|
|
644
617
|
* - Variables (no parentheses): CLOSE, OPEN, HIGH, LOW, VOLUME (aliases: C, O, H, L, V, VOL)
|
|
645
|
-
* - Functions (
|
|
618
|
+
* - Functions (TongDaXin style: col first, n second): MA(CLOSE, 20), RSI(14), MACD(), etc.
|
|
646
619
|
*
|
|
647
620
|
* @param params - Indicator computation parameters
|
|
648
621
|
* @returns Array of indicator data
|
|
@@ -686,7 +659,7 @@ var QuantModule = class {
|
|
|
686
659
|
*
|
|
687
660
|
* Variables vs Functions:
|
|
688
661
|
* - Variables (no parentheses): CLOSE, OPEN, HIGH, LOW, VOLUME, PE_TTM, ROE_TTM, etc.
|
|
689
|
-
* - Functions (
|
|
662
|
+
* - Functions (TongDaXin style: col first, n second): MA(CLOSE, 20), PE(), ROE(), RSI(14), etc.
|
|
690
663
|
*
|
|
691
664
|
* @returns Array of factor definitions organized by level
|
|
692
665
|
*/
|
|
@@ -700,7 +673,7 @@ var QuantModule = class {
|
|
|
700
673
|
*
|
|
701
674
|
* Variables vs Functions:
|
|
702
675
|
* - Variables (no parentheses): CLOSE, OPEN, HIGH, LOW, VOLUME
|
|
703
|
-
* - Functions (
|
|
676
|
+
* - Functions (TongDaXin style: col first, n second): MA(CLOSE, 20), PE(), ROE(), RSI(14), etc.
|
|
704
677
|
*
|
|
705
678
|
* @param params - Factor computation parameters
|
|
706
679
|
* @returns Array of factor data
|
|
@@ -722,7 +695,7 @@ var QuantModule = class {
|
|
|
722
695
|
* // Close above 20-day MA
|
|
723
696
|
* const data = await client.quant.computeFactors({
|
|
724
697
|
* symbols: ['000001'],
|
|
725
|
-
* formula: 'CLOSE > MA(20)'
|
|
698
|
+
* formula: 'CLOSE > MA(CLOSE, 20)'
|
|
726
699
|
* });
|
|
727
700
|
*
|
|
728
701
|
* // Fundamental factors (note: functions require parentheses)
|
|
@@ -747,7 +720,7 @@ var QuantModule = class {
|
|
|
747
720
|
*
|
|
748
721
|
* Variables vs Functions:
|
|
749
722
|
* - Variables (no parentheses): CLOSE, OPEN, HIGH, LOW, VOLUME
|
|
750
|
-
* - Functions (
|
|
723
|
+
* - Functions (TongDaXin style: col first, n second): MA(CLOSE, 20), PE(), ROE(), RSI(14), etc.
|
|
751
724
|
*
|
|
752
725
|
* @param params - Screening parameters
|
|
753
726
|
* @returns Array of stocks that passed the filter
|
|
@@ -761,12 +734,12 @@ var QuantModule = class {
|
|
|
761
734
|
*
|
|
762
735
|
* // Golden cross
|
|
763
736
|
* const stocks = await client.quant.screen({
|
|
764
|
-
* formula: 'CROSS(MA(5), MA(10))'
|
|
737
|
+
* formula: 'CROSS(MA(CLOSE, 5), MA(CLOSE, 10))'
|
|
765
738
|
* });
|
|
766
739
|
*
|
|
767
740
|
* // Uptrend
|
|
768
741
|
* const stocks = await client.quant.screen({
|
|
769
|
-
* formula: '(CLOSE > MA(20)) & (MA(20) > MA(60))'
|
|
742
|
+
* formula: '(CLOSE > MA(CLOSE, 20)) & (MA(CLOSE, 20) > MA(CLOSE, 60))'
|
|
770
743
|
* });
|
|
771
744
|
*
|
|
772
745
|
* // Fundamental screening (note: functions require parentheses)
|
|
@@ -841,7 +814,7 @@ var QuantModule = class {
|
|
|
841
814
|
*
|
|
842
815
|
* Variables vs Functions:
|
|
843
816
|
* - Variables (no parentheses): CLOSE, OPEN, HIGH, LOW, VOLUME
|
|
844
|
-
* - Functions (
|
|
817
|
+
* - Functions (TongDaXin style: col first, n second): MA(CLOSE, 20), PE(), ROE(), RSI(14), etc.
|
|
845
818
|
*
|
|
846
819
|
* @param params - Backtest parameters
|
|
847
820
|
* @returns Backtest results
|
|
@@ -853,7 +826,7 @@ var QuantModule = class {
|
|
|
853
826
|
* startDate: '2023-01-01',
|
|
854
827
|
* endDate: '2024-01-01',
|
|
855
828
|
* symbol: '000001',
|
|
856
|
-
* entryFormula: 'CROSS(MA(5), MA(20))', // Buy when MA5 crosses above MA20
|
|
829
|
+
* entryFormula: 'CROSS(MA(CLOSE, 5), MA(CLOSE, 20))', // Buy when MA5 crosses above MA20
|
|
857
830
|
* initialCash: 100000
|
|
858
831
|
* });
|
|
859
832
|
*
|
|
@@ -866,8 +839,8 @@ var QuantModule = class {
|
|
|
866
839
|
* startDate: '2023-01-01',
|
|
867
840
|
* endDate: '2024-01-01',
|
|
868
841
|
* symbol: '000001',
|
|
869
|
-
* entryFormula: 'CROSS(MA(5), MA(20))', // Buy signal
|
|
870
|
-
* exitFormula: 'CROSSDOWN(MA(5), MA(20))' // Sell signal
|
|
842
|
+
* entryFormula: 'CROSS(MA(CLOSE, 5), MA(CLOSE, 20))', // Buy signal
|
|
843
|
+
* exitFormula: 'CROSSDOWN(MA(CLOSE, 5), MA(CLOSE, 20))' // Sell signal
|
|
871
844
|
* });
|
|
872
845
|
*
|
|
873
846
|
* // Fundamental screening backtest (note: functions require parentheses)
|
|
@@ -885,7 +858,7 @@ var QuantModule = class {
|
|
|
885
858
|
* symbol: '000001',
|
|
886
859
|
* entryFormula: 'RSI(14) < 30',
|
|
887
860
|
* exitFormula: 'RSI(14) > 70',
|
|
888
|
-
* labels: { rsi: 'RSI(14)', ma20: 'MA(20)' }
|
|
861
|
+
* labels: { rsi: 'RSI(14)', ma20: 'MA(CLOSE, 20)' }
|
|
889
862
|
* });
|
|
890
863
|
* ```
|
|
891
864
|
*/
|
|
@@ -1669,7 +1642,7 @@ var Reportify = class {
|
|
|
1669
1642
|
headers: {
|
|
1670
1643
|
Authorization: `Bearer ${this.apiKey}`,
|
|
1671
1644
|
"Content-Type": "application/json",
|
|
1672
|
-
"User-Agent": "reportify-sdk-js/0.3.
|
|
1645
|
+
"User-Agent": "reportify-sdk-js/0.3.5"
|
|
1673
1646
|
},
|
|
1674
1647
|
body: options.body ? JSON.stringify(options.body) : void 0,
|
|
1675
1648
|
signal: controller.signal
|
|
@@ -1730,7 +1703,7 @@ var Reportify = class {
|
|
|
1730
1703
|
headers: {
|
|
1731
1704
|
Authorization: `Bearer ${this.apiKey}`,
|
|
1732
1705
|
"Content-Type": "application/json",
|
|
1733
|
-
"User-Agent": "reportify-sdk-typescript/0.3.
|
|
1706
|
+
"User-Agent": "reportify-sdk-typescript/0.3.5"
|
|
1734
1707
|
}
|
|
1735
1708
|
});
|
|
1736
1709
|
if (!response.ok) {
|