fmp-node-api 0.0.2 → 0.0.4
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 +88 -72
- package/dist/index.d.mts +908 -508
- package/dist/index.d.ts +908 -508
- package/dist/index.js +608 -240
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +606 -237
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -1
package/README.md
CHANGED
|
@@ -2,26 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
A comprehensive Node.js wrapper for the Financial Modeling Prep (FMP) API with full TypeScript support and organized endpoint structure.
|
|
4
4
|
|
|
5
|
-
> **📖
|
|
5
|
+
> **📖 Visit the [Documentation](https://fmp-node-wrapper-docs.vercel.app/) for detailed information.**
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
**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.
|
|
10
|
-
|
|
11
|
-
### Important Legal Information
|
|
12
|
-
|
|
13
|
-
- **No Affiliation**: This library is developed independently and is not officially associated with Financial Modeling Prep
|
|
14
|
-
- **No Warranty**: This software is provided "as is" without any warranties, express or implied
|
|
15
|
-
- **User Responsibility**: Users are responsible for:
|
|
16
|
-
- Complying with FMP's terms of service and API usage limits
|
|
17
|
-
- Obtaining and maintaining valid API keys from Financial Modeling Prep
|
|
18
|
-
- Ensuring their usage complies with applicable laws and regulations
|
|
19
|
-
- **Limitation of Liability**: The developers of this wrapper are not responsible for:
|
|
20
|
-
- Any issues with the underlying FMP API service
|
|
21
|
-
- Data accuracy or availability from the FMP API
|
|
22
|
-
- Any financial losses or damages resulting from the use of this library
|
|
23
|
-
- API rate limiting, downtime, or service interruptions
|
|
24
|
-
- **Official Support**: For official support, documentation, or API issues, please contact Financial Modeling Prep directly at their official channels
|
|
7
|
+
> **🔧 For development information, contributing guidelines, and project details, visit the [main repository](https://github.com/e-roy/fmp-node-wrapper).**
|
|
25
8
|
|
|
26
9
|
## Features
|
|
27
10
|
|
|
@@ -75,7 +58,6 @@ import { FMP } from 'fmp-node-api';
|
|
|
75
58
|
|
|
76
59
|
const fmp = new FMP({
|
|
77
60
|
apiKey: 'your-api-key',
|
|
78
|
-
baseURL: 'https://financialmodelingprep.com/stable', // optional
|
|
79
61
|
timeout: 10000, // optional
|
|
80
62
|
});
|
|
81
63
|
```
|
|
@@ -91,6 +73,9 @@ const fmp = new FMP({
|
|
|
91
73
|
- **`fmp.bond`** - Bond market data
|
|
92
74
|
- **`fmp.economic`** - Economic indicators
|
|
93
75
|
- **`fmp.market`** - Market-wide data and performance
|
|
76
|
+
- **`fmp.list`** - Stock lists and indices
|
|
77
|
+
- **`fmp.calendar`** - Earnings and economic calendar
|
|
78
|
+
- **`fmp.company`** - Company information and search
|
|
94
79
|
|
|
95
80
|
## Usage Examples
|
|
96
81
|
|
|
@@ -198,6 +183,29 @@ const forexList = await fmp.forex.getForexList();
|
|
|
198
183
|
// Cryptocurrency
|
|
199
184
|
const cryptoQuote = await fmp.crypto.getQuote({ symbol: 'BTCUSD' });
|
|
200
185
|
const cryptoList = await fmp.crypto.getCryptoList();
|
|
186
|
+
|
|
187
|
+
// Stock lists and indices
|
|
188
|
+
const sp500 = await fmp.list.getSP500();
|
|
189
|
+
const nasdaq = await fmp.list.getNasdaq100();
|
|
190
|
+
const dowJones = await fmp.list.getDowJones();
|
|
191
|
+
|
|
192
|
+
// Earnings calendar
|
|
193
|
+
const earnings = await fmp.calendar.getEarningsCalendar({
|
|
194
|
+
from: '2024-01-01',
|
|
195
|
+
to: '2024-12-31',
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
// Economic calendar
|
|
199
|
+
const economic = await fmp.calendar.getEconomicCalendar({
|
|
200
|
+
from: '2024-01-01',
|
|
201
|
+
to: '2024-12-31',
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
// Company search
|
|
205
|
+
const companies = await fmp.company.searchCompany({ query: 'Apple' });
|
|
206
|
+
|
|
207
|
+
// Company profile
|
|
208
|
+
const companyProfile = await fmp.company.getCompanyProfile({ symbol: 'AAPL' });
|
|
201
209
|
```
|
|
202
210
|
|
|
203
211
|
## Testing
|
|
@@ -224,13 +232,6 @@ pnpm test:ci
|
|
|
224
232
|
- Requires `FMP_API_KEY` environment variable to be set
|
|
225
233
|
- Used by CI/CD pipelines
|
|
226
234
|
|
|
227
|
-
### Test Structure
|
|
228
|
-
|
|
229
|
-
- **Unit Tests**: Test individual functions and utilities
|
|
230
|
-
- **Integration Tests**: Test actual API calls with real data
|
|
231
|
-
- **Type Tests**: Ensure TypeScript types are correct
|
|
232
|
-
- **Endpoint Tests**: Comprehensive coverage of all API endpoints
|
|
233
|
-
|
|
234
235
|
### Running Specific Tests
|
|
235
236
|
|
|
236
237
|
```bash
|
|
@@ -246,21 +247,19 @@ pnpm test:financial
|
|
|
246
247
|
pnpm test:market
|
|
247
248
|
pnpm test:forex
|
|
248
249
|
pnpm test:economic
|
|
249
|
-
|
|
250
|
+
pnpm test:list
|
|
251
|
+
pnpm test:calendar
|
|
252
|
+
pnpm test:company
|
|
250
253
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
const etfHoldings = await fmp.etf.getHoldings({ symbol: 'SPY' });
|
|
254
|
+
# Run all endpoint tests
|
|
255
|
+
pnpm test:endpoints
|
|
254
256
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
const mfHoldings = await fmp.mutualFund.getHoldings({ symbol: 'VFINX' });
|
|
258
|
-
|
|
259
|
-
// Bonds
|
|
260
|
-
const bondQuote = await fmp.bond.getQuote({ symbol: 'US10Y' });
|
|
261
|
-
const bondList = await fmp.bond.getBondList();
|
|
257
|
+
# Manual testing with real API calls
|
|
258
|
+
pnpm test:manual
|
|
262
259
|
|
|
263
|
-
|
|
260
|
+
# Run specific endpoint test
|
|
261
|
+
pnpm test:endpoint
|
|
262
|
+
```
|
|
264
263
|
|
|
265
264
|
## Response Format
|
|
266
265
|
|
|
@@ -273,7 +272,7 @@ interface APIResponse<T> {
|
|
|
273
272
|
error?: string;
|
|
274
273
|
status?: number;
|
|
275
274
|
}
|
|
276
|
-
|
|
275
|
+
```
|
|
277
276
|
|
|
278
277
|
### Example Response
|
|
279
278
|
|
|
@@ -363,8 +362,7 @@ import { FMPClient } from 'fmp-node-api';
|
|
|
363
362
|
|
|
364
363
|
const client = new FMPClient({
|
|
365
364
|
apiKey: 'your-api-key',
|
|
366
|
-
|
|
367
|
-
timeout: 15000,
|
|
365
|
+
timeout: 15000, // optional
|
|
368
366
|
});
|
|
369
367
|
|
|
370
368
|
// Use individual endpoint classes
|
|
@@ -398,9 +396,13 @@ pnpm test:financial # Financial endpoint tests only
|
|
|
398
396
|
pnpm test:market # Market endpoint tests only
|
|
399
397
|
pnpm test:forex # Forex endpoint tests only
|
|
400
398
|
pnpm test:economic # Economic endpoint tests only
|
|
399
|
+
pnpm test:list # List endpoint tests only
|
|
400
|
+
pnpm test:calendar # Calendar endpoint tests only
|
|
401
|
+
pnpm test:company # Company endpoint tests only
|
|
401
402
|
|
|
402
403
|
# Manual testing with real API calls
|
|
403
404
|
pnpm test:manual # Test real API integration
|
|
405
|
+
pnpm test:endpoint # Run specific endpoint test
|
|
404
406
|
|
|
405
407
|
# Development
|
|
406
408
|
pnpm test:watch # Watch mode for development
|
|
@@ -409,33 +411,6 @@ pnpm test:coverage # Generate coverage report
|
|
|
409
411
|
|
|
410
412
|
**Note**: Additional endpoint-specific test scripts (crypto, etf, mutual-fund, bond) are available in the package-level scripts but not exposed at the root level.
|
|
411
413
|
|
|
412
|
-
### Test Structure
|
|
413
|
-
|
|
414
|
-
```
|
|
415
|
-
src/__tests__/
|
|
416
|
-
├── client.test.ts # HTTP client tests
|
|
417
|
-
├── fmp.test.ts # Main FMP class tests
|
|
418
|
-
├── integration.test.ts # Integration tests
|
|
419
|
-
├── endpoints/ # Endpoint-specific tests
|
|
420
|
-
│ ├── stock.test.ts
|
|
421
|
-
│ ├── financial.test.ts
|
|
422
|
-
│ ├── market.test.ts
|
|
423
|
-
│ ├── forex.test.ts
|
|
424
|
-
│ ├── economic.test.ts
|
|
425
|
-
│ ├── crypto.test.ts
|
|
426
|
-
│ ├── etf.test.ts
|
|
427
|
-
│ ├── mutual-fund.test.ts
|
|
428
|
-
│ └── bond.test.ts
|
|
429
|
-
├── types/ # Type definition tests
|
|
430
|
-
│ ├── common.test.ts
|
|
431
|
-
│ ├── stock.test.ts
|
|
432
|
-
│ └── financial.test.ts
|
|
433
|
-
└── utils/ # Utility function tests
|
|
434
|
-
├── formatting.test.ts
|
|
435
|
-
├── validation.test.ts
|
|
436
|
-
└── test-setup.ts # Test utilities and setup
|
|
437
|
-
```
|
|
438
|
-
|
|
439
414
|
## Development
|
|
440
415
|
|
|
441
416
|
### Prerequisites
|
|
@@ -477,11 +452,24 @@ pnpm test # Run all tests
|
|
|
477
452
|
pnpm test:watch # Watch mode
|
|
478
453
|
pnpm test:coverage # Coverage report
|
|
479
454
|
pnpm test:manual # Manual API testing
|
|
455
|
+
pnpm test:endpoint # Run specific endpoint test
|
|
456
|
+
pnpm test:unit # Run unit tests
|
|
457
|
+
pnpm test:integration # Run integration tests
|
|
458
|
+
pnpm test:endpoints # Run all endpoint tests
|
|
459
|
+
pnpm test:stock # Run stock endpoint tests
|
|
460
|
+
pnpm test:financial # Run financial endpoint tests
|
|
461
|
+
pnpm test:market # Run market endpoint tests
|
|
462
|
+
pnpm test:forex # Run forex endpoint tests
|
|
463
|
+
pnpm test:economic # Run economic endpoint tests
|
|
464
|
+
pnpm test:list # Run list endpoint tests
|
|
465
|
+
pnpm test:calendar # Run calendar endpoint tests
|
|
466
|
+
pnpm test:company # Run company endpoint tests
|
|
480
467
|
|
|
481
468
|
# Code Quality
|
|
482
469
|
pnpm lint # Run ESLint
|
|
483
470
|
pnpm lint:fix # Fix linting issues
|
|
484
471
|
pnpm format # Format code with Prettier
|
|
472
|
+
pnpm format:check # Check code formatting
|
|
485
473
|
pnpm type-check # TypeScript type checking
|
|
486
474
|
|
|
487
475
|
# Utilities
|
|
@@ -507,7 +495,10 @@ src/
|
|
|
507
495
|
│ ├── mutual-fund.ts # Mutual fund types
|
|
508
496
|
│ ├── bond.ts # Bond types
|
|
509
497
|
│ ├── economic.ts # Economic types
|
|
510
|
-
│
|
|
498
|
+
│ ├── market.ts # Market types
|
|
499
|
+
│ ├── list.ts # List types
|
|
500
|
+
│ ├── calendar.ts # Calendar types
|
|
501
|
+
│ └── company.ts # Company types
|
|
511
502
|
├── endpoints/ # API endpoint classes
|
|
512
503
|
│ ├── index.ts
|
|
513
504
|
│ ├── stock.ts
|
|
@@ -518,7 +509,10 @@ src/
|
|
|
518
509
|
│ ├── mutual-fund.ts
|
|
519
510
|
│ ├── bond.ts
|
|
520
511
|
│ ├── economic.ts
|
|
521
|
-
│
|
|
512
|
+
│ ├── market.ts
|
|
513
|
+
│ ├── list.ts
|
|
514
|
+
│ ├── calendar.ts
|
|
515
|
+
│ └── company.ts
|
|
522
516
|
├── utils/ # Utility functions
|
|
523
517
|
│ ├── index.ts
|
|
524
518
|
│ ├── validation.ts # Input validation
|
|
@@ -537,7 +531,10 @@ src/
|
|
|
537
531
|
│ │ ├── crypto.test.ts
|
|
538
532
|
│ │ ├── etf.test.ts
|
|
539
533
|
│ │ ├── mutual-fund.test.ts
|
|
540
|
-
│ │
|
|
534
|
+
│ │ ├── bond.test.ts
|
|
535
|
+
│ │ ├── list.test.ts
|
|
536
|
+
│ │ ├── calendar.test.ts
|
|
537
|
+
│ │ └── company.test.ts
|
|
541
538
|
│ ├── types/ # Type definition tests
|
|
542
539
|
│ │ ├── common.test.ts
|
|
543
540
|
│ │ ├── stock.test.ts
|
|
@@ -620,3 +617,22 @@ MIT License - see LICENSE file for details.
|
|
|
620
617
|
## Support
|
|
621
618
|
|
|
622
619
|
For issues, questions, or contributions, please visit the [GitHub repository](https://github.com/e-roy/fmp-node-wrapper).
|
|
620
|
+
|
|
621
|
+
## Disclaimer
|
|
622
|
+
|
|
623
|
+
**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.
|
|
624
|
+
|
|
625
|
+
### Important Legal Information
|
|
626
|
+
|
|
627
|
+
- **No Affiliation**: This library is developed independently and is not officially associated with Financial Modeling Prep
|
|
628
|
+
- **No Warranty**: This software is provided "as is" without any warranties, express or implied
|
|
629
|
+
- **User Responsibility**: Users are responsible for:
|
|
630
|
+
- Complying with FMP's terms of service and API usage limits
|
|
631
|
+
- Obtaining and maintaining valid API keys from Financial Modeling Prep
|
|
632
|
+
- Ensuring their usage complies with applicable laws and regulations
|
|
633
|
+
- **Limitation of Liability**: The developers of this wrapper are not responsible for:
|
|
634
|
+
- Any issues with the underlying FMP API service
|
|
635
|
+
- Data accuracy or availability from the FMP API
|
|
636
|
+
- Any financial losses or damages resulting from the use of this library
|
|
637
|
+
- API rate limiting, downtime, or service interruptions
|
|
638
|
+
- **Official Support**: For official support, documentation, or API issues, please contact Financial Modeling Prep directly at their official channels
|