fmp-node-api 0.1.9 โ†’ 0.2.0-beta.1

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 CHANGED
@@ -1,719 +1,747 @@
1
- # FMP Node API Wrapper
2
-
3
- A comprehensive Node.js wrapper for the Financial Modeling Prep (FMP) API with full TypeScript support and organized endpoint structure.
4
-
5
- > **๐Ÿ“– Visit the [Documentation](https://fmp-node-wrapper-docs.vercel.app/) for detailed information.**
6
-
7
- > **๐Ÿ”ง For development information, contributing guidelines, and project details, visit the [main repository](https://github.com/e-roy/fmp-node-wrapper).**
8
-
9
- ## Features
10
-
11
- - ๐Ÿš€ **Complete TypeScript Support** - Full type safety for all API responses
12
- - ๐Ÿ“ฆ **Organized Structure** - Clean separation of concerns with dedicated modules
13
- - ๐Ÿ”ง **Easy to Use** - Simple, intuitive API with minimal boilerplate
14
- - ๐Ÿ“Š **Comprehensive Coverage** - Support for all FMP stable endpoints
15
- - ๐Ÿ›ก๏ธ **Input Validation** - Built-in validation for all parameters
16
- - ๐ŸŽฏ **Modular Design** - Import only what you need
17
- - ๐Ÿงช **Comprehensive Testing** - Full test suite with 45+ tests covering all endpoints
18
- - ๐Ÿ“ˆ **Real-time Data** - Access to live market data and financial statements
19
-
20
- ## Installation
21
-
22
- ```bash
23
- npm install fmp-node-api
24
- # or
25
- yarn add fmp-node-api
26
- # or
27
- pnpm add fmp-node-api
28
- ```
29
-
30
- ## Quick Start
31
-
32
- ```typescript
33
- import { FMP } from 'fmp-node-api';
34
-
35
- // Option 1: Use environment variable (recommended)
36
- const fmp = new FMP(); // Automatically uses FMP_API_KEY from environment
37
-
38
- // Option 2: Provide API key directly
39
- const fmp = new FMP({ apiKey: 'your-api-key' });
40
-
41
- // Option 3: Provide partial config with environment variable fallback
42
- const fmp = new FMP({ timeout: 15000 }); // Uses FMP_API_KEY from environment
43
-
44
- // Get stock quote
45
- const quote = await fmp.quote.getQuote('AAPL');
46
-
47
- // Get financial statements
48
- const incomeStatement = await fmp.financial.getIncomeStatement({
49
- symbol: 'AAPL',
50
- period: 'annual',
51
- });
52
-
53
- // Get forex data
54
- const forexQuote = await fmp.quote.getQuote('EURUSD');
55
- ```
56
-
57
- ## Configuration
58
-
59
- The FMP client supports multiple ways to configure your API key:
60
-
61
- ### Environment Variable (Recommended)
62
-
63
- Set the `FMP_API_KEY` environment variable in your `.env` file or system environment:
64
-
65
- ```bash
66
- # .env file
67
- FMP_API_KEY=your-api-key-here
68
-
69
- # Or set in your system
70
- export FMP_API_KEY=your-api-key-here
71
- ```
72
-
73
- Then initialize the client without any parameters:
74
-
75
- ```typescript
76
- import { FMP } from 'fmp-node-api';
77
-
78
- const fmp = new FMP(); // Automatically uses FMP_API_KEY
79
- ```
80
-
81
- ### Direct Configuration
82
-
83
- Provide the API key directly in the constructor:
84
-
85
- ```typescript
86
- import { FMP } from 'fmp-node-api';
87
-
88
- const fmp = new FMP({
89
- apiKey: 'your-api-key-here',
90
- timeout: 10000, // optional
91
- });
92
- ```
93
-
94
- ### Mixed Configuration
95
-
96
- You can provide partial configuration and let the client fall back to environment variables:
97
-
98
- ```typescript
99
- import { FMP } from 'fmp-node-api';
100
-
101
- const fmp = new FMP({
102
- timeout: 15000, // custom timeout
103
- // apiKey will be loaded from FMP_API_KEY environment variable
104
- });
105
- ```
106
-
107
- ### Configuration Options
108
-
109
- ```typescript
110
- interface FMPConfig {
111
- apiKey?: string; // Optional: API key (falls back to FMP_API_KEY env var)
112
- timeout?: number; // Optional: Request timeout in milliseconds (default: 10000)
113
- }
114
- ```
115
-
116
- ## API Structure
117
-
118
- The library is organized into logical modules for easy navigation and usage:
119
-
120
- ### Main Client
121
-
122
- ```typescript
123
- import { FMP } from 'fmp-node-api';
124
-
125
- // Using environment variable (recommended)
126
- const fmp = new FMP();
127
-
128
- // Or with explicit configuration
129
- const fmp = new FMP({
130
- apiKey: 'your-api-key',
131
- timeout: 10000, // optional
132
- });
133
- ```
134
-
135
- ### Available Modules
136
-
137
- - **`fmp.quote`** - Quote data for stocks, forex, crypto, commodities, and ETFs
138
- - **`fmp.stock`** - Stock market data (market cap, splits, dividends, real-time prices)
139
- - **`fmp.financial`** - Financial statements (income, balance sheet, cash flow)
140
- - **`fmp.company`** - Company information and profiles
141
- - **`fmp.etf`** - ETF data and holdings
142
- - **`fmp.mutualFund`** - Mutual fund data
143
- - **`fmp.economic`** - Economic indicators
144
- - **`fmp.market`** - Market-wide data and performance
145
- - **`fmp.list`** - Stock lists and indices
146
- - **`fmp.calendar`** - Earnings and economic calendar
147
- - **`fmp.senateHouse`** - Congressional trading data
148
- - **`fmp.institutional`** - Form 13F filings and institutional ownership
149
- - **`fmp.insider`** - Insider trading data
150
- - **`fmp.sec`** - SEC filings and industry classification
151
-
152
- ## Usage Examples
153
-
154
- ### Quote Data
155
-
156
- ```typescript
157
- // Get real-time quote for any asset type
158
- const quote = await fmp.quote.getQuote('AAPL');
159
-
160
- // Get multiple quotes
161
- const quotes = await fmp.quote.getQuotes(['AAPL', 'MSFT', 'GOOGL']);
162
-
163
- // Get historical prices
164
- const historical = await fmp.quote.getHistoricalPrice({
165
- symbol: 'AAPL',
166
- from: '2024-01-01',
167
- to: '2024-12-31',
168
- });
169
-
170
- // Get intraday data
171
- const intraday = await fmp.quote.getIntraday({
172
- symbol: 'AAPL',
173
- interval: '1hour',
174
- from: '2024-01-01',
175
- to: '2024-01-02',
176
- });
177
- ```
178
-
179
- ### Stock Data
180
-
181
- ```typescript
182
- // Get market capitalization
183
- const marketCap = await fmp.stock.getMarketCap('AAPL');
184
-
185
- // Get stock splits
186
- const splits = await fmp.stock.getStockSplits('AAPL');
187
-
188
- // Get dividend history
189
- const dividends = await fmp.stock.getDividendHistory('AAPL');
190
-
191
- // Get real-time price data
192
- const realTimePrice = await fmp.stock.getRealTimePrice(['AAPL', 'MSFT', 'GOOGL']);
193
-
194
- // Get full real-time price data
195
- const fullRealTimeData = await fmp.stock.getRealTimePriceForMultipleStocks([
196
- 'AAPL',
197
- 'MSFT',
198
- 'GOOGL',
199
- ]);
200
- ```
201
-
202
- ### Financial Statements
203
-
204
- ```typescript
205
- // Get income statement
206
- const income = await fmp.financial.getIncomeStatement({
207
- symbol: 'AAPL',
208
- period: 'annual',
209
- limit: 10,
210
- });
211
-
212
- // Get balance sheet
213
- const balance = await fmp.financial.getBalanceSheet({
214
- symbol: 'AAPL',
215
- period: 'quarter',
216
- });
217
-
218
- // Get cash flow statement
219
- const cashFlow = await fmp.financial.getCashFlowStatement({
220
- symbol: 'AAPL',
221
- period: 'annual',
222
- });
223
-
224
- // Get key metrics
225
- const metrics = await fmp.financial.getKeyMetrics({ symbol: 'AAPL' });
226
-
227
- // Get financial ratios
228
- const ratios = await fmp.financial.getFinancialRatios({ symbol: 'AAPL' });
229
- ```
230
-
231
- ### Market Data
232
-
233
- ```typescript
234
- // Get market hours
235
- const hours = await fmp.market.getMarketHours();
236
-
237
- // Get market performance
238
- const performance = await fmp.market.getMarketPerformance();
239
-
240
- // Get gainers and losers
241
- const gainers = await fmp.market.getGainers();
242
- const losers = await fmp.market.getLosers();
243
-
244
- // Get most active stocks
245
- const mostActive = await fmp.market.getMostActive();
246
-
247
- // Get sector performance
248
- const sectors = await fmp.market.getSectorPerformance();
249
- ```
250
-
251
- ### Economic Indicators
252
-
253
- ```typescript
254
- // Get treasury rates
255
- const treasury = await fmp.economic.getTreasuryRates({
256
- from: '2024-01-01',
257
- to: '2024-12-31',
258
- });
259
-
260
- // Get federal funds rate
261
- const fedRate = await fmp.economic.getFederalFundsRate();
262
-
263
- // Get CPI data
264
- const cpi = await fmp.economic.getCPI();
265
-
266
- // Get GDP data
267
- const gdp = await fmp.economic.getGDP();
268
-
269
- // Get unemployment data
270
- const unemployment = await fmp.economic.getUnemployment();
271
- ```
272
-
273
- ### Other Asset Classes
274
-
275
- ```typescript
276
- // Forex
277
- const forexQuote = await fmp.quote.getQuote('EURUSD');
278
-
279
- // Cryptocurrency
280
- const cryptoQuote = await fmp.quote.getQuote('BTCUSD');
281
-
282
- // Stock lists and indices
283
- const sp500 = await fmp.list.getSP500();
284
- const nasdaq = await fmp.list.getNasdaq100();
285
- const dowJones = await fmp.list.getDowJones();
286
-
287
- // Earnings calendar
288
- const earnings = await fmp.calendar.getEarningsCalendar({
289
- from: '2024-01-01',
290
- to: '2024-12-31',
291
- });
292
-
293
- // Economic calendar
294
- const economic = await fmp.calendar.getEconomicCalendar({
295
- from: '2024-01-01',
296
- to: '2024-12-31',
297
- });
298
-
299
- // Company search
300
- const companies = await fmp.company.searchCompany({ query: 'Apple' });
301
-
302
- // Company profile
303
- const companyProfile = await fmp.company.getCompanyProfile('AAPL');
304
- ```
305
-
306
- ## Testing
307
-
308
- This package includes comprehensive tests for all endpoints. There are two test scripts available:
309
-
310
- ### Local Development
311
-
312
- ```bash
313
- pnpm test
314
- ```
315
-
316
- - Uses Jest to run all tests
317
- - Automatically loads API key from `.env` file
318
- - Requires a valid FMP API key in your `.env` file
319
-
320
- ### CI Environment
321
-
322
- ```bash
323
- pnpm test:ci
324
- ```
325
-
326
- - Uses Jest with explicit environment variable passing
327
- - Requires `FMP_API_KEY` environment variable to be set
328
- - Used by CI/CD pipelines
329
-
330
- ### Running Specific Tests
331
-
332
- ```bash
333
- # Run only unit tests
334
- pnpm test:unit
335
-
336
- # Run only integration tests
337
- pnpm test:integration
338
-
339
- # Run tests for specific endpoints
340
- pnpm test:stock
341
- pnpm test:financial
342
- pnpm test:market
343
- pnpm test:quote
344
- pnpm test:economic
345
- pnpm test:list
346
- pnpm test:calendar
347
- pnpm test:company
348
-
349
- # Run all endpoint tests
350
- pnpm test:endpoints
351
-
352
- # Manual testing with real API calls
353
- pnpm test:manual
354
-
355
- # Run specific endpoint test
356
- pnpm test:endpoint
357
- ```
358
-
359
- ## Response Format
360
-
361
- All API methods return a standardized response format:
362
-
363
- ```typescript
364
- interface APIResponse<T> {
365
- success: boolean;
366
- data: T | null;
367
- error: string | null;
368
- status: number;
369
- }
370
- ```
371
-
372
- ### Example Response
373
-
374
- ```typescript
375
- {
376
- success: true,
377
- data: {
378
- symbol: 'AAPL',
379
- price: 150.25,
380
- change: 2.15,
381
- changePercent: 1.45,
382
- // ... other fields
383
- },
384
- error: null,
385
- status: 200
386
- }
387
- ```
388
-
389
- ## Error Handling
390
-
391
- ```typescript
392
- try {
393
- const quote = await fmp.quote.getQuote('INVALID');
394
-
395
- if (!quote.success) {
396
- console.error('API Error:', quote.error);
397
- return;
398
- }
399
-
400
- if (quote.data) {
401
- console.log('Quote:', quote.data);
402
- }
403
- } catch (error) {
404
- console.error('Network Error:', error);
405
- }
406
- ```
407
-
408
- ## Type Safety
409
-
410
- The library provides full TypeScript support with comprehensive type definitions included in the main package:
411
-
412
- ```typescript
413
- import { Quote, MarketCap, IncomeStatement } from 'fmp-node-api';
414
-
415
- // All responses are properly typed
416
- const quote: APIResponse<Quote> = await fmp.quote.getQuote('AAPL');
417
- const marketCap: APIResponse<MarketCap> = await fmp.stock.getMarketCap('AAPL');
418
- const income: APIResponse<IncomeStatement[]> = await fmp.financial.getIncomeStatement({
419
- symbol: 'AAPL',
420
- });
421
- ```
422
-
423
- All API responses and parameters are fully typed for complete type safety.
424
-
425
- ## Utilities
426
-
427
- The library includes helpful utilities for data formatting and validation:
428
-
429
- ```typescript
430
- import {
431
- formatCurrency,
432
- formatPercentage,
433
- formatLargeNumber,
434
- formatDate,
435
- formatVolume,
436
- formatNumber,
437
- formatTimestamp,
438
- formatReadableDate,
439
- } from 'fmp-node-api';
440
-
441
- // Format financial data
442
- const formattedPrice = formatCurrency(150.25); // "$150.25"
443
- const formattedChange = formatPercentage(1.45); // "1.45%"
444
- const formattedMarketCap = formatLargeNumber(2500000000); // "2.50B"
445
- const formattedVolume = formatVolume(1500000); // "1.50M"
446
- const formattedDate = formatDate('2024-01-15'); // "2024-01-15"
447
- const formattedTimestamp = formatTimestamp(1705276800); // "1/15/2024, 12:00:00 AM"
448
- ```
449
-
450
- ## Advanced Usage
451
-
452
- ### Custom Client Configuration
453
-
454
- ```typescript
455
- import { FMPClient } from 'fmp-node-api';
456
-
457
- // Using environment variable
458
- const client = new FMPClient({
459
- timeout: 15000, // optional, apiKey from FMP_API_KEY env var
460
- });
461
-
462
- // Or with explicit API key
463
- const client = new FMPClient({
464
- apiKey: 'your-api-key',
465
- timeout: 15000, // optional
466
- });
467
-
468
- // Use individual endpoint classes
469
- const stockEndpoints = new StockEndpoints(client);
470
- const marketCap = await stockEndpoints.getMarketCap('AAPL');
471
- ```
472
-
473
- ### Direct API Calls
474
-
475
- ```typescript
476
- const client = fmp.getClient();
477
- const response = await client.get('/quote/AAPL');
478
- ```
479
-
480
- ## Testing
481
-
482
- The library includes a comprehensive test suite with extensive coverage across all endpoints, types, and utilities:
483
-
484
- ### Available Test Scripts
485
-
486
- ```bash
487
- # Run all tests
488
- pnpm test
489
-
490
- # Run specific test categories
491
- pnpm test:unit # Unit tests (client, main FMP class)
492
- pnpm test:integration # Integration tests
493
- pnpm test:endpoints # All endpoint tests
494
- pnpm test:stock # Stock endpoint tests only
495
- pnpm test:financial # Financial endpoint tests only
496
- pnpm test:market # Market endpoint tests only
497
- pnpm test:quote # Quote endpoint tests only
498
- pnpm test:economic # Economic endpoint tests only
499
- pnpm test:list # List endpoint tests only
500
- pnpm test:calendar # Calendar endpoint tests only
501
- pnpm test:company # Company endpoint tests only
502
-
503
- # Manual testing with real API calls
504
- pnpm test:manual # Test real API integration
505
- pnpm test:endpoint # Run specific endpoint test
506
-
507
- # Development
508
- pnpm test:watch # Watch mode for development
509
- pnpm test:coverage # Generate coverage report
510
- ```
511
-
512
- **Note**: Additional endpoint-specific test scripts (crypto, etf, mutual-fund) are available in the package-level scripts but not exposed at the root level.
513
-
514
- ## Development
515
-
516
- ### Prerequisites
517
-
518
- - Node.js 18+
519
- - pnpm (recommended) or npm
520
- - FMP API key
521
-
522
- ### Setup
523
-
524
- ```bash
525
- # Clone the repository
526
- git clone <repository-url>
527
- cd fmp-node-wrapper
528
-
529
- # Install dependencies
530
- pnpm install
531
-
532
- # Set up environment variables
533
- cp .env.example .env
534
- # Add your FMP_API_KEY to .env
535
-
536
- # Build the package
537
- pnpm build
538
-
539
- # Run tests
540
- pnpm test
541
- ```
542
-
543
- ### Available Scripts
544
-
545
- ```bash
546
- # Build
547
- pnpm build # Build the package
548
- pnpm dev # Watch mode for development
549
-
550
- # Testing
551
- pnpm test # Run all tests
552
- pnpm test:watch # Watch mode
553
- pnpm test:coverage # Coverage report
554
- pnpm test:manual # Manual API testing
555
- pnpm test:endpoint # Run specific endpoint test
556
- pnpm test:unit # Run unit tests
557
- pnpm test:integration # Run integration tests
558
- pnpm test:endpoints # Run all endpoint tests
559
- pnpm test:stock # Run stock endpoint tests
560
- pnpm test:financial # Run financial endpoint tests
561
- pnpm test:market # Run market endpoint tests
562
- pnpm test:quote # Run quote endpoint tests
563
- pnpm test:economic # Run economic endpoint tests
564
- pnpm test:list # Run list endpoint tests
565
- pnpm test:calendar # Run calendar endpoint tests
566
- pnpm test:company # Run company endpoint tests
567
-
568
- # Code Quality
569
- pnpm lint # Run ESLint
570
- pnpm lint:fix # Fix linting issues
571
- pnpm format # Format code with Prettier
572
- pnpm format:check # Check code formatting
573
- pnpm type-check # TypeScript type checking
574
-
575
- # Utilities
576
- pnpm clean # Clean build artifacts
577
- ```
578
-
579
- ## File Structure
580
-
581
- ```
582
- src/
583
- โ”œโ”€โ”€ client.ts # Base HTTP client
584
- โ”œโ”€โ”€ fmp.ts # Main FMP class
585
- โ”œโ”€โ”€ index.ts # Main exports
586
- โ”œโ”€โ”€ shared.ts # Shared types and utilities
587
- โ”œโ”€โ”€ endpoints/ # API endpoint classes
588
- โ”‚ โ”œโ”€โ”€ index.ts
589
- โ”‚ โ”œโ”€โ”€ stock.ts
590
- โ”‚ โ”œโ”€โ”€ financial.ts
591
- โ”‚ โ”œโ”€โ”€ quote.ts
592
- โ”‚ โ”œโ”€โ”€ etf.ts
593
- โ”‚ โ”œโ”€โ”€ mutual-fund.ts
594
- โ”‚ โ”œโ”€โ”€ economic.ts
595
- โ”‚ โ”œโ”€โ”€ market.ts
596
- โ”‚ โ”œโ”€โ”€ list.ts
597
- โ”‚ โ”œโ”€โ”€ calendar.ts
598
- โ”‚ โ”œโ”€โ”€ company.ts
599
- โ”‚ โ”œโ”€โ”€ senate-house.ts
600
- โ”‚ โ”œโ”€โ”€ institutional.ts
601
- โ”‚ โ”œโ”€โ”€ insider.ts
602
- โ”‚ โ””โ”€โ”€ sec.ts
603
- โ”œโ”€โ”€ utils/ # Utility functions
604
- โ”‚ โ”œโ”€โ”€ index.ts
605
- โ”‚ โ”œโ”€โ”€ validation.ts # Input validation
606
- โ”‚ โ”œโ”€โ”€ formatting.ts # Data formatting
607
- โ”‚ โ””โ”€โ”€ constants.ts # API constants
608
- โ”œโ”€โ”€ __tests__/ # Test files
609
- โ”‚ โ”œโ”€โ”€ client.test.ts
610
- โ”‚ โ”œโ”€โ”€ fmp.test.ts
611
- โ”‚ โ”œโ”€โ”€ integration.test.ts
612
- โ”‚ โ”œโ”€โ”€ endpoints/ # Endpoint tests
613
- โ”‚ โ”‚ โ”œโ”€โ”€ stock.test.ts
614
- โ”‚ โ”‚ โ”œโ”€โ”€ financial.test.ts
615
- โ”‚ โ”‚ โ”œโ”€โ”€ market.test.ts
616
- โ”‚ โ”‚ โ”œโ”€โ”€ quote.test.ts
617
- โ”‚ โ”‚ โ”œโ”€โ”€ economic.test.ts
618
- โ”‚ โ”‚ โ”œโ”€โ”€ etf.test.ts
619
- โ”‚ โ”‚ โ”œโ”€โ”€ mutual-fund.test.ts
620
- โ”‚ โ”‚ โ”œโ”€โ”€ list.test.ts
621
- โ”‚ โ”‚ โ”œโ”€โ”€ calendar.test.ts
622
- โ”‚ โ”‚ โ””โ”€โ”€ company.test.ts
623
- โ”‚ โ””โ”€โ”€ utils/ # Test utilities
624
- โ”‚ โ”œโ”€โ”€ formatting.test.ts
625
- โ”‚ โ”œโ”€โ”€ validation.test.ts
626
- โ”‚ โ””โ”€โ”€ test-setup.ts
627
- โ””โ”€โ”€ scripts/ # Build and utility scripts
628
- โ””โ”€โ”€ test-manual.ts # Manual API testing script
629
- ```
630
-
631
- ## Contributing
632
-
633
- We welcome contributions! This is a community-driven project, and your help is greatly appreciated.
634
-
635
- ### Quick Start
636
-
637
- 1. **Fork the repository**
638
- 2. **Create a feature branch**: `git checkout -b feature/your-feature-name`
639
- 3. **Make your changes** following our development guidelines
640
- 4. **Run quality checks**: `pnpm lint && pnpm test && pnpm type-check`
641
- 5. **Open a Pull Request** with a clear description of your changes
642
-
643
- ### Development Setup
644
-
645
- ```bash
646
- # Install dependencies
647
- pnpm install
648
-
649
- # Set up environment
650
- cp .env.example .env
651
- # Add your FMP_API_KEY to .env
652
-
653
- # Build and test
654
- pnpm build
655
- pnpm test
656
- ```
657
-
658
- ### Getting Help
659
-
660
- - **๐Ÿ“– [Contributing Guide](https://github.com/e-roy/fmp-node-wrapper/blob/main/CONTRIBUTING.md)**: Detailed guidelines and development setup
661
- - **๐Ÿ› [Issues](https://github.com/e-roy/fmp-node-wrapper/issues)**: Report bugs or request features
662
- - **๐Ÿ“š [Documentation](https://fmp-node-wrapper-docs.vercel.app)**: Check the docs first
663
-
664
- ### Before Contributing
665
-
666
- - [ ] Read the [Contributing Guide](https://github.com/e-roy/fmp-node-wrapper/blob/main/CONTRIBUTING.md)
667
- - [ ] Check existing issues to avoid duplicates
668
- - [ ] Test with the latest version of the library
669
- - [ ] Follow our coding standards and testing requirements
670
-
671
- ## Issues and Support
672
-
673
- ### Reporting Issues
674
-
675
- Before creating an issue, please:
676
-
677
- 1. **Check existing issues** to avoid duplicates
678
- 2. **Search the documentation** for solutions
679
- 3. **Test with the latest version** of the library
680
- 4. **Provide a minimal reproduction** of the problem
681
-
682
- ### Issue Guidelines
683
-
684
- - **Be specific**: Provide clear, actionable information
685
- - **Include examples**: Code examples help reproduce issues
686
- - **Check versions**: Mention Node.js and library versions
687
- - **Separate concerns**: Don't mix multiple issues in one report
688
-
689
- ### Support Channels
690
-
691
- - **๐Ÿ› [GitHub Issues](https://github.com/e-roy/fmp-node-wrapper/issues)**: For bug reports and feature requests
692
- - **๐Ÿ“ง [FMP Official Support](https://site.financialmodelingprep.com/developer/docs/stable)**: For issues with the underlying FMP API service
693
-
694
- ## License
695
-
696
- MIT License - see LICENSE file for details.
697
-
698
- ## Support
699
-
700
- For issues, questions, or contributions, please visit the [GitHub repository](https://github.com/e-roy/fmp-node-wrapper).
701
-
702
- ## Disclaimer
703
-
704
- **This package is not affiliated with, endorsed by, or sponsored by Financial Modeling Prep (FMP).** This is an independent, community-developed Node.js wrapper for the FMP API.
705
-
706
- ### Important Legal Information
707
-
708
- - **No Affiliation**: This library is developed independently and is not officially associated with Financial Modeling Prep
709
- - **No Warranty**: This software is provided "as is" without any warranties, express or implied
710
- - **User Responsibility**: Users are responsible for:
711
- - Complying with FMP's terms of service and API usage limits
712
- - Obtaining and maintaining valid API keys from Financial Modeling Prep
713
- - Ensuring their usage complies with applicable laws and regulations
714
- - **Limitation of Liability**: The developers of this wrapper are not responsible for:
715
- - Any issues with the underlying FMP API service
716
- - Data accuracy or availability from the FMP API
717
- - Any financial losses or damages resulting from the use of this library
718
- - API rate limiting, downtime, or service interruptions
719
- - **Official Support**: For official support, documentation, or API issues, please contact Financial Modeling Prep directly at their official channels
1
+ # FMP Node API Wrapper
2
+
3
+ A comprehensive Node.js wrapper for the Financial Modeling Prep (FMP) API with full TypeScript support and organized endpoint structure.
4
+
5
+ > **๐Ÿ“– Visit the [Documentation](https://fmp-node-wrapper-docs.vercel.app/) for detailed information.**
6
+
7
+ > **๐Ÿ”ง For development information, contributing guidelines, and project details, visit the [main repository](https://github.com/e-roy/fmp-node-wrapper).**
8
+
9
+ ## Features
10
+
11
+ - ๐Ÿš€ **Complete TypeScript Support** - Full type safety for all API responses
12
+ - ๐Ÿ“ฆ **Organized Structure** - Clean separation of concerns with dedicated modules
13
+ - ๐Ÿ”ง **Easy to Use** - Simple, intuitive API with minimal boilerplate
14
+ - ๐Ÿ“Š **Comprehensive Coverage** - Support for all FMP stable endpoints
15
+ - ๐Ÿ›ก๏ธ **Input Validation** - Built-in validation for all parameters
16
+ - ๐ŸŽฏ **Modular Design** - Import only what you need
17
+ - ๐Ÿงช **Comprehensive Testing** - Full test suite with 45+ tests covering all endpoints
18
+ - ๐Ÿ“ˆ **Real-time Data** - Access to live market data and financial statements
19
+
20
+ ## Installation
21
+
22
+ ```bash
23
+ npm install fmp-node-api
24
+ # or
25
+ yarn add fmp-node-api
26
+ # or
27
+ pnpm add fmp-node-api
28
+ ```
29
+
30
+ ## Quick Start
31
+
32
+ ```typescript
33
+ import { FMP } from 'fmp-node-api';
34
+
35
+ // Option 1: Use environment variable (recommended)
36
+ const fmp = new FMP(); // Automatically uses FMP_API_KEY from environment
37
+
38
+ // Option 2: Provide API key directly
39
+ const fmp = new FMP({ apiKey: 'your-api-key' });
40
+
41
+ // Option 3: Provide partial config with environment variable fallback
42
+ const fmp = new FMP({ timeout: 15000 }); // Uses FMP_API_KEY from environment
43
+
44
+ // Get stock quote
45
+ const quote = await fmp.quote.getQuote('AAPL');
46
+
47
+ // Get financial statements
48
+ const incomeStatement = await fmp.financial.getIncomeStatement({
49
+ symbol: 'AAPL',
50
+ period: 'annual',
51
+ });
52
+
53
+ // Get forex data
54
+ const forexQuote = await fmp.quote.getQuote('EURUSD');
55
+ ```
56
+
57
+ ## Configuration
58
+
59
+ The FMP client supports multiple ways to configure your API key:
60
+
61
+ ### Environment Variable (Recommended)
62
+
63
+ Set the `FMP_API_KEY` environment variable in your `.env` file or system environment:
64
+
65
+ ```bash
66
+ # .env file
67
+ FMP_API_KEY=your-api-key-here
68
+
69
+ # Or set in your system
70
+ export FMP_API_KEY=your-api-key-here
71
+ ```
72
+
73
+ Then initialize the client without any parameters:
74
+
75
+ ```typescript
76
+ import { FMP } from 'fmp-node-api';
77
+
78
+ const fmp = new FMP(); // Automatically uses FMP_API_KEY
79
+ ```
80
+
81
+ ### Direct Configuration
82
+
83
+ Provide the API key directly in the constructor:
84
+
85
+ ```typescript
86
+ import { FMP } from 'fmp-node-api';
87
+
88
+ const fmp = new FMP({
89
+ apiKey: 'your-api-key-here',
90
+ timeout: 10000, // optional
91
+ });
92
+ ```
93
+
94
+ ### Mixed Configuration
95
+
96
+ You can provide partial configuration and let the client fall back to environment variables:
97
+
98
+ ```typescript
99
+ import { FMP } from 'fmp-node-api';
100
+
101
+ const fmp = new FMP({
102
+ timeout: 15000, // custom timeout
103
+ // apiKey will be loaded from FMP_API_KEY environment variable
104
+ });
105
+ ```
106
+
107
+ ### Configuration Options
108
+
109
+ ```typescript
110
+ interface FMPConfig {
111
+ apiKey?: string; // Optional: API key (falls back to FMP_API_KEY env var)
112
+ timeout?: number; // Optional: Request timeout in milliseconds (default: 10000)
113
+ }
114
+ ```
115
+
116
+ ## API Structure
117
+
118
+ The library is organized into logical modules for easy navigation and usage:
119
+
120
+ ### Main Client
121
+
122
+ ```typescript
123
+ import { FMP } from 'fmp-node-api';
124
+
125
+ // Using environment variable (recommended)
126
+ const fmp = new FMP();
127
+
128
+ // Or with explicit configuration
129
+ const fmp = new FMP({
130
+ apiKey: 'your-api-key',
131
+ timeout: 10000, // optional
132
+ });
133
+ ```
134
+
135
+ ### Available Modules
136
+
137
+ - **`fmp.quote`** - Quote data for stocks, forex, crypto, commodities, and ETFs
138
+ - **`fmp.stock`** - Stock market data (market cap, splits, dividends, real-time prices)
139
+ - **`fmp.financial`** - Financial statements (income, balance sheet, cash flow)
140
+ - **`fmp.company`** - Company information and profiles
141
+ - **`fmp.etf`** - ETF data and holdings
142
+ - **`fmp.mutualFund`** - Mutual fund data
143
+ - **`fmp.economic`** - Economic indicators
144
+ - **`fmp.market`** - Market-wide data and performance
145
+ - **`fmp.list`** - Stock lists and indices
146
+ - **`fmp.screener`** - Stock screener with filters and available exchanges/sectors/industries/countries
147
+ - **`fmp.calendar`** - Earnings and economic calendar
148
+ - **`fmp.senateHouse`** - Congressional trading data
149
+ - **`fmp.institutional`** - Form 13F filings and institutional ownership
150
+ - **`fmp.insider`** - Insider trading data
151
+ - **`fmp.sec`** - SEC filings and industry classification
152
+ - **`fmp.news`** - Financial news articles (general, stock, crypto, forex; by symbol or latest)
153
+
154
+ ## Usage Examples
155
+
156
+ ### Quote Data
157
+
158
+ ```typescript
159
+ // Get real-time quote for any asset type
160
+ const quote = await fmp.quote.getQuote('AAPL');
161
+
162
+ // Get multiple quotes
163
+ const quotes = await fmp.quote.getQuotes(['AAPL', 'MSFT', 'GOOGL']);
164
+
165
+ // Get historical prices
166
+ const historical = await fmp.quote.getHistoricalPrice({
167
+ symbol: 'AAPL',
168
+ from: '2024-01-01',
169
+ to: '2024-12-31',
170
+ });
171
+
172
+ // Get intraday data
173
+ const intraday = await fmp.quote.getIntraday({
174
+ symbol: 'AAPL',
175
+ interval: '1hour',
176
+ from: '2024-01-01',
177
+ to: '2024-01-02',
178
+ });
179
+ ```
180
+
181
+ ### Stock Data
182
+
183
+ ```typescript
184
+ // Get market capitalization
185
+ const marketCap = await fmp.stock.getMarketCap('AAPL');
186
+
187
+ // Get stock splits
188
+ const splits = await fmp.stock.getStockSplits('AAPL');
189
+
190
+ // Get dividend history
191
+ const dividends = await fmp.stock.getDividendHistory('AAPL');
192
+
193
+ // Get real-time price data
194
+ const realTimePrice = await fmp.stock.getRealTimePrice(['AAPL', 'MSFT', 'GOOGL']);
195
+
196
+ // Get full real-time price data
197
+ const fullRealTimeData = await fmp.stock.getRealTimePriceForMultipleStocks([
198
+ 'AAPL',
199
+ 'MSFT',
200
+ 'GOOGL',
201
+ ]);
202
+ ```
203
+
204
+ ### Financial Statements
205
+
206
+ ```typescript
207
+ // Get income statement
208
+ const income = await fmp.financial.getIncomeStatement({
209
+ symbol: 'AAPL',
210
+ period: 'annual',
211
+ limit: 10,
212
+ });
213
+
214
+ // Get balance sheet
215
+ const balance = await fmp.financial.getBalanceSheet({
216
+ symbol: 'AAPL',
217
+ period: 'quarter',
218
+ });
219
+
220
+ // Get cash flow statement
221
+ const cashFlow = await fmp.financial.getCashFlowStatement({
222
+ symbol: 'AAPL',
223
+ period: 'annual',
224
+ });
225
+
226
+ // Get key metrics
227
+ const metrics = await fmp.financial.getKeyMetrics({ symbol: 'AAPL' });
228
+
229
+ // Get financial ratios
230
+ const ratios = await fmp.financial.getFinancialRatios({ symbol: 'AAPL' });
231
+ ```
232
+
233
+ ### Market Data
234
+
235
+ ```typescript
236
+ // Get market hours
237
+ const hours = await fmp.market.getMarketHours();
238
+
239
+ // Get market performance
240
+ const performance = await fmp.market.getMarketPerformance();
241
+
242
+ // Get gainers and losers
243
+ const gainers = await fmp.market.getGainers();
244
+ const losers = await fmp.market.getLosers();
245
+
246
+ // Get most active stocks
247
+ const mostActive = await fmp.market.getMostActive();
248
+
249
+ // Get sector performance
250
+ const sectors = await fmp.market.getSectorPerformance();
251
+ ```
252
+
253
+ ### Economic Indicators
254
+
255
+ ```typescript
256
+ // Get treasury rates
257
+ const treasury = await fmp.economic.getTreasuryRates({
258
+ from: '2024-01-01',
259
+ to: '2024-12-31',
260
+ });
261
+
262
+ // Get economic indicators by name (GDP, CPI, federalFunds, unemploymentRate, โ€ฆ)
263
+ const gdp = await fmp.economic.getEconomicIndicators({
264
+ name: 'GDP',
265
+ from: '2024-01-01',
266
+ to: '2024-12-31',
267
+ });
268
+ const cpi = await fmp.economic.getEconomicIndicators({ name: 'CPI' });
269
+ const unemployment = await fmp.economic.getEconomicIndicators({ name: 'unemploymentRate' });
270
+ ```
271
+
272
+ ### Other Asset Classes
273
+
274
+ ```typescript
275
+ // Forex
276
+ const forexQuote = await fmp.quote.getQuote('EURUSD');
277
+
278
+ // Cryptocurrency
279
+ const cryptoQuote = await fmp.quote.getQuote('BTCUSD');
280
+
281
+ // Symbol lists
282
+ const stocks = await fmp.list.getStockList();
283
+ const etfs = await fmp.list.getETFList();
284
+ const crypto = await fmp.list.getCryptoList();
285
+ const indexes = await fmp.list.getAvailableIndexes();
286
+
287
+ // Earnings calendar
288
+ const earnings = await fmp.calendar.getEarningsCalendar({
289
+ from: '2024-01-01',
290
+ to: '2024-12-31',
291
+ });
292
+
293
+ // Economic calendar
294
+ const economic = await fmp.calendar.getEconomicCalendar({
295
+ from: '2024-01-01',
296
+ to: '2024-12-31',
297
+ });
298
+
299
+ // Company profile
300
+ const companyProfile = await fmp.company.getCompanyProfile('AAPL');
301
+ ```
302
+
303
+ ### Stock Screener
304
+
305
+ ```typescript
306
+ // Filter stocks by multiple criteria
307
+ const results = await fmp.screener.getScreener({
308
+ marketCapMoreThan: 10000000000,
309
+ sector: 'Technology',
310
+ isActivelyTrading: true,
311
+ limit: 50,
312
+ });
313
+
314
+ // Lookups for available filter values
315
+ const exchanges = await fmp.screener.getAvailableExchanges();
316
+ const sectors = await fmp.screener.getAvailableSectors();
317
+ const industries = await fmp.screener.getAvailableIndustries();
318
+ const countries = await fmp.screener.getAvailableCountries();
319
+ ```
320
+
321
+ ### News
322
+
323
+ ```typescript
324
+ // Latest news by asset class
325
+ const stockNews = await fmp.news.getStockNews({ from: '2024-01-01', to: '2024-01-31' });
326
+ const cryptoNews = await fmp.news.getCryptoNews({ limit: 50 });
327
+ const forexNews = await fmp.news.getForexNews({ limit: 50 });
328
+
329
+ // FMP-authored articles
330
+ const articles = await fmp.news.getArticles({ page: 1, limit: 20 });
331
+
332
+ // News for specific symbols
333
+ const aaplNews = await fmp.news.getStockNewsBySymbol({ symbols: ['AAPL', 'MSFT'] });
334
+ ```
335
+
336
+ ## Testing
337
+
338
+ This package includes comprehensive tests for all endpoints. There are two test scripts available:
339
+
340
+ ### Local Development
341
+
342
+ ```bash
343
+ pnpm test
344
+ ```
345
+
346
+ - Uses Jest to run all tests
347
+ - **Fully mocked and deterministic** โ€” no network and no API key required
348
+ - Live API validation is handled separately by `pnpm test:live` (see below)
349
+
350
+ ### Running Specific Tests
351
+
352
+ ```bash
353
+ # Run only unit tests (client + main FMP class)
354
+ pnpm test:unit
355
+
356
+ # Run tests for specific endpoints
357
+ pnpm test:stock
358
+ pnpm test:financial
359
+ pnpm test:market
360
+ pnpm test:quote
361
+ pnpm test:economic
362
+ pnpm test:list
363
+ pnpm test:calendar
364
+ pnpm test:company
365
+
366
+ # Run all endpoint tests
367
+ pnpm test:endpoints
368
+
369
+ # Inspect one endpoint's raw response against the live API
370
+ pnpm test:endpoint <name>
371
+
372
+ # Validate response shapes against the live API (needs FMP_API_KEY)
373
+ pnpm test:live
374
+ ```
375
+
376
+ ## Response Format
377
+
378
+ All API methods return a standardized response format:
379
+
380
+ ```typescript
381
+ interface APIResponse<T> {
382
+ success: boolean;
383
+ data: T | null;
384
+ error: string | null;
385
+ status: number;
386
+ }
387
+ ```
388
+
389
+ ### Example Response
390
+
391
+ ```typescript
392
+ {
393
+ success: true,
394
+ data: {
395
+ symbol: 'AAPL',
396
+ price: 150.25,
397
+ change: 2.15,
398
+ changePercent: 1.45,
399
+ // ... other fields
400
+ },
401
+ error: null,
402
+ status: 200
403
+ }
404
+ ```
405
+
406
+ ## Error Handling
407
+
408
+ ```typescript
409
+ try {
410
+ const quote = await fmp.quote.getQuote('INVALID');
411
+
412
+ if (!quote.success) {
413
+ console.error('API Error:', quote.error);
414
+ return;
415
+ }
416
+
417
+ if (quote.data) {
418
+ console.log('Quote:', quote.data);
419
+ }
420
+ } catch (error) {
421
+ console.error('Network Error:', error);
422
+ }
423
+ ```
424
+
425
+ ## Type Safety
426
+
427
+ The library provides full TypeScript support with comprehensive type definitions included in the main package:
428
+
429
+ ```typescript
430
+ import { Quote, MarketCap, IncomeStatement } from 'fmp-node-api';
431
+
432
+ // All responses are properly typed
433
+ const quote: APIResponse<Quote> = await fmp.quote.getQuote('AAPL');
434
+ const marketCap: APIResponse<MarketCap> = await fmp.stock.getMarketCap('AAPL');
435
+ const income: APIResponse<IncomeStatement[]> = await fmp.financial.getIncomeStatement({
436
+ symbol: 'AAPL',
437
+ });
438
+ ```
439
+
440
+ All API responses and parameters are fully typed for complete type safety.
441
+
442
+ ## Utilities
443
+
444
+ The library includes helpful utilities for data formatting and validation:
445
+
446
+ ```typescript
447
+ import {
448
+ formatCurrency,
449
+ formatPercentage,
450
+ formatLargeNumber,
451
+ formatDate,
452
+ formatVolume,
453
+ } from 'fmp-node-api';
454
+
455
+ // Format financial data
456
+ const formattedPrice = formatCurrency(150.25); // "$150.25"
457
+ const formattedChange = formatPercentage(1.45); // "1.45%"
458
+ const formattedMarketCap = formatLargeNumber(2500000000); // "2.50B"
459
+ const formattedVolume = formatVolume(1500000); // "1.50M"
460
+ const formattedDate = formatDate('2024-01-15'); // "2024-01-15"
461
+ ```
462
+
463
+ ## Advanced Usage
464
+
465
+ ### Custom Client Configuration
466
+
467
+ ```typescript
468
+ import { FMPClient } from 'fmp-node-api';
469
+
470
+ // Using environment variable
471
+ const client = new FMPClient({
472
+ timeout: 15000, // optional, apiKey from FMP_API_KEY env var
473
+ });
474
+
475
+ // Or with explicit API key
476
+ const client = new FMPClient({
477
+ apiKey: 'your-api-key',
478
+ timeout: 15000, // optional
479
+ });
480
+
481
+ // Use individual endpoint classes
482
+ const stockEndpoints = new StockEndpoints(client);
483
+ const marketCap = await stockEndpoints.getMarketCap('AAPL');
484
+ ```
485
+
486
+ ### Direct API Calls
487
+
488
+ ```typescript
489
+ const client = fmp.getClient();
490
+ const response = await client.get('/quote/AAPL');
491
+ ```
492
+
493
+ ## Testing
494
+
495
+ The library includes a comprehensive test suite with extensive coverage across all endpoints, types, and utilities:
496
+
497
+ ### Available Test Scripts
498
+
499
+ ```bash
500
+ # Run all tests
501
+ pnpm test
502
+
503
+ # Run specific test categories
504
+ pnpm test:unit # Unit tests (client, main FMP class)
505
+ pnpm test:endpoints # All endpoint tests (mocked)
506
+ pnpm test:stock # Stock endpoint tests only
507
+ pnpm test:financial # Financial endpoint tests only
508
+ pnpm test:market # Market endpoint tests only
509
+ pnpm test:quote # Quote endpoint tests only
510
+ pnpm test:economic # Economic endpoint tests only
511
+ pnpm test:list # List endpoint tests only
512
+ pnpm test:calendar # Calendar endpoint tests only
513
+ pnpm test:company # Company endpoint tests only
514
+
515
+ # Manual testing with real API calls
516
+ pnpm test:endpoint # Run a specific endpoint against the live API
517
+
518
+ # Development
519
+ pnpm test:watch # Watch mode for development
520
+ pnpm test:coverage # Generate coverage report
521
+ ```
522
+
523
+ **Note**: Additional endpoint-specific test scripts (`test:etf`, `test:mutual-fund`, `test:senate-house`, `test:institutional`, `test:insider`, `test:sec`) are also available, both here and at the repo root.
524
+
525
+ ### Live API shape check (`test:live`)
526
+
527
+ `test:live` validates real FMP responses against the canonical Zod schemas in `fmp-node-types` โ€” catching renamed/missing/changed fields and version-mismatch 404s, not just "did it respond". Unlike `test:endpoint` (which prints one endpoint's raw JSON), `test:live` runs many cases and prints a classified summary.
528
+
529
+ Run from the repo root (it builds `fmp-node-types` first so the runner uses fresh schemas):
530
+
531
+ ```bash
532
+ pnpm test:live # all seeded cases
533
+ pnpm test:live --category quote,stock # only these categories
534
+ pnpm test:live --endpoint getQuote # cases whose name matches
535
+ pnpm test:live --dry-run # list cases, make NO API calls
536
+ pnpm test:live --category financial --max-calls 10
537
+ ```
538
+
539
+ Each result is classified:
540
+
541
+ - **PASS** โ€” response matches the schema
542
+ - **FAIL** โ€” an expected field is missing or has the wrong (non-null) type
543
+ - **SKIP** โ€” plan-locked (HTTP 402/403) or rate/quota limited (429)
544
+ - **DRIFT** โ€” extra top-level fields, or a non-nullable field came back `null`
545
+
546
+ Flags: `--delay <ms>` (default 400) paces calls; `--max-calls <n>` (default 50) caps live calls; `--include-locked` also runs cases marked `planLocked`; `--fail-on-drift` makes DRIFT fail the exit code. The runner is sequential and throttled to stay within limited API plans โ€” the first full run doubles as a calibration pass: mark any consistently plan-locked endpoints `planLocked: true` in `scripts/live/manifest.ts` so later default runs skip them. Exits non-zero when any case FAILs.
547
+
548
+ > Coverage note: the seeded manifest currently covers the `quote`, `stock`, `financial`, and `market` categories. The classifier logic is unit-tested in `src/__tests__/live/validate.test.ts` (no API key needed).
549
+
550
+ ## Development
551
+
552
+ ### Prerequisites
553
+
554
+ - Node.js 18+
555
+ - pnpm (recommended) or npm
556
+ - FMP API key
557
+
558
+ ### Setup
559
+
560
+ ```bash
561
+ # Clone the repository
562
+ git clone <repository-url>
563
+ cd fmp-node-wrapper
564
+
565
+ # Install dependencies
566
+ pnpm install
567
+
568
+ # Set up environment variables
569
+ cp .env.example .env
570
+ # Add your FMP_API_KEY to .env
571
+
572
+ # Build the package
573
+ pnpm build
574
+
575
+ # Run tests
576
+ pnpm test
577
+ ```
578
+
579
+ ### Available Scripts
580
+
581
+ ```bash
582
+ # Build
583
+ pnpm build # Build the package
584
+ pnpm dev # Watch mode for development
585
+
586
+ # Testing
587
+ pnpm test # Run all tests (mocked, deterministic)
588
+ pnpm test:watch # Watch mode
589
+ pnpm test:coverage # Coverage report
590
+ pnpm test:live # Validate response shapes against the live API
591
+ pnpm test:endpoint # Inspect one endpoint's raw response (live)
592
+ pnpm test:unit # Run unit tests
593
+ pnpm test:endpoints # Run all endpoint tests
594
+ pnpm test:stock # Run stock endpoint tests
595
+ pnpm test:financial # Run financial endpoint tests
596
+ pnpm test:market # Run market endpoint tests
597
+ pnpm test:quote # Run quote endpoint tests
598
+ pnpm test:economic # Run economic endpoint tests
599
+ pnpm test:list # Run list endpoint tests
600
+ pnpm test:calendar # Run calendar endpoint tests
601
+ pnpm test:company # Run company endpoint tests
602
+
603
+ # Code Quality
604
+ pnpm lint # Run ESLint
605
+ pnpm lint:fix # Fix linting issues
606
+ pnpm format # Format code with Prettier
607
+ pnpm format:check # Check code formatting
608
+ pnpm type-check # TypeScript type checking
609
+
610
+ # Utilities
611
+ pnpm clean # Clean build artifacts
612
+ ```
613
+
614
+ ## File Structure
615
+
616
+ ```
617
+ src/
618
+ โ”œโ”€โ”€ client.ts # Base HTTP client (v3/v4/stable axios instances)
619
+ โ”œโ”€โ”€ fmp.ts # Main FMP class (wires up all endpoint classes)
620
+ โ”œโ”€โ”€ index.ts # Main exports
621
+ โ”œโ”€โ”€ types-only.ts # Types-only entry point (fmp-node-api/types)
622
+ โ”œโ”€โ”€ shared.ts # Shared error types
623
+ โ”œโ”€โ”€ endpoints/ # API endpoint classes (one per category)
624
+ โ”‚ โ”œโ”€โ”€ quote.ts
625
+ โ”‚ โ”œโ”€โ”€ stock.ts
626
+ โ”‚ โ”œโ”€โ”€ financial.ts
627
+ โ”‚ โ”œโ”€โ”€ company.ts
628
+ โ”‚ โ”œโ”€โ”€ etf.ts
629
+ โ”‚ โ”œโ”€โ”€ mutual-fund.ts
630
+ โ”‚ โ”œโ”€โ”€ economic.ts
631
+ โ”‚ โ”œโ”€โ”€ market.ts
632
+ โ”‚ โ”œโ”€โ”€ list.ts
633
+ โ”‚ โ”œโ”€โ”€ screener.ts
634
+ โ”‚ โ”œโ”€โ”€ calendar.ts
635
+ โ”‚ โ”œโ”€โ”€ senate-house.ts
636
+ โ”‚ โ”œโ”€โ”€ institutional.ts
637
+ โ”‚ โ”œโ”€โ”€ insider.ts
638
+ โ”‚ โ”œโ”€โ”€ sec.ts
639
+ โ”‚ โ””โ”€โ”€ news.ts
640
+ โ”œโ”€โ”€ utils/ # Utility functions
641
+ โ”‚ โ”œโ”€โ”€ validation.ts # Input validation
642
+ โ”‚ โ”œโ”€โ”€ formatting.ts # Data formatting
643
+ โ”‚ โ”œโ”€โ”€ constants.ts # API constants
644
+ โ”‚ โ”œโ”€โ”€ helpers.ts # Shared helpers
645
+ โ”‚ โ”œโ”€โ”€ debug.ts # Debug logging
646
+ โ”‚ โ””โ”€โ”€ utils.ts # Misc utilities
647
+ โ”œโ”€โ”€ live/ # Live-check classifier (dev-only; not exported/shipped)
648
+ โ”‚ โ””โ”€โ”€ validate.ts # Relaxed validator / classifier (PASS/FAIL/SKIP/DRIFT)
649
+ โ””โ”€โ”€ __tests__/ # Jest tests (client, fmp, integration, endpoints/, utils/, live/)
650
+
651
+ scripts/
652
+ โ”œโ”€โ”€ test-endpoint.ts # Manual live-API endpoint inspector (raw JSON, one endpoint)
653
+ โ””โ”€โ”€ live/ # Live-API shape-check tool (pnpm test:live)
654
+ โ”œโ”€โ”€ run.ts # CLI runner (flags, throttle, budget, summary)
655
+ โ”œโ”€โ”€ manifest.ts # Data-driven registry of cases (endpoint + inputs + schema)
656
+ โ””โ”€โ”€ tsconfig.json # Type-checks the runner (pnpm type-check:live)
657
+ ```
658
+
659
+ ## Contributing
660
+
661
+ We welcome contributions! This is a community-driven project, and your help is greatly appreciated.
662
+
663
+ ### Quick Start
664
+
665
+ 1. **Fork the repository**
666
+ 2. **Create a feature branch**: `git checkout -b feature/your-feature-name`
667
+ 3. **Make your changes** following our development guidelines
668
+ 4. **Run quality checks**: `pnpm lint && pnpm test && pnpm type-check`
669
+ 5. **Open a Pull Request** with a clear description of your changes
670
+
671
+ ### Development Setup
672
+
673
+ ```bash
674
+ # Install dependencies
675
+ pnpm install
676
+
677
+ # Set up environment
678
+ cp .env.example .env
679
+ # Add your FMP_API_KEY to .env
680
+
681
+ # Build and test
682
+ pnpm build
683
+ pnpm test
684
+ ```
685
+
686
+ ### Getting Help
687
+
688
+ - **๐Ÿ“– [Contributing Guide](https://github.com/e-roy/fmp-node-wrapper/blob/main/CONTRIBUTING.md)**: Detailed guidelines and development setup
689
+ - **๐Ÿ› [Issues](https://github.com/e-roy/fmp-node-wrapper/issues)**: Report bugs or request features
690
+ - **๐Ÿ“š [Documentation](https://fmp-node-wrapper-docs.vercel.app)**: Check the docs first
691
+
692
+ ### Before Contributing
693
+
694
+ - [ ] Read the [Contributing Guide](https://github.com/e-roy/fmp-node-wrapper/blob/main/CONTRIBUTING.md)
695
+ - [ ] Check existing issues to avoid duplicates
696
+ - [ ] Test with the latest version of the library
697
+ - [ ] Follow our coding standards and testing requirements
698
+
699
+ ## Issues and Support
700
+
701
+ ### Reporting Issues
702
+
703
+ Before creating an issue, please:
704
+
705
+ 1. **Check existing issues** to avoid duplicates
706
+ 2. **Search the documentation** for solutions
707
+ 3. **Test with the latest version** of the library
708
+ 4. **Provide a minimal reproduction** of the problem
709
+
710
+ ### Issue Guidelines
711
+
712
+ - **Be specific**: Provide clear, actionable information
713
+ - **Include examples**: Code examples help reproduce issues
714
+ - **Check versions**: Mention Node.js and library versions
715
+ - **Separate concerns**: Don't mix multiple issues in one report
716
+
717
+ ### Support Channels
718
+
719
+ - **๐Ÿ› [GitHub Issues](https://github.com/e-roy/fmp-node-wrapper/issues)**: For bug reports and feature requests
720
+ - **๐Ÿ“ง [FMP Official Support](https://site.financialmodelingprep.com/developer/docs/stable)**: For issues with the underlying FMP API service
721
+
722
+ ## License
723
+
724
+ MIT License - see LICENSE file for details.
725
+
726
+ ## Support
727
+
728
+ For issues, questions, or contributions, please visit the [GitHub repository](https://github.com/e-roy/fmp-node-wrapper).
729
+
730
+ ## Disclaimer
731
+
732
+ **This package is not affiliated with, endorsed by, or sponsored by Financial Modeling Prep (FMP).** This is an independent, community-developed Node.js wrapper for the FMP API.
733
+
734
+ ### Important Legal Information
735
+
736
+ - **No Affiliation**: This library is developed independently and is not officially associated with Financial Modeling Prep
737
+ - **No Warranty**: This software is provided "as is" without any warranties, express or implied
738
+ - **User Responsibility**: Users are responsible for:
739
+ - Complying with FMP's terms of service and API usage limits
740
+ - Obtaining and maintaining valid API keys from Financial Modeling Prep
741
+ - Ensuring their usage complies with applicable laws and regulations
742
+ - **Limitation of Liability**: The developers of this wrapper are not responsible for:
743
+ - Any issues with the underlying FMP API service
744
+ - Data accuracy or availability from the FMP API
745
+ - Any financial losses or damages resulting from the use of this library
746
+ - API rate limiting, downtime, or service interruptions
747
+ - **Official Support**: For official support, documentation, or API issues, please contact Financial Modeling Prep directly at their official channels