reportify-sdk 0.1.0 → 0.2.0

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 CHANGED
@@ -426,6 +426,220 @@ declare class DocsModule {
426
426
  searchChunks(query: string, options?: ChunkSearchOptions): Promise<Chunk[]>;
427
427
  }
428
428
 
429
+ /**
430
+ * Quant Module
431
+ *
432
+ * Provides quantitative analysis tools including indicators, factors, quotes, and backtesting.
433
+ */
434
+
435
+ interface IndicatorParams {
436
+ symbols: string[];
437
+ indicators: string[];
438
+ startDate?: string;
439
+ endDate?: string;
440
+ interval?: '1d' | '1w' | '1m';
441
+ params?: Record<string, unknown>;
442
+ }
443
+ interface IndicatorDefinition {
444
+ name: string;
445
+ description: string;
446
+ category: string;
447
+ parameters: Array<{
448
+ name: string;
449
+ type: string;
450
+ default?: unknown;
451
+ description: string;
452
+ }>;
453
+ }
454
+ interface FactorParams {
455
+ symbols: string[];
456
+ factors: string[];
457
+ startDate?: string;
458
+ endDate?: string;
459
+ frequency?: 'daily' | 'weekly' | 'monthly';
460
+ }
461
+ interface FactorDefinition {
462
+ name: string;
463
+ category: string;
464
+ description: string;
465
+ }
466
+ interface QuoteParams {
467
+ symbols: string[];
468
+ fields?: string[];
469
+ }
470
+ interface QuoteHistoryParams {
471
+ symbols: string[];
472
+ startDate?: string;
473
+ endDate?: string;
474
+ interval?: '1d' | '1w' | '1m';
475
+ adjust?: 'forward' | 'backward' | 'none';
476
+ limit?: number;
477
+ }
478
+ interface BacktestStrategy {
479
+ type: string;
480
+ universe: string[];
481
+ rebalance?: 'daily' | 'weekly' | 'monthly' | 'quarterly';
482
+ [key: string]: unknown;
483
+ }
484
+ interface BacktestParams {
485
+ strategy: BacktestStrategy;
486
+ startDate: string;
487
+ endDate: string;
488
+ initialCapital?: number;
489
+ benchmark?: string;
490
+ }
491
+ interface BacktestMetrics {
492
+ totalReturn: number;
493
+ annualizedReturn: number;
494
+ sharpeRatio: number;
495
+ maxDrawdown: number;
496
+ winRate: number;
497
+ volatility: number;
498
+ }
499
+ interface BacktestResult {
500
+ backtestId: string;
501
+ status: 'pending' | 'running' | 'completed' | 'failed';
502
+ metrics?: BacktestMetrics;
503
+ error?: string;
504
+ }
505
+ interface IndicatorData {
506
+ date: string;
507
+ symbol: string;
508
+ [key: string]: unknown;
509
+ }
510
+ interface FactorData {
511
+ date: string;
512
+ symbol: string;
513
+ [key: string]: unknown;
514
+ }
515
+ interface QuoteData {
516
+ symbol: string;
517
+ price: number;
518
+ change: number;
519
+ changePercent: number;
520
+ volume: number;
521
+ high: number;
522
+ low: number;
523
+ open: number;
524
+ previousClose: number;
525
+ marketCap?: number;
526
+ timestamp: number;
527
+ }
528
+ interface TradeData {
529
+ date: string;
530
+ symbol: string;
531
+ action: 'buy' | 'sell';
532
+ quantity: number;
533
+ price: number;
534
+ value: number;
535
+ }
536
+ interface ReturnData {
537
+ date: string;
538
+ portfolioValue: number;
539
+ dailyReturn: number;
540
+ cumulativeReturn: number;
541
+ benchmarkReturn?: number;
542
+ }
543
+ /**
544
+ * Quantitative analysis module
545
+ *
546
+ * @example
547
+ * ```typescript
548
+ * const indicators = await client.quant.indicators({
549
+ * symbols: ['US:AAPL'],
550
+ * indicators: ['ma', 'rsi'],
551
+ * params: { ma_period: 20 }
552
+ * });
553
+ * ```
554
+ */
555
+ declare class QuantModule {
556
+ private client;
557
+ constructor(client: Reportify);
558
+ /**
559
+ * Get technical indicators for given symbols
560
+ *
561
+ * @param params - Indicator parameters
562
+ * @returns Array of indicator data
563
+ */
564
+ indicators(params: IndicatorParams): Promise<IndicatorData[]>;
565
+ /**
566
+ * Get list of available technical indicators
567
+ */
568
+ indicatorList(): Promise<IndicatorDefinition[]>;
569
+ /**
570
+ * Get factor data for given symbols
571
+ *
572
+ * @param params - Factor parameters
573
+ * @returns Array of factor data
574
+ */
575
+ factors(params: FactorParams): Promise<FactorData[]>;
576
+ /**
577
+ * Get list of available factors
578
+ */
579
+ factorList(): Promise<FactorDefinition[]>;
580
+ /**
581
+ * Get factor exposure for given symbols
582
+ *
583
+ * @param symbols - Stock symbols
584
+ * @param date - Specific date (optional)
585
+ */
586
+ factorExposure(symbols: string[], date?: string): Promise<FactorData[]>;
587
+ /**
588
+ * Get real-time quotes for given symbols
589
+ *
590
+ * @param params - Quote parameters
591
+ * @returns Array of quote data
592
+ */
593
+ quotes(params: QuoteParams): Promise<QuoteData[]>;
594
+ /**
595
+ * Get historical quotes data
596
+ *
597
+ * @param params - History parameters
598
+ * @returns Array of historical OHLCV data
599
+ */
600
+ quotesHistory(params: QuoteHistoryParams): Promise<IndicatorData[]>;
601
+ /**
602
+ * Run a backtest for a given strategy
603
+ *
604
+ * @param params - Backtest parameters
605
+ * @returns Backtest result with job ID and metrics
606
+ *
607
+ * @example
608
+ * ```typescript
609
+ * const result = await client.quant.backtest({
610
+ * strategy: {
611
+ * type: 'momentum',
612
+ * universe: ['US:AAPL', 'US:MSFT', 'US:GOOGL'],
613
+ * rebalance: 'monthly',
614
+ * top_n: 2
615
+ * },
616
+ * startDate: '2020-01-01',
617
+ * endDate: '2024-01-01',
618
+ * benchmark: 'US:SPY'
619
+ * });
620
+ * ```
621
+ */
622
+ backtest(params: BacktestParams): Promise<BacktestResult>;
623
+ /**
624
+ * Get backtest result by ID
625
+ *
626
+ * @param backtestId - Backtest job ID
627
+ */
628
+ backtestResult(backtestId: string): Promise<BacktestResult>;
629
+ /**
630
+ * Get backtest return series
631
+ *
632
+ * @param backtestId - Backtest job ID
633
+ */
634
+ backtestReturns(backtestId: string): Promise<ReturnData[]>;
635
+ /**
636
+ * Get backtest trade history
637
+ *
638
+ * @param backtestId - Backtest job ID
639
+ */
640
+ backtestTrades(backtestId: string): Promise<TradeData[]>;
641
+ }
642
+
429
643
  /**
430
644
  * Reportify Client
431
645
  *
@@ -454,6 +668,7 @@ declare class Reportify {
454
668
  readonly timeline: TimelineModule;
455
669
  readonly kb: KBModule;
456
670
  readonly docs: DocsModule;
671
+ readonly quant: QuantModule;
457
672
  constructor(config: ReportifyConfig);
458
673
  /**
459
674
  * Make an HTTP request to the API
@@ -502,4 +717,4 @@ declare class Reportify {
502
717
  searchTranscripts(query: string, options?: SearchOptions): Promise<Document[]>;
503
718
  }
504
719
 
505
- export { APIError, AuthenticationError, type Chunk, type CompanyInfo, type CompanyOverview, DocsModule, type Document, type EarningsEvent, type FinancialStatement, type IPOEvent, type IPOStatus, type Interval, KBModule, type KBSearchOptions, type Market, NotFoundError, type PaginatedResponse, type Period, type PriceAdjust, type PriceData, type Quote, RateLimitError, Reportify, type ReportifyConfig, ReportifyError, type SearchOptions, type Shareholder, type StockInfo, StockModule, TimelineModule, type TimelineOptions };
720
+ export { APIError, AuthenticationError, type BacktestMetrics, type BacktestParams, type BacktestResult, type BacktestStrategy, type Chunk, type CompanyInfo, type CompanyOverview, DocsModule, type Document, type EarningsEvent, type FactorData, type FactorDefinition, type FactorParams, type FinancialStatement, type IPOEvent, type IPOStatus, type IndicatorData, type IndicatorDefinition, type IndicatorParams, type Interval, KBModule, type KBSearchOptions, type Market, NotFoundError, type PaginatedResponse, type Period, type PriceAdjust, type PriceData, QuantModule, type Quote, type QuoteData, type QuoteHistoryParams, type QuoteParams, RateLimitError, Reportify, type ReportifyConfig, ReportifyError, type ReturnData, type SearchOptions, type Shareholder, type StockInfo, StockModule, TimelineModule, type TimelineOptions, type TradeData };
package/dist/index.d.ts CHANGED
@@ -426,6 +426,220 @@ declare class DocsModule {
426
426
  searchChunks(query: string, options?: ChunkSearchOptions): Promise<Chunk[]>;
427
427
  }
428
428
 
429
+ /**
430
+ * Quant Module
431
+ *
432
+ * Provides quantitative analysis tools including indicators, factors, quotes, and backtesting.
433
+ */
434
+
435
+ interface IndicatorParams {
436
+ symbols: string[];
437
+ indicators: string[];
438
+ startDate?: string;
439
+ endDate?: string;
440
+ interval?: '1d' | '1w' | '1m';
441
+ params?: Record<string, unknown>;
442
+ }
443
+ interface IndicatorDefinition {
444
+ name: string;
445
+ description: string;
446
+ category: string;
447
+ parameters: Array<{
448
+ name: string;
449
+ type: string;
450
+ default?: unknown;
451
+ description: string;
452
+ }>;
453
+ }
454
+ interface FactorParams {
455
+ symbols: string[];
456
+ factors: string[];
457
+ startDate?: string;
458
+ endDate?: string;
459
+ frequency?: 'daily' | 'weekly' | 'monthly';
460
+ }
461
+ interface FactorDefinition {
462
+ name: string;
463
+ category: string;
464
+ description: string;
465
+ }
466
+ interface QuoteParams {
467
+ symbols: string[];
468
+ fields?: string[];
469
+ }
470
+ interface QuoteHistoryParams {
471
+ symbols: string[];
472
+ startDate?: string;
473
+ endDate?: string;
474
+ interval?: '1d' | '1w' | '1m';
475
+ adjust?: 'forward' | 'backward' | 'none';
476
+ limit?: number;
477
+ }
478
+ interface BacktestStrategy {
479
+ type: string;
480
+ universe: string[];
481
+ rebalance?: 'daily' | 'weekly' | 'monthly' | 'quarterly';
482
+ [key: string]: unknown;
483
+ }
484
+ interface BacktestParams {
485
+ strategy: BacktestStrategy;
486
+ startDate: string;
487
+ endDate: string;
488
+ initialCapital?: number;
489
+ benchmark?: string;
490
+ }
491
+ interface BacktestMetrics {
492
+ totalReturn: number;
493
+ annualizedReturn: number;
494
+ sharpeRatio: number;
495
+ maxDrawdown: number;
496
+ winRate: number;
497
+ volatility: number;
498
+ }
499
+ interface BacktestResult {
500
+ backtestId: string;
501
+ status: 'pending' | 'running' | 'completed' | 'failed';
502
+ metrics?: BacktestMetrics;
503
+ error?: string;
504
+ }
505
+ interface IndicatorData {
506
+ date: string;
507
+ symbol: string;
508
+ [key: string]: unknown;
509
+ }
510
+ interface FactorData {
511
+ date: string;
512
+ symbol: string;
513
+ [key: string]: unknown;
514
+ }
515
+ interface QuoteData {
516
+ symbol: string;
517
+ price: number;
518
+ change: number;
519
+ changePercent: number;
520
+ volume: number;
521
+ high: number;
522
+ low: number;
523
+ open: number;
524
+ previousClose: number;
525
+ marketCap?: number;
526
+ timestamp: number;
527
+ }
528
+ interface TradeData {
529
+ date: string;
530
+ symbol: string;
531
+ action: 'buy' | 'sell';
532
+ quantity: number;
533
+ price: number;
534
+ value: number;
535
+ }
536
+ interface ReturnData {
537
+ date: string;
538
+ portfolioValue: number;
539
+ dailyReturn: number;
540
+ cumulativeReturn: number;
541
+ benchmarkReturn?: number;
542
+ }
543
+ /**
544
+ * Quantitative analysis module
545
+ *
546
+ * @example
547
+ * ```typescript
548
+ * const indicators = await client.quant.indicators({
549
+ * symbols: ['US:AAPL'],
550
+ * indicators: ['ma', 'rsi'],
551
+ * params: { ma_period: 20 }
552
+ * });
553
+ * ```
554
+ */
555
+ declare class QuantModule {
556
+ private client;
557
+ constructor(client: Reportify);
558
+ /**
559
+ * Get technical indicators for given symbols
560
+ *
561
+ * @param params - Indicator parameters
562
+ * @returns Array of indicator data
563
+ */
564
+ indicators(params: IndicatorParams): Promise<IndicatorData[]>;
565
+ /**
566
+ * Get list of available technical indicators
567
+ */
568
+ indicatorList(): Promise<IndicatorDefinition[]>;
569
+ /**
570
+ * Get factor data for given symbols
571
+ *
572
+ * @param params - Factor parameters
573
+ * @returns Array of factor data
574
+ */
575
+ factors(params: FactorParams): Promise<FactorData[]>;
576
+ /**
577
+ * Get list of available factors
578
+ */
579
+ factorList(): Promise<FactorDefinition[]>;
580
+ /**
581
+ * Get factor exposure for given symbols
582
+ *
583
+ * @param symbols - Stock symbols
584
+ * @param date - Specific date (optional)
585
+ */
586
+ factorExposure(symbols: string[], date?: string): Promise<FactorData[]>;
587
+ /**
588
+ * Get real-time quotes for given symbols
589
+ *
590
+ * @param params - Quote parameters
591
+ * @returns Array of quote data
592
+ */
593
+ quotes(params: QuoteParams): Promise<QuoteData[]>;
594
+ /**
595
+ * Get historical quotes data
596
+ *
597
+ * @param params - History parameters
598
+ * @returns Array of historical OHLCV data
599
+ */
600
+ quotesHistory(params: QuoteHistoryParams): Promise<IndicatorData[]>;
601
+ /**
602
+ * Run a backtest for a given strategy
603
+ *
604
+ * @param params - Backtest parameters
605
+ * @returns Backtest result with job ID and metrics
606
+ *
607
+ * @example
608
+ * ```typescript
609
+ * const result = await client.quant.backtest({
610
+ * strategy: {
611
+ * type: 'momentum',
612
+ * universe: ['US:AAPL', 'US:MSFT', 'US:GOOGL'],
613
+ * rebalance: 'monthly',
614
+ * top_n: 2
615
+ * },
616
+ * startDate: '2020-01-01',
617
+ * endDate: '2024-01-01',
618
+ * benchmark: 'US:SPY'
619
+ * });
620
+ * ```
621
+ */
622
+ backtest(params: BacktestParams): Promise<BacktestResult>;
623
+ /**
624
+ * Get backtest result by ID
625
+ *
626
+ * @param backtestId - Backtest job ID
627
+ */
628
+ backtestResult(backtestId: string): Promise<BacktestResult>;
629
+ /**
630
+ * Get backtest return series
631
+ *
632
+ * @param backtestId - Backtest job ID
633
+ */
634
+ backtestReturns(backtestId: string): Promise<ReturnData[]>;
635
+ /**
636
+ * Get backtest trade history
637
+ *
638
+ * @param backtestId - Backtest job ID
639
+ */
640
+ backtestTrades(backtestId: string): Promise<TradeData[]>;
641
+ }
642
+
429
643
  /**
430
644
  * Reportify Client
431
645
  *
@@ -454,6 +668,7 @@ declare class Reportify {
454
668
  readonly timeline: TimelineModule;
455
669
  readonly kb: KBModule;
456
670
  readonly docs: DocsModule;
671
+ readonly quant: QuantModule;
457
672
  constructor(config: ReportifyConfig);
458
673
  /**
459
674
  * Make an HTTP request to the API
@@ -502,4 +717,4 @@ declare class Reportify {
502
717
  searchTranscripts(query: string, options?: SearchOptions): Promise<Document[]>;
503
718
  }
504
719
 
505
- export { APIError, AuthenticationError, type Chunk, type CompanyInfo, type CompanyOverview, DocsModule, type Document, type EarningsEvent, type FinancialStatement, type IPOEvent, type IPOStatus, type Interval, KBModule, type KBSearchOptions, type Market, NotFoundError, type PaginatedResponse, type Period, type PriceAdjust, type PriceData, type Quote, RateLimitError, Reportify, type ReportifyConfig, ReportifyError, type SearchOptions, type Shareholder, type StockInfo, StockModule, TimelineModule, type TimelineOptions };
720
+ export { APIError, AuthenticationError, type BacktestMetrics, type BacktestParams, type BacktestResult, type BacktestStrategy, type Chunk, type CompanyInfo, type CompanyOverview, DocsModule, type Document, type EarningsEvent, type FactorData, type FactorDefinition, type FactorParams, type FinancialStatement, type IPOEvent, type IPOStatus, type IndicatorData, type IndicatorDefinition, type IndicatorParams, type Interval, KBModule, type KBSearchOptions, type Market, NotFoundError, type PaginatedResponse, type Period, type PriceAdjust, type PriceData, QuantModule, type Quote, type QuoteData, type QuoteHistoryParams, type QuoteParams, RateLimitError, Reportify, type ReportifyConfig, ReportifyError, type ReturnData, type SearchOptions, type Shareholder, type StockInfo, StockModule, TimelineModule, type TimelineOptions, type TradeData };
package/dist/index.js CHANGED
@@ -25,6 +25,7 @@ __export(index_exports, {
25
25
  DocsModule: () => DocsModule,
26
26
  KBModule: () => KBModule,
27
27
  NotFoundError: () => NotFoundError,
28
+ QuantModule: () => QuantModule,
28
29
  RateLimitError: () => RateLimitError,
29
30
  Reportify: () => Reportify,
30
31
  ReportifyError: () => ReportifyError,
@@ -455,6 +456,171 @@ var DocsModule = class {
455
456
  }
456
457
  };
457
458
 
459
+ // src/quant.ts
460
+ var QuantModule = class {
461
+ constructor(client) {
462
+ this.client = client;
463
+ }
464
+ // ===========================================================================
465
+ // Indicators
466
+ // ===========================================================================
467
+ /**
468
+ * Get technical indicators for given symbols
469
+ *
470
+ * @param params - Indicator parameters
471
+ * @returns Array of indicator data
472
+ */
473
+ async indicators(params) {
474
+ const response = await this.client.post("/v2/quant/indicators", {
475
+ symbols: params.symbols,
476
+ indicators: params.indicators,
477
+ start_date: params.startDate,
478
+ end_date: params.endDate,
479
+ interval: params.interval || "1d",
480
+ params: params.params
481
+ });
482
+ return response.data || [];
483
+ }
484
+ /**
485
+ * Get list of available technical indicators
486
+ */
487
+ async indicatorList() {
488
+ const response = await this.client.get("/v2/quant/indicators");
489
+ return response.indicators || [];
490
+ }
491
+ // ===========================================================================
492
+ // Factors
493
+ // ===========================================================================
494
+ /**
495
+ * Get factor data for given symbols
496
+ *
497
+ * @param params - Factor parameters
498
+ * @returns Array of factor data
499
+ */
500
+ async factors(params) {
501
+ const response = await this.client.post("/v2/quant/factors", {
502
+ symbols: params.symbols,
503
+ factors: params.factors,
504
+ start_date: params.startDate,
505
+ end_date: params.endDate,
506
+ frequency: params.frequency || "daily"
507
+ });
508
+ return response.data || [];
509
+ }
510
+ /**
511
+ * Get list of available factors
512
+ */
513
+ async factorList() {
514
+ const response = await this.client.get("/v2/quant/factors");
515
+ return response.factors || [];
516
+ }
517
+ /**
518
+ * Get factor exposure for given symbols
519
+ *
520
+ * @param symbols - Stock symbols
521
+ * @param date - Specific date (optional)
522
+ */
523
+ async factorExposure(symbols, date) {
524
+ const response = await this.client.post("/v2/quant/factors/exposure", {
525
+ symbols,
526
+ date
527
+ });
528
+ return response.data || [];
529
+ }
530
+ // ===========================================================================
531
+ // Quotes
532
+ // ===========================================================================
533
+ /**
534
+ * Get real-time quotes for given symbols
535
+ *
536
+ * @param params - Quote parameters
537
+ * @returns Array of quote data
538
+ */
539
+ async quotes(params) {
540
+ const response = await this.client.post("/v2/quant/quotes", {
541
+ symbols: params.symbols,
542
+ fields: params.fields
543
+ });
544
+ return response.data || [];
545
+ }
546
+ /**
547
+ * Get historical quotes data
548
+ *
549
+ * @param params - History parameters
550
+ * @returns Array of historical OHLCV data
551
+ */
552
+ async quotesHistory(params) {
553
+ const response = await this.client.post("/v2/quant/quotes/history", {
554
+ symbols: params.symbols,
555
+ start_date: params.startDate,
556
+ end_date: params.endDate,
557
+ interval: params.interval || "1d",
558
+ adjust: params.adjust || "forward",
559
+ limit: params.limit || 100
560
+ });
561
+ return response.data || [];
562
+ }
563
+ // ===========================================================================
564
+ // Backtest
565
+ // ===========================================================================
566
+ /**
567
+ * Run a backtest for a given strategy
568
+ *
569
+ * @param params - Backtest parameters
570
+ * @returns Backtest result with job ID and metrics
571
+ *
572
+ * @example
573
+ * ```typescript
574
+ * const result = await client.quant.backtest({
575
+ * strategy: {
576
+ * type: 'momentum',
577
+ * universe: ['US:AAPL', 'US:MSFT', 'US:GOOGL'],
578
+ * rebalance: 'monthly',
579
+ * top_n: 2
580
+ * },
581
+ * startDate: '2020-01-01',
582
+ * endDate: '2024-01-01',
583
+ * benchmark: 'US:SPY'
584
+ * });
585
+ * ```
586
+ */
587
+ async backtest(params) {
588
+ return this.client.post("/v2/quant/backtest", {
589
+ strategy: params.strategy,
590
+ start_date: params.startDate,
591
+ end_date: params.endDate,
592
+ initial_capital: params.initialCapital || 1e6,
593
+ benchmark: params.benchmark
594
+ });
595
+ }
596
+ /**
597
+ * Get backtest result by ID
598
+ *
599
+ * @param backtestId - Backtest job ID
600
+ */
601
+ async backtestResult(backtestId) {
602
+ return this.client.get(`/v2/quant/backtest/${backtestId}`);
603
+ }
604
+ /**
605
+ * Get backtest return series
606
+ *
607
+ * @param backtestId - Backtest job ID
608
+ */
609
+ async backtestReturns(backtestId) {
610
+ const response = await this.client.get(`/v2/quant/backtest/${backtestId}/returns`);
611
+ return response.data || [];
612
+ }
613
+ /**
614
+ * Get backtest trade history
615
+ *
616
+ * @param backtestId - Backtest job ID
617
+ */
618
+ async backtestTrades(backtestId) {
619
+ const response = await this.client.get(`/v2/quant/backtest/${backtestId}/trades`);
620
+ return response.data || [];
621
+ }
622
+ };
623
+
458
624
  // src/types.ts
459
625
  var ReportifyError = class extends Error {
460
626
  statusCode;
@@ -501,6 +667,7 @@ var Reportify = class {
501
667
  timeline;
502
668
  kb;
503
669
  docs;
670
+ quant;
504
671
  constructor(config) {
505
672
  if (!config.apiKey) {
506
673
  throw new AuthenticationError("API key is required");
@@ -512,6 +679,7 @@ var Reportify = class {
512
679
  this.timeline = new TimelineModule(this);
513
680
  this.kb = new KBModule(this);
514
681
  this.docs = new DocsModule(this);
682
+ this.quant = new QuantModule(this);
515
683
  }
516
684
  /**
517
685
  * Make an HTTP request to the API
@@ -665,6 +833,7 @@ var Reportify = class {
665
833
  DocsModule,
666
834
  KBModule,
667
835
  NotFoundError,
836
+ QuantModule,
668
837
  RateLimitError,
669
838
  Reportify,
670
839
  ReportifyError,
package/dist/index.mjs CHANGED
@@ -420,6 +420,171 @@ var DocsModule = class {
420
420
  }
421
421
  };
422
422
 
423
+ // src/quant.ts
424
+ var QuantModule = class {
425
+ constructor(client) {
426
+ this.client = client;
427
+ }
428
+ // ===========================================================================
429
+ // Indicators
430
+ // ===========================================================================
431
+ /**
432
+ * Get technical indicators for given symbols
433
+ *
434
+ * @param params - Indicator parameters
435
+ * @returns Array of indicator data
436
+ */
437
+ async indicators(params) {
438
+ const response = await this.client.post("/v2/quant/indicators", {
439
+ symbols: params.symbols,
440
+ indicators: params.indicators,
441
+ start_date: params.startDate,
442
+ end_date: params.endDate,
443
+ interval: params.interval || "1d",
444
+ params: params.params
445
+ });
446
+ return response.data || [];
447
+ }
448
+ /**
449
+ * Get list of available technical indicators
450
+ */
451
+ async indicatorList() {
452
+ const response = await this.client.get("/v2/quant/indicators");
453
+ return response.indicators || [];
454
+ }
455
+ // ===========================================================================
456
+ // Factors
457
+ // ===========================================================================
458
+ /**
459
+ * Get factor data for given symbols
460
+ *
461
+ * @param params - Factor parameters
462
+ * @returns Array of factor data
463
+ */
464
+ async factors(params) {
465
+ const response = await this.client.post("/v2/quant/factors", {
466
+ symbols: params.symbols,
467
+ factors: params.factors,
468
+ start_date: params.startDate,
469
+ end_date: params.endDate,
470
+ frequency: params.frequency || "daily"
471
+ });
472
+ return response.data || [];
473
+ }
474
+ /**
475
+ * Get list of available factors
476
+ */
477
+ async factorList() {
478
+ const response = await this.client.get("/v2/quant/factors");
479
+ return response.factors || [];
480
+ }
481
+ /**
482
+ * Get factor exposure for given symbols
483
+ *
484
+ * @param symbols - Stock symbols
485
+ * @param date - Specific date (optional)
486
+ */
487
+ async factorExposure(symbols, date) {
488
+ const response = await this.client.post("/v2/quant/factors/exposure", {
489
+ symbols,
490
+ date
491
+ });
492
+ return response.data || [];
493
+ }
494
+ // ===========================================================================
495
+ // Quotes
496
+ // ===========================================================================
497
+ /**
498
+ * Get real-time quotes for given symbols
499
+ *
500
+ * @param params - Quote parameters
501
+ * @returns Array of quote data
502
+ */
503
+ async quotes(params) {
504
+ const response = await this.client.post("/v2/quant/quotes", {
505
+ symbols: params.symbols,
506
+ fields: params.fields
507
+ });
508
+ return response.data || [];
509
+ }
510
+ /**
511
+ * Get historical quotes data
512
+ *
513
+ * @param params - History parameters
514
+ * @returns Array of historical OHLCV data
515
+ */
516
+ async quotesHistory(params) {
517
+ const response = await this.client.post("/v2/quant/quotes/history", {
518
+ symbols: params.symbols,
519
+ start_date: params.startDate,
520
+ end_date: params.endDate,
521
+ interval: params.interval || "1d",
522
+ adjust: params.adjust || "forward",
523
+ limit: params.limit || 100
524
+ });
525
+ return response.data || [];
526
+ }
527
+ // ===========================================================================
528
+ // Backtest
529
+ // ===========================================================================
530
+ /**
531
+ * Run a backtest for a given strategy
532
+ *
533
+ * @param params - Backtest parameters
534
+ * @returns Backtest result with job ID and metrics
535
+ *
536
+ * @example
537
+ * ```typescript
538
+ * const result = await client.quant.backtest({
539
+ * strategy: {
540
+ * type: 'momentum',
541
+ * universe: ['US:AAPL', 'US:MSFT', 'US:GOOGL'],
542
+ * rebalance: 'monthly',
543
+ * top_n: 2
544
+ * },
545
+ * startDate: '2020-01-01',
546
+ * endDate: '2024-01-01',
547
+ * benchmark: 'US:SPY'
548
+ * });
549
+ * ```
550
+ */
551
+ async backtest(params) {
552
+ return this.client.post("/v2/quant/backtest", {
553
+ strategy: params.strategy,
554
+ start_date: params.startDate,
555
+ end_date: params.endDate,
556
+ initial_capital: params.initialCapital || 1e6,
557
+ benchmark: params.benchmark
558
+ });
559
+ }
560
+ /**
561
+ * Get backtest result by ID
562
+ *
563
+ * @param backtestId - Backtest job ID
564
+ */
565
+ async backtestResult(backtestId) {
566
+ return this.client.get(`/v2/quant/backtest/${backtestId}`);
567
+ }
568
+ /**
569
+ * Get backtest return series
570
+ *
571
+ * @param backtestId - Backtest job ID
572
+ */
573
+ async backtestReturns(backtestId) {
574
+ const response = await this.client.get(`/v2/quant/backtest/${backtestId}/returns`);
575
+ return response.data || [];
576
+ }
577
+ /**
578
+ * Get backtest trade history
579
+ *
580
+ * @param backtestId - Backtest job ID
581
+ */
582
+ async backtestTrades(backtestId) {
583
+ const response = await this.client.get(`/v2/quant/backtest/${backtestId}/trades`);
584
+ return response.data || [];
585
+ }
586
+ };
587
+
423
588
  // src/types.ts
424
589
  var ReportifyError = class extends Error {
425
590
  statusCode;
@@ -466,6 +631,7 @@ var Reportify = class {
466
631
  timeline;
467
632
  kb;
468
633
  docs;
634
+ quant;
469
635
  constructor(config) {
470
636
  if (!config.apiKey) {
471
637
  throw new AuthenticationError("API key is required");
@@ -477,6 +643,7 @@ var Reportify = class {
477
643
  this.timeline = new TimelineModule(this);
478
644
  this.kb = new KBModule(this);
479
645
  this.docs = new DocsModule(this);
646
+ this.quant = new QuantModule(this);
480
647
  }
481
648
  /**
482
649
  * Make an HTTP request to the API
@@ -629,6 +796,7 @@ export {
629
796
  DocsModule,
630
797
  KBModule,
631
798
  NotFoundError,
799
+ QuantModule,
632
800
  RateLimitError,
633
801
  Reportify,
634
802
  ReportifyError,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reportify-sdk",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "TypeScript SDK for Reportify API - Financial data and document search",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",