reportify-sdk 0.3.7 → 0.3.9
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 +6 -9
- package/dist/index.d.mts +23 -29
- package/dist/index.d.ts +23 -29
- package/dist/index.js +25 -40
- package/dist/index.mjs +25 -40
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -48,11 +48,8 @@ const income = await client.stock.incomeStatement('AAPL', { period: 'quarterly'
|
|
|
48
48
|
const balance = await client.stock.balanceSheet('AAPL');
|
|
49
49
|
const cashflow = await client.stock.cashflowStatement('AAPL');
|
|
50
50
|
|
|
51
|
-
//
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
// Real-time quote
|
|
55
|
-
const quote = await client.stock.quote('AAPL');
|
|
51
|
+
// Stock quote (price data)
|
|
52
|
+
const quote = await client.stock.quote('AAPL', { startDate: '2024-01-01' });
|
|
56
53
|
|
|
57
54
|
// Company info (symbols without market prefix)
|
|
58
55
|
const overview = await client.stock.overview({ symbols: 'AAPL' });
|
|
@@ -101,19 +98,19 @@ const result = await client.docs.uploadDocs([
|
|
|
101
98
|
|
|
102
99
|
```typescript
|
|
103
100
|
// Compute technical indicators
|
|
104
|
-
const rsi = await client.quant.
|
|
101
|
+
const rsi = await client.quant.indicatorsCompute({
|
|
105
102
|
symbols: ['000001'],
|
|
106
103
|
formula: 'RSI(14)'
|
|
107
104
|
});
|
|
108
105
|
|
|
109
|
-
const macd = await client.quant.
|
|
106
|
+
const macd = await client.quant.indicatorsCompute({
|
|
110
107
|
symbols: ['000001'],
|
|
111
108
|
formula: 'MACD()'
|
|
112
109
|
});
|
|
113
110
|
|
|
114
111
|
// Screen stocks by formula
|
|
115
|
-
const oversold = await client.quant.
|
|
116
|
-
const goldenCross = await client.quant.
|
|
112
|
+
const oversold = await client.quant.factorsScreen({ formula: 'RSI(14) < 30' });
|
|
113
|
+
const goldenCross = await client.quant.factorsScreen({ formula: 'CROSS(MA(CLOSE, 5), MA(CLOSE, 20))' });
|
|
117
114
|
|
|
118
115
|
// Get OHLCV data
|
|
119
116
|
const ohlcv = await client.quant.ohlcv({ symbol: '000001', startDate: '2024-01-01' });
|
package/dist/index.d.mts
CHANGED
|
@@ -399,28 +399,22 @@ declare class StockModule {
|
|
|
399
399
|
fiscalYear?: string;
|
|
400
400
|
}): Promise<FinancialStatement[]>;
|
|
401
401
|
/**
|
|
402
|
-
* Get historical
|
|
402
|
+
* Get stock quote - current and historical prices with market data
|
|
403
403
|
*
|
|
404
404
|
* @param symbol - Stock symbol
|
|
405
405
|
* @param options - Query options
|
|
406
406
|
*/
|
|
407
|
-
|
|
407
|
+
quote(symbol: string, options?: {
|
|
408
408
|
startDate?: string;
|
|
409
409
|
endDate?: string;
|
|
410
410
|
}): Promise<PriceData[]>;
|
|
411
411
|
/**
|
|
412
|
-
* Get
|
|
413
|
-
*
|
|
414
|
-
* @param symbol - Stock symbol
|
|
415
|
-
*/
|
|
416
|
-
quote(symbol: string): Promise<Quote>;
|
|
417
|
-
/**
|
|
418
|
-
* Get stock index prices
|
|
412
|
+
* Get stock index quote
|
|
419
413
|
*
|
|
420
414
|
* @param symbol - Index symbol (e.g., HSI, SPX, DJI)
|
|
421
415
|
* @param options - Query options
|
|
422
416
|
*/
|
|
423
|
-
|
|
417
|
+
indexQuote(symbol: string, options?: {
|
|
424
418
|
startDate?: string;
|
|
425
419
|
endDate?: string;
|
|
426
420
|
}): Promise<PriceData[]>;
|
|
@@ -763,13 +757,13 @@ interface BacktestResult {
|
|
|
763
757
|
* @example
|
|
764
758
|
* ```typescript
|
|
765
759
|
* // Compute RSI indicator
|
|
766
|
-
* const data = await client.quant.
|
|
760
|
+
* const data = await client.quant.indicatorsCompute({
|
|
767
761
|
* symbols: ['000001'],
|
|
768
762
|
* formula: 'RSI(14)'
|
|
769
763
|
* });
|
|
770
764
|
*
|
|
771
765
|
* // Screen stocks by formula
|
|
772
|
-
* const stocks = await client.quant.
|
|
766
|
+
* const stocks = await client.quant.factorsScreen({
|
|
773
767
|
* formula: 'RSI(14) < 30'
|
|
774
768
|
* });
|
|
775
769
|
* ```
|
|
@@ -786,14 +780,14 @@ declare class QuantModule {
|
|
|
786
780
|
*
|
|
787
781
|
* @example
|
|
788
782
|
* ```typescript
|
|
789
|
-
* const indicators = await client.quant.
|
|
783
|
+
* const indicators = await client.quant.indicators();
|
|
790
784
|
* indicators.forEach(ind => {
|
|
791
785
|
* console.log(`${ind.name}: ${ind.description}`);
|
|
792
786
|
* console.log(` Fields: ${ind.fields.join(', ')}`);
|
|
793
787
|
* });
|
|
794
788
|
* ```
|
|
795
789
|
*/
|
|
796
|
-
|
|
790
|
+
indicators(): Promise<IndicatorMeta[]>;
|
|
797
791
|
/**
|
|
798
792
|
* Compute indicator values for given symbols
|
|
799
793
|
*
|
|
@@ -807,25 +801,25 @@ declare class QuantModule {
|
|
|
807
801
|
* @example
|
|
808
802
|
* ```typescript
|
|
809
803
|
* // RSI indicator
|
|
810
|
-
* const data = await client.quant.
|
|
804
|
+
* const data = await client.quant.indicatorsCompute({
|
|
811
805
|
* symbols: ['000001'],
|
|
812
806
|
* formula: 'RSI(14)'
|
|
813
807
|
* });
|
|
814
808
|
*
|
|
815
809
|
* // MACD indicator
|
|
816
|
-
* const data = await client.quant.
|
|
810
|
+
* const data = await client.quant.indicatorsCompute({
|
|
817
811
|
* symbols: ['000001'],
|
|
818
812
|
* formula: 'MACD()'
|
|
819
813
|
* });
|
|
820
814
|
*
|
|
821
815
|
* // Standard deviation
|
|
822
|
-
* const data = await client.quant.
|
|
816
|
+
* const data = await client.quant.indicatorsCompute({
|
|
823
817
|
* symbols: ['000001'],
|
|
824
818
|
* formula: 'STD(CLOSE, 20)'
|
|
825
819
|
* });
|
|
826
820
|
* ```
|
|
827
821
|
*/
|
|
828
|
-
|
|
822
|
+
indicatorsCompute(params: IndicatorComputeParams): Promise<IndicatorData[]>;
|
|
829
823
|
/**
|
|
830
824
|
* Get list of available factors (variables and functions)
|
|
831
825
|
*
|
|
@@ -835,7 +829,7 @@ declare class QuantModule {
|
|
|
835
829
|
*
|
|
836
830
|
* @returns Array of factor definitions organized by level
|
|
837
831
|
*/
|
|
838
|
-
|
|
832
|
+
factors(): Promise<FactorMeta[]>;
|
|
839
833
|
/**
|
|
840
834
|
* Compute factor values for given symbols
|
|
841
835
|
*
|
|
@@ -851,31 +845,31 @@ declare class QuantModule {
|
|
|
851
845
|
* @example
|
|
852
846
|
* ```typescript
|
|
853
847
|
* // Simple indicator
|
|
854
|
-
* const data = await client.quant.
|
|
848
|
+
* const data = await client.quant.factorsCompute({
|
|
855
849
|
* symbols: ['000001'],
|
|
856
850
|
* formula: 'RSI(14)'
|
|
857
851
|
* });
|
|
858
852
|
*
|
|
859
853
|
* // MACD DIF line
|
|
860
|
-
* const data = await client.quant.
|
|
854
|
+
* const data = await client.quant.factorsCompute({
|
|
861
855
|
* symbols: ['000001'],
|
|
862
856
|
* formula: 'MACD().dif'
|
|
863
857
|
* });
|
|
864
858
|
*
|
|
865
859
|
* // Close above 20-day MA
|
|
866
|
-
* const data = await client.quant.
|
|
860
|
+
* const data = await client.quant.factorsCompute({
|
|
867
861
|
* symbols: ['000001'],
|
|
868
862
|
* formula: 'CLOSE > MA(CLOSE, 20)'
|
|
869
863
|
* });
|
|
870
864
|
*
|
|
871
865
|
* // Fundamental factors (note: functions require parentheses)
|
|
872
|
-
* const data = await client.quant.
|
|
866
|
+
* const data = await client.quant.factorsCompute({
|
|
873
867
|
* symbols: ['000001'],
|
|
874
868
|
* formula: 'PE()'
|
|
875
869
|
* });
|
|
876
870
|
* ```
|
|
877
871
|
*/
|
|
878
|
-
|
|
872
|
+
factorsCompute(params: FactorComputeParams): Promise<IndicatorData[]>;
|
|
879
873
|
/**
|
|
880
874
|
* Screen stocks based on factor formula
|
|
881
875
|
*
|
|
@@ -889,27 +883,27 @@ declare class QuantModule {
|
|
|
889
883
|
* @example
|
|
890
884
|
* ```typescript
|
|
891
885
|
* // RSI oversold
|
|
892
|
-
* const stocks = await client.quant.
|
|
886
|
+
* const stocks = await client.quant.factorsScreen({
|
|
893
887
|
* formula: 'RSI(14) < 30'
|
|
894
888
|
* });
|
|
895
889
|
*
|
|
896
890
|
* // Golden cross
|
|
897
|
-
* const stocks = await client.quant.
|
|
891
|
+
* const stocks = await client.quant.factorsScreen({
|
|
898
892
|
* formula: 'CROSS(MA(CLOSE, 5), MA(CLOSE, 10))'
|
|
899
893
|
* });
|
|
900
894
|
*
|
|
901
895
|
* // Uptrend
|
|
902
|
-
* const stocks = await client.quant.
|
|
896
|
+
* const stocks = await client.quant.factorsScreen({
|
|
903
897
|
* formula: '(CLOSE > MA(CLOSE, 20)) & (MA(CLOSE, 20) > MA(CLOSE, 60))'
|
|
904
898
|
* });
|
|
905
899
|
*
|
|
906
900
|
* // Fundamental screening (note: functions require parentheses)
|
|
907
|
-
* const stocks = await client.quant.
|
|
901
|
+
* const stocks = await client.quant.factorsScreen({
|
|
908
902
|
* formula: '(PE() < 20) & (ROE() > 0.15)'
|
|
909
903
|
* });
|
|
910
904
|
* ```
|
|
911
905
|
*/
|
|
912
|
-
|
|
906
|
+
factorsScreen(params: ScreenParams): Promise<ScreenedStock[]>;
|
|
913
907
|
/**
|
|
914
908
|
* Get OHLCV daily data for a single symbol
|
|
915
909
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -399,28 +399,22 @@ declare class StockModule {
|
|
|
399
399
|
fiscalYear?: string;
|
|
400
400
|
}): Promise<FinancialStatement[]>;
|
|
401
401
|
/**
|
|
402
|
-
* Get historical
|
|
402
|
+
* Get stock quote - current and historical prices with market data
|
|
403
403
|
*
|
|
404
404
|
* @param symbol - Stock symbol
|
|
405
405
|
* @param options - Query options
|
|
406
406
|
*/
|
|
407
|
-
|
|
407
|
+
quote(symbol: string, options?: {
|
|
408
408
|
startDate?: string;
|
|
409
409
|
endDate?: string;
|
|
410
410
|
}): Promise<PriceData[]>;
|
|
411
411
|
/**
|
|
412
|
-
* Get
|
|
413
|
-
*
|
|
414
|
-
* @param symbol - Stock symbol
|
|
415
|
-
*/
|
|
416
|
-
quote(symbol: string): Promise<Quote>;
|
|
417
|
-
/**
|
|
418
|
-
* Get stock index prices
|
|
412
|
+
* Get stock index quote
|
|
419
413
|
*
|
|
420
414
|
* @param symbol - Index symbol (e.g., HSI, SPX, DJI)
|
|
421
415
|
* @param options - Query options
|
|
422
416
|
*/
|
|
423
|
-
|
|
417
|
+
indexQuote(symbol: string, options?: {
|
|
424
418
|
startDate?: string;
|
|
425
419
|
endDate?: string;
|
|
426
420
|
}): Promise<PriceData[]>;
|
|
@@ -763,13 +757,13 @@ interface BacktestResult {
|
|
|
763
757
|
* @example
|
|
764
758
|
* ```typescript
|
|
765
759
|
* // Compute RSI indicator
|
|
766
|
-
* const data = await client.quant.
|
|
760
|
+
* const data = await client.quant.indicatorsCompute({
|
|
767
761
|
* symbols: ['000001'],
|
|
768
762
|
* formula: 'RSI(14)'
|
|
769
763
|
* });
|
|
770
764
|
*
|
|
771
765
|
* // Screen stocks by formula
|
|
772
|
-
* const stocks = await client.quant.
|
|
766
|
+
* const stocks = await client.quant.factorsScreen({
|
|
773
767
|
* formula: 'RSI(14) < 30'
|
|
774
768
|
* });
|
|
775
769
|
* ```
|
|
@@ -786,14 +780,14 @@ declare class QuantModule {
|
|
|
786
780
|
*
|
|
787
781
|
* @example
|
|
788
782
|
* ```typescript
|
|
789
|
-
* const indicators = await client.quant.
|
|
783
|
+
* const indicators = await client.quant.indicators();
|
|
790
784
|
* indicators.forEach(ind => {
|
|
791
785
|
* console.log(`${ind.name}: ${ind.description}`);
|
|
792
786
|
* console.log(` Fields: ${ind.fields.join(', ')}`);
|
|
793
787
|
* });
|
|
794
788
|
* ```
|
|
795
789
|
*/
|
|
796
|
-
|
|
790
|
+
indicators(): Promise<IndicatorMeta[]>;
|
|
797
791
|
/**
|
|
798
792
|
* Compute indicator values for given symbols
|
|
799
793
|
*
|
|
@@ -807,25 +801,25 @@ declare class QuantModule {
|
|
|
807
801
|
* @example
|
|
808
802
|
* ```typescript
|
|
809
803
|
* // RSI indicator
|
|
810
|
-
* const data = await client.quant.
|
|
804
|
+
* const data = await client.quant.indicatorsCompute({
|
|
811
805
|
* symbols: ['000001'],
|
|
812
806
|
* formula: 'RSI(14)'
|
|
813
807
|
* });
|
|
814
808
|
*
|
|
815
809
|
* // MACD indicator
|
|
816
|
-
* const data = await client.quant.
|
|
810
|
+
* const data = await client.quant.indicatorsCompute({
|
|
817
811
|
* symbols: ['000001'],
|
|
818
812
|
* formula: 'MACD()'
|
|
819
813
|
* });
|
|
820
814
|
*
|
|
821
815
|
* // Standard deviation
|
|
822
|
-
* const data = await client.quant.
|
|
816
|
+
* const data = await client.quant.indicatorsCompute({
|
|
823
817
|
* symbols: ['000001'],
|
|
824
818
|
* formula: 'STD(CLOSE, 20)'
|
|
825
819
|
* });
|
|
826
820
|
* ```
|
|
827
821
|
*/
|
|
828
|
-
|
|
822
|
+
indicatorsCompute(params: IndicatorComputeParams): Promise<IndicatorData[]>;
|
|
829
823
|
/**
|
|
830
824
|
* Get list of available factors (variables and functions)
|
|
831
825
|
*
|
|
@@ -835,7 +829,7 @@ declare class QuantModule {
|
|
|
835
829
|
*
|
|
836
830
|
* @returns Array of factor definitions organized by level
|
|
837
831
|
*/
|
|
838
|
-
|
|
832
|
+
factors(): Promise<FactorMeta[]>;
|
|
839
833
|
/**
|
|
840
834
|
* Compute factor values for given symbols
|
|
841
835
|
*
|
|
@@ -851,31 +845,31 @@ declare class QuantModule {
|
|
|
851
845
|
* @example
|
|
852
846
|
* ```typescript
|
|
853
847
|
* // Simple indicator
|
|
854
|
-
* const data = await client.quant.
|
|
848
|
+
* const data = await client.quant.factorsCompute({
|
|
855
849
|
* symbols: ['000001'],
|
|
856
850
|
* formula: 'RSI(14)'
|
|
857
851
|
* });
|
|
858
852
|
*
|
|
859
853
|
* // MACD DIF line
|
|
860
|
-
* const data = await client.quant.
|
|
854
|
+
* const data = await client.quant.factorsCompute({
|
|
861
855
|
* symbols: ['000001'],
|
|
862
856
|
* formula: 'MACD().dif'
|
|
863
857
|
* });
|
|
864
858
|
*
|
|
865
859
|
* // Close above 20-day MA
|
|
866
|
-
* const data = await client.quant.
|
|
860
|
+
* const data = await client.quant.factorsCompute({
|
|
867
861
|
* symbols: ['000001'],
|
|
868
862
|
* formula: 'CLOSE > MA(CLOSE, 20)'
|
|
869
863
|
* });
|
|
870
864
|
*
|
|
871
865
|
* // Fundamental factors (note: functions require parentheses)
|
|
872
|
-
* const data = await client.quant.
|
|
866
|
+
* const data = await client.quant.factorsCompute({
|
|
873
867
|
* symbols: ['000001'],
|
|
874
868
|
* formula: 'PE()'
|
|
875
869
|
* });
|
|
876
870
|
* ```
|
|
877
871
|
*/
|
|
878
|
-
|
|
872
|
+
factorsCompute(params: FactorComputeParams): Promise<IndicatorData[]>;
|
|
879
873
|
/**
|
|
880
874
|
* Screen stocks based on factor formula
|
|
881
875
|
*
|
|
@@ -889,27 +883,27 @@ declare class QuantModule {
|
|
|
889
883
|
* @example
|
|
890
884
|
* ```typescript
|
|
891
885
|
* // RSI oversold
|
|
892
|
-
* const stocks = await client.quant.
|
|
886
|
+
* const stocks = await client.quant.factorsScreen({
|
|
893
887
|
* formula: 'RSI(14) < 30'
|
|
894
888
|
* });
|
|
895
889
|
*
|
|
896
890
|
* // Golden cross
|
|
897
|
-
* const stocks = await client.quant.
|
|
891
|
+
* const stocks = await client.quant.factorsScreen({
|
|
898
892
|
* formula: 'CROSS(MA(CLOSE, 5), MA(CLOSE, 10))'
|
|
899
893
|
* });
|
|
900
894
|
*
|
|
901
895
|
* // Uptrend
|
|
902
|
-
* const stocks = await client.quant.
|
|
896
|
+
* const stocks = await client.quant.factorsScreen({
|
|
903
897
|
* formula: '(CLOSE > MA(CLOSE, 20)) & (MA(CLOSE, 20) > MA(CLOSE, 60))'
|
|
904
898
|
* });
|
|
905
899
|
*
|
|
906
900
|
* // Fundamental screening (note: functions require parentheses)
|
|
907
|
-
* const stocks = await client.quant.
|
|
901
|
+
* const stocks = await client.quant.factorsScreen({
|
|
908
902
|
* formula: '(PE() < 20) & (ROE() > 0.15)'
|
|
909
903
|
* });
|
|
910
904
|
* ```
|
|
911
905
|
*/
|
|
912
|
-
|
|
906
|
+
factorsScreen(params: ScreenParams): Promise<ScreenedStock[]>;
|
|
913
907
|
/**
|
|
914
908
|
* Get OHLCV daily data for a single symbol
|
|
915
909
|
*
|
package/dist/index.js
CHANGED
|
@@ -219,48 +219,33 @@ var StockModule = class {
|
|
|
219
219
|
// Price Data
|
|
220
220
|
// ===========================================================================
|
|
221
221
|
/**
|
|
222
|
-
* Get historical
|
|
222
|
+
* Get stock quote - current and historical prices with market data
|
|
223
223
|
*
|
|
224
224
|
* @param symbol - Stock symbol
|
|
225
225
|
* @param options - Query options
|
|
226
226
|
*/
|
|
227
|
-
async
|
|
227
|
+
async quote(symbol, options = {}) {
|
|
228
228
|
const body = { symbol };
|
|
229
229
|
if (options.startDate) body.start_date = options.startDate;
|
|
230
230
|
if (options.endDate) body.end_date = options.endDate;
|
|
231
231
|
const response = await this.client.post(
|
|
232
|
-
"/v1/stock/
|
|
232
|
+
"/v1/stock/stock-quote",
|
|
233
233
|
body
|
|
234
234
|
);
|
|
235
235
|
return this.normalizeArrayResponse(response);
|
|
236
236
|
}
|
|
237
237
|
/**
|
|
238
|
-
* Get
|
|
239
|
-
*
|
|
240
|
-
* @param symbol - Stock symbol
|
|
241
|
-
*/
|
|
242
|
-
async quote(symbol) {
|
|
243
|
-
const response = await this.client.post(
|
|
244
|
-
"/v1/stock/quote-realtime",
|
|
245
|
-
{ symbol }
|
|
246
|
-
);
|
|
247
|
-
if ("data" in response) {
|
|
248
|
-
return response.data;
|
|
249
|
-
}
|
|
250
|
-
return response;
|
|
251
|
-
}
|
|
252
|
-
/**
|
|
253
|
-
* Get stock index prices
|
|
238
|
+
* Get stock index quote
|
|
254
239
|
*
|
|
255
240
|
* @param symbol - Index symbol (e.g., HSI, SPX, DJI)
|
|
256
241
|
* @param options - Query options
|
|
257
242
|
*/
|
|
258
|
-
async
|
|
243
|
+
async indexQuote(symbol, options = {}) {
|
|
259
244
|
const body = { symbol };
|
|
260
245
|
if (options.startDate) body.start_date = options.startDate;
|
|
261
246
|
if (options.endDate) body.end_date = options.endDate;
|
|
262
247
|
const response = await this.client.post(
|
|
263
|
-
"/v1/stock/index-
|
|
248
|
+
"/v1/stock/index-quote",
|
|
264
249
|
body
|
|
265
250
|
);
|
|
266
251
|
return this.normalizeArrayResponse(response);
|
|
@@ -643,14 +628,14 @@ var QuantModule = class {
|
|
|
643
628
|
*
|
|
644
629
|
* @example
|
|
645
630
|
* ```typescript
|
|
646
|
-
* const indicators = await client.quant.
|
|
631
|
+
* const indicators = await client.quant.indicators();
|
|
647
632
|
* indicators.forEach(ind => {
|
|
648
633
|
* console.log(`${ind.name}: ${ind.description}`);
|
|
649
634
|
* console.log(` Fields: ${ind.fields.join(', ')}`);
|
|
650
635
|
* });
|
|
651
636
|
* ```
|
|
652
637
|
*/
|
|
653
|
-
async
|
|
638
|
+
async indicators() {
|
|
654
639
|
return this.client.get("/v1/quant/indicators");
|
|
655
640
|
}
|
|
656
641
|
/**
|
|
@@ -666,25 +651,25 @@ var QuantModule = class {
|
|
|
666
651
|
* @example
|
|
667
652
|
* ```typescript
|
|
668
653
|
* // RSI indicator
|
|
669
|
-
* const data = await client.quant.
|
|
654
|
+
* const data = await client.quant.indicatorsCompute({
|
|
670
655
|
* symbols: ['000001'],
|
|
671
656
|
* formula: 'RSI(14)'
|
|
672
657
|
* });
|
|
673
658
|
*
|
|
674
659
|
* // MACD indicator
|
|
675
|
-
* const data = await client.quant.
|
|
660
|
+
* const data = await client.quant.indicatorsCompute({
|
|
676
661
|
* symbols: ['000001'],
|
|
677
662
|
* formula: 'MACD()'
|
|
678
663
|
* });
|
|
679
664
|
*
|
|
680
665
|
* // Standard deviation
|
|
681
|
-
* const data = await client.quant.
|
|
666
|
+
* const data = await client.quant.indicatorsCompute({
|
|
682
667
|
* symbols: ['000001'],
|
|
683
668
|
* formula: 'STD(CLOSE, 20)'
|
|
684
669
|
* });
|
|
685
670
|
* ```
|
|
686
671
|
*/
|
|
687
|
-
async
|
|
672
|
+
async indicatorsCompute(params) {
|
|
688
673
|
const response = await this.client.post("/v1/quant/indicators/compute", {
|
|
689
674
|
symbols: params.symbols,
|
|
690
675
|
formula: params.formula,
|
|
@@ -706,7 +691,7 @@ var QuantModule = class {
|
|
|
706
691
|
*
|
|
707
692
|
* @returns Array of factor definitions organized by level
|
|
708
693
|
*/
|
|
709
|
-
async
|
|
694
|
+
async factors() {
|
|
710
695
|
return this.client.get("/v1/quant/factors");
|
|
711
696
|
}
|
|
712
697
|
/**
|
|
@@ -724,31 +709,31 @@ var QuantModule = class {
|
|
|
724
709
|
* @example
|
|
725
710
|
* ```typescript
|
|
726
711
|
* // Simple indicator
|
|
727
|
-
* const data = await client.quant.
|
|
712
|
+
* const data = await client.quant.factorsCompute({
|
|
728
713
|
* symbols: ['000001'],
|
|
729
714
|
* formula: 'RSI(14)'
|
|
730
715
|
* });
|
|
731
716
|
*
|
|
732
717
|
* // MACD DIF line
|
|
733
|
-
* const data = await client.quant.
|
|
718
|
+
* const data = await client.quant.factorsCompute({
|
|
734
719
|
* symbols: ['000001'],
|
|
735
720
|
* formula: 'MACD().dif'
|
|
736
721
|
* });
|
|
737
722
|
*
|
|
738
723
|
* // Close above 20-day MA
|
|
739
|
-
* const data = await client.quant.
|
|
724
|
+
* const data = await client.quant.factorsCompute({
|
|
740
725
|
* symbols: ['000001'],
|
|
741
726
|
* formula: 'CLOSE > MA(CLOSE, 20)'
|
|
742
727
|
* });
|
|
743
728
|
*
|
|
744
729
|
* // Fundamental factors (note: functions require parentheses)
|
|
745
|
-
* const data = await client.quant.
|
|
730
|
+
* const data = await client.quant.factorsCompute({
|
|
746
731
|
* symbols: ['000001'],
|
|
747
732
|
* formula: 'PE()'
|
|
748
733
|
* });
|
|
749
734
|
* ```
|
|
750
735
|
*/
|
|
751
|
-
async
|
|
736
|
+
async factorsCompute(params) {
|
|
752
737
|
const response = await this.client.post("/v1/quant/factors/compute", {
|
|
753
738
|
symbols: params.symbols,
|
|
754
739
|
formula: params.formula,
|
|
@@ -771,27 +756,27 @@ var QuantModule = class {
|
|
|
771
756
|
* @example
|
|
772
757
|
* ```typescript
|
|
773
758
|
* // RSI oversold
|
|
774
|
-
* const stocks = await client.quant.
|
|
759
|
+
* const stocks = await client.quant.factorsScreen({
|
|
775
760
|
* formula: 'RSI(14) < 30'
|
|
776
761
|
* });
|
|
777
762
|
*
|
|
778
763
|
* // Golden cross
|
|
779
|
-
* const stocks = await client.quant.
|
|
764
|
+
* const stocks = await client.quant.factorsScreen({
|
|
780
765
|
* formula: 'CROSS(MA(CLOSE, 5), MA(CLOSE, 10))'
|
|
781
766
|
* });
|
|
782
767
|
*
|
|
783
768
|
* // Uptrend
|
|
784
|
-
* const stocks = await client.quant.
|
|
769
|
+
* const stocks = await client.quant.factorsScreen({
|
|
785
770
|
* formula: '(CLOSE > MA(CLOSE, 20)) & (MA(CLOSE, 20) > MA(CLOSE, 60))'
|
|
786
771
|
* });
|
|
787
772
|
*
|
|
788
773
|
* // Fundamental screening (note: functions require parentheses)
|
|
789
|
-
* const stocks = await client.quant.
|
|
774
|
+
* const stocks = await client.quant.factorsScreen({
|
|
790
775
|
* formula: '(PE() < 20) & (ROE() > 0.15)'
|
|
791
776
|
* });
|
|
792
777
|
* ```
|
|
793
778
|
*/
|
|
794
|
-
async
|
|
779
|
+
async factorsScreen(params) {
|
|
795
780
|
const response = await this.client.post("/v1/quant/factors/screen", {
|
|
796
781
|
formula: params.formula,
|
|
797
782
|
market: params.market || "cn",
|
|
@@ -1685,7 +1670,7 @@ var Reportify = class {
|
|
|
1685
1670
|
headers: {
|
|
1686
1671
|
Authorization: `Bearer ${this.apiKey}`,
|
|
1687
1672
|
"Content-Type": "application/json",
|
|
1688
|
-
"User-Agent": "reportify-sdk-js/0.3.
|
|
1673
|
+
"User-Agent": "reportify-sdk-js/0.3.9"
|
|
1689
1674
|
},
|
|
1690
1675
|
body: options.body ? JSON.stringify(options.body) : void 0,
|
|
1691
1676
|
signal: controller.signal
|
|
@@ -1746,7 +1731,7 @@ var Reportify = class {
|
|
|
1746
1731
|
headers: {
|
|
1747
1732
|
Authorization: `Bearer ${this.apiKey}`,
|
|
1748
1733
|
"Content-Type": "application/json",
|
|
1749
|
-
"User-Agent": "reportify-sdk-typescript/0.3.
|
|
1734
|
+
"User-Agent": "reportify-sdk-typescript/0.3.9"
|
|
1750
1735
|
}
|
|
1751
1736
|
});
|
|
1752
1737
|
if (!response.ok) {
|
package/dist/index.mjs
CHANGED
|
@@ -177,48 +177,33 @@ var StockModule = class {
|
|
|
177
177
|
// Price Data
|
|
178
178
|
// ===========================================================================
|
|
179
179
|
/**
|
|
180
|
-
* Get historical
|
|
180
|
+
* Get stock quote - current and historical prices with market data
|
|
181
181
|
*
|
|
182
182
|
* @param symbol - Stock symbol
|
|
183
183
|
* @param options - Query options
|
|
184
184
|
*/
|
|
185
|
-
async
|
|
185
|
+
async quote(symbol, options = {}) {
|
|
186
186
|
const body = { symbol };
|
|
187
187
|
if (options.startDate) body.start_date = options.startDate;
|
|
188
188
|
if (options.endDate) body.end_date = options.endDate;
|
|
189
189
|
const response = await this.client.post(
|
|
190
|
-
"/v1/stock/
|
|
190
|
+
"/v1/stock/stock-quote",
|
|
191
191
|
body
|
|
192
192
|
);
|
|
193
193
|
return this.normalizeArrayResponse(response);
|
|
194
194
|
}
|
|
195
195
|
/**
|
|
196
|
-
* Get
|
|
197
|
-
*
|
|
198
|
-
* @param symbol - Stock symbol
|
|
199
|
-
*/
|
|
200
|
-
async quote(symbol) {
|
|
201
|
-
const response = await this.client.post(
|
|
202
|
-
"/v1/stock/quote-realtime",
|
|
203
|
-
{ symbol }
|
|
204
|
-
);
|
|
205
|
-
if ("data" in response) {
|
|
206
|
-
return response.data;
|
|
207
|
-
}
|
|
208
|
-
return response;
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* Get stock index prices
|
|
196
|
+
* Get stock index quote
|
|
212
197
|
*
|
|
213
198
|
* @param symbol - Index symbol (e.g., HSI, SPX, DJI)
|
|
214
199
|
* @param options - Query options
|
|
215
200
|
*/
|
|
216
|
-
async
|
|
201
|
+
async indexQuote(symbol, options = {}) {
|
|
217
202
|
const body = { symbol };
|
|
218
203
|
if (options.startDate) body.start_date = options.startDate;
|
|
219
204
|
if (options.endDate) body.end_date = options.endDate;
|
|
220
205
|
const response = await this.client.post(
|
|
221
|
-
"/v1/stock/index-
|
|
206
|
+
"/v1/stock/index-quote",
|
|
222
207
|
body
|
|
223
208
|
);
|
|
224
209
|
return this.normalizeArrayResponse(response);
|
|
@@ -601,14 +586,14 @@ var QuantModule = class {
|
|
|
601
586
|
*
|
|
602
587
|
* @example
|
|
603
588
|
* ```typescript
|
|
604
|
-
* const indicators = await client.quant.
|
|
589
|
+
* const indicators = await client.quant.indicators();
|
|
605
590
|
* indicators.forEach(ind => {
|
|
606
591
|
* console.log(`${ind.name}: ${ind.description}`);
|
|
607
592
|
* console.log(` Fields: ${ind.fields.join(', ')}`);
|
|
608
593
|
* });
|
|
609
594
|
* ```
|
|
610
595
|
*/
|
|
611
|
-
async
|
|
596
|
+
async indicators() {
|
|
612
597
|
return this.client.get("/v1/quant/indicators");
|
|
613
598
|
}
|
|
614
599
|
/**
|
|
@@ -624,25 +609,25 @@ var QuantModule = class {
|
|
|
624
609
|
* @example
|
|
625
610
|
* ```typescript
|
|
626
611
|
* // RSI indicator
|
|
627
|
-
* const data = await client.quant.
|
|
612
|
+
* const data = await client.quant.indicatorsCompute({
|
|
628
613
|
* symbols: ['000001'],
|
|
629
614
|
* formula: 'RSI(14)'
|
|
630
615
|
* });
|
|
631
616
|
*
|
|
632
617
|
* // MACD indicator
|
|
633
|
-
* const data = await client.quant.
|
|
618
|
+
* const data = await client.quant.indicatorsCompute({
|
|
634
619
|
* symbols: ['000001'],
|
|
635
620
|
* formula: 'MACD()'
|
|
636
621
|
* });
|
|
637
622
|
*
|
|
638
623
|
* // Standard deviation
|
|
639
|
-
* const data = await client.quant.
|
|
624
|
+
* const data = await client.quant.indicatorsCompute({
|
|
640
625
|
* symbols: ['000001'],
|
|
641
626
|
* formula: 'STD(CLOSE, 20)'
|
|
642
627
|
* });
|
|
643
628
|
* ```
|
|
644
629
|
*/
|
|
645
|
-
async
|
|
630
|
+
async indicatorsCompute(params) {
|
|
646
631
|
const response = await this.client.post("/v1/quant/indicators/compute", {
|
|
647
632
|
symbols: params.symbols,
|
|
648
633
|
formula: params.formula,
|
|
@@ -664,7 +649,7 @@ var QuantModule = class {
|
|
|
664
649
|
*
|
|
665
650
|
* @returns Array of factor definitions organized by level
|
|
666
651
|
*/
|
|
667
|
-
async
|
|
652
|
+
async factors() {
|
|
668
653
|
return this.client.get("/v1/quant/factors");
|
|
669
654
|
}
|
|
670
655
|
/**
|
|
@@ -682,31 +667,31 @@ var QuantModule = class {
|
|
|
682
667
|
* @example
|
|
683
668
|
* ```typescript
|
|
684
669
|
* // Simple indicator
|
|
685
|
-
* const data = await client.quant.
|
|
670
|
+
* const data = await client.quant.factorsCompute({
|
|
686
671
|
* symbols: ['000001'],
|
|
687
672
|
* formula: 'RSI(14)'
|
|
688
673
|
* });
|
|
689
674
|
*
|
|
690
675
|
* // MACD DIF line
|
|
691
|
-
* const data = await client.quant.
|
|
676
|
+
* const data = await client.quant.factorsCompute({
|
|
692
677
|
* symbols: ['000001'],
|
|
693
678
|
* formula: 'MACD().dif'
|
|
694
679
|
* });
|
|
695
680
|
*
|
|
696
681
|
* // Close above 20-day MA
|
|
697
|
-
* const data = await client.quant.
|
|
682
|
+
* const data = await client.quant.factorsCompute({
|
|
698
683
|
* symbols: ['000001'],
|
|
699
684
|
* formula: 'CLOSE > MA(CLOSE, 20)'
|
|
700
685
|
* });
|
|
701
686
|
*
|
|
702
687
|
* // Fundamental factors (note: functions require parentheses)
|
|
703
|
-
* const data = await client.quant.
|
|
688
|
+
* const data = await client.quant.factorsCompute({
|
|
704
689
|
* symbols: ['000001'],
|
|
705
690
|
* formula: 'PE()'
|
|
706
691
|
* });
|
|
707
692
|
* ```
|
|
708
693
|
*/
|
|
709
|
-
async
|
|
694
|
+
async factorsCompute(params) {
|
|
710
695
|
const response = await this.client.post("/v1/quant/factors/compute", {
|
|
711
696
|
symbols: params.symbols,
|
|
712
697
|
formula: params.formula,
|
|
@@ -729,27 +714,27 @@ var QuantModule = class {
|
|
|
729
714
|
* @example
|
|
730
715
|
* ```typescript
|
|
731
716
|
* // RSI oversold
|
|
732
|
-
* const stocks = await client.quant.
|
|
717
|
+
* const stocks = await client.quant.factorsScreen({
|
|
733
718
|
* formula: 'RSI(14) < 30'
|
|
734
719
|
* });
|
|
735
720
|
*
|
|
736
721
|
* // Golden cross
|
|
737
|
-
* const stocks = await client.quant.
|
|
722
|
+
* const stocks = await client.quant.factorsScreen({
|
|
738
723
|
* formula: 'CROSS(MA(CLOSE, 5), MA(CLOSE, 10))'
|
|
739
724
|
* });
|
|
740
725
|
*
|
|
741
726
|
* // Uptrend
|
|
742
|
-
* const stocks = await client.quant.
|
|
727
|
+
* const stocks = await client.quant.factorsScreen({
|
|
743
728
|
* formula: '(CLOSE > MA(CLOSE, 20)) & (MA(CLOSE, 20) > MA(CLOSE, 60))'
|
|
744
729
|
* });
|
|
745
730
|
*
|
|
746
731
|
* // Fundamental screening (note: functions require parentheses)
|
|
747
|
-
* const stocks = await client.quant.
|
|
732
|
+
* const stocks = await client.quant.factorsScreen({
|
|
748
733
|
* formula: '(PE() < 20) & (ROE() > 0.15)'
|
|
749
734
|
* });
|
|
750
735
|
* ```
|
|
751
736
|
*/
|
|
752
|
-
async
|
|
737
|
+
async factorsScreen(params) {
|
|
753
738
|
const response = await this.client.post("/v1/quant/factors/screen", {
|
|
754
739
|
formula: params.formula,
|
|
755
740
|
market: params.market || "cn",
|
|
@@ -1643,7 +1628,7 @@ var Reportify = class {
|
|
|
1643
1628
|
headers: {
|
|
1644
1629
|
Authorization: `Bearer ${this.apiKey}`,
|
|
1645
1630
|
"Content-Type": "application/json",
|
|
1646
|
-
"User-Agent": "reportify-sdk-js/0.3.
|
|
1631
|
+
"User-Agent": "reportify-sdk-js/0.3.9"
|
|
1647
1632
|
},
|
|
1648
1633
|
body: options.body ? JSON.stringify(options.body) : void 0,
|
|
1649
1634
|
signal: controller.signal
|
|
@@ -1704,7 +1689,7 @@ var Reportify = class {
|
|
|
1704
1689
|
headers: {
|
|
1705
1690
|
Authorization: `Bearer ${this.apiKey}`,
|
|
1706
1691
|
"Content-Type": "application/json",
|
|
1707
|
-
"User-Agent": "reportify-sdk-typescript/0.3.
|
|
1692
|
+
"User-Agent": "reportify-sdk-typescript/0.3.9"
|
|
1708
1693
|
}
|
|
1709
1694
|
});
|
|
1710
1695
|
if (!response.ok) {
|