fmp-node-api 0.0.2 → 0.0.3
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 -75
- package/dist/index.d.mts +697 -383
- package/dist/index.d.ts +697 -383
- package/dist/index.js +490 -248
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +488 -245
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -4,25 +4,6 @@ A comprehensive Node.js wrapper for the Financial Modeling Prep (FMP) API with f
|
|
|
4
4
|
|
|
5
5
|
> **📖 For development information, contributing guidelines, and project details, visit the [main repository](https://github.com/e-roy/fmp-node-wrapper).**
|
|
6
6
|
|
|
7
|
-
## Disclaimer
|
|
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
|
|
25
|
-
|
|
26
7
|
## Features
|
|
27
8
|
|
|
28
9
|
- 🚀 **Complete TypeScript Support** - Full type safety for all API responses
|
|
@@ -75,7 +56,6 @@ import { FMP } from 'fmp-node-api';
|
|
|
75
56
|
|
|
76
57
|
const fmp = new FMP({
|
|
77
58
|
apiKey: 'your-api-key',
|
|
78
|
-
baseURL: 'https://financialmodelingprep.com/stable', // optional
|
|
79
59
|
timeout: 10000, // optional
|
|
80
60
|
});
|
|
81
61
|
```
|
|
@@ -91,6 +71,9 @@ const fmp = new FMP({
|
|
|
91
71
|
- **`fmp.bond`** - Bond market data
|
|
92
72
|
- **`fmp.economic`** - Economic indicators
|
|
93
73
|
- **`fmp.market`** - Market-wide data and performance
|
|
74
|
+
- **`fmp.list`** - Stock lists and indices
|
|
75
|
+
- **`fmp.calendar`** - Earnings and economic calendar
|
|
76
|
+
- **`fmp.company`** - Company information and search
|
|
94
77
|
|
|
95
78
|
## Usage Examples
|
|
96
79
|
|
|
@@ -190,7 +173,7 @@ const unemployment = await fmp.economic.getUnemployment();
|
|
|
190
173
|
|
|
191
174
|
### Other Asset Classes
|
|
192
175
|
|
|
193
|
-
|
|
176
|
+
````typescript
|
|
194
177
|
// Forex
|
|
195
178
|
const forexQuote = await fmp.forex.getQuote({ symbol: 'EURUSD' });
|
|
196
179
|
const forexList = await fmp.forex.getForexList();
|
|
@@ -198,7 +181,29 @@ const forexList = await fmp.forex.getForexList();
|
|
|
198
181
|
// Cryptocurrency
|
|
199
182
|
const cryptoQuote = await fmp.crypto.getQuote({ symbol: 'BTCUSD' });
|
|
200
183
|
const cryptoList = await fmp.crypto.getCryptoList();
|
|
201
|
-
|
|
184
|
+
|
|
185
|
+
// Stock lists and indices
|
|
186
|
+
const sp500 = await fmp.list.getSP500();
|
|
187
|
+
const nasdaq = await fmp.list.getNasdaq100();
|
|
188
|
+
const dowJones = await fmp.list.getDowJones();
|
|
189
|
+
|
|
190
|
+
// Earnings calendar
|
|
191
|
+
const earnings = await fmp.calendar.getEarningsCalendar({
|
|
192
|
+
from: '2024-01-01',
|
|
193
|
+
to: '2024-12-31',
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
// Economic calendar
|
|
197
|
+
const economic = await fmp.calendar.getEconomicCalendar({
|
|
198
|
+
from: '2024-01-01',
|
|
199
|
+
to: '2024-12-31',
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
// Company search
|
|
203
|
+
const companies = await fmp.company.searchCompany({ query: 'Apple' });
|
|
204
|
+
|
|
205
|
+
// Company profile
|
|
206
|
+
const companyProfile = await fmp.company.getCompanyProfile({ symbol: 'AAPL' });
|
|
202
207
|
|
|
203
208
|
## Testing
|
|
204
209
|
|
|
@@ -208,7 +213,7 @@ This package includes comprehensive tests for all endpoints. There are two test
|
|
|
208
213
|
|
|
209
214
|
```bash
|
|
210
215
|
pnpm test
|
|
211
|
-
|
|
216
|
+
````
|
|
212
217
|
|
|
213
218
|
- Uses Jest to run all tests
|
|
214
219
|
- Automatically loads API key from `.env` file
|
|
@@ -224,13 +229,6 @@ pnpm test:ci
|
|
|
224
229
|
- Requires `FMP_API_KEY` environment variable to be set
|
|
225
230
|
- Used by CI/CD pipelines
|
|
226
231
|
|
|
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
232
|
### Running Specific Tests
|
|
235
233
|
|
|
236
234
|
```bash
|
|
@@ -246,21 +244,19 @@ pnpm test:financial
|
|
|
246
244
|
pnpm test:market
|
|
247
245
|
pnpm test:forex
|
|
248
246
|
pnpm test:economic
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
const etfQuote = await fmp.etf.getQuote({ symbol: 'SPY' });
|
|
253
|
-
const etfHoldings = await fmp.etf.getHoldings({ symbol: 'SPY' });
|
|
247
|
+
pnpm test:list
|
|
248
|
+
pnpm test:calendar
|
|
249
|
+
pnpm test:company
|
|
254
250
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
const mfHoldings = await fmp.mutualFund.getHoldings({ symbol: 'VFINX' });
|
|
251
|
+
# Run all endpoint tests
|
|
252
|
+
pnpm test:endpoints
|
|
258
253
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
const bondList = await fmp.bond.getBondList();
|
|
254
|
+
# Manual testing with real API calls
|
|
255
|
+
pnpm test:manual
|
|
262
256
|
|
|
263
|
-
|
|
257
|
+
# Run specific endpoint test
|
|
258
|
+
pnpm test:endpoint
|
|
259
|
+
```
|
|
264
260
|
|
|
265
261
|
## Response Format
|
|
266
262
|
|
|
@@ -273,7 +269,7 @@ interface APIResponse<T> {
|
|
|
273
269
|
error?: string;
|
|
274
270
|
status?: number;
|
|
275
271
|
}
|
|
276
|
-
|
|
272
|
+
```
|
|
277
273
|
|
|
278
274
|
### Example Response
|
|
279
275
|
|
|
@@ -363,8 +359,7 @@ import { FMPClient } from 'fmp-node-api';
|
|
|
363
359
|
|
|
364
360
|
const client = new FMPClient({
|
|
365
361
|
apiKey: 'your-api-key',
|
|
366
|
-
|
|
367
|
-
timeout: 15000,
|
|
362
|
+
timeout: 15000, // optional
|
|
368
363
|
});
|
|
369
364
|
|
|
370
365
|
// Use individual endpoint classes
|
|
@@ -398,9 +393,13 @@ pnpm test:financial # Financial endpoint tests only
|
|
|
398
393
|
pnpm test:market # Market endpoint tests only
|
|
399
394
|
pnpm test:forex # Forex endpoint tests only
|
|
400
395
|
pnpm test:economic # Economic endpoint tests only
|
|
396
|
+
pnpm test:list # List endpoint tests only
|
|
397
|
+
pnpm test:calendar # Calendar endpoint tests only
|
|
398
|
+
pnpm test:company # Company endpoint tests only
|
|
401
399
|
|
|
402
400
|
# Manual testing with real API calls
|
|
403
401
|
pnpm test:manual # Test real API integration
|
|
402
|
+
pnpm test:endpoint # Run specific endpoint test
|
|
404
403
|
|
|
405
404
|
# Development
|
|
406
405
|
pnpm test:watch # Watch mode for development
|
|
@@ -409,33 +408,6 @@ pnpm test:coverage # Generate coverage report
|
|
|
409
408
|
|
|
410
409
|
**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
410
|
|
|
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
411
|
## Development
|
|
440
412
|
|
|
441
413
|
### Prerequisites
|
|
@@ -477,11 +449,24 @@ pnpm test # Run all tests
|
|
|
477
449
|
pnpm test:watch # Watch mode
|
|
478
450
|
pnpm test:coverage # Coverage report
|
|
479
451
|
pnpm test:manual # Manual API testing
|
|
452
|
+
pnpm test:endpoint # Run specific endpoint test
|
|
453
|
+
pnpm test:unit # Run unit tests
|
|
454
|
+
pnpm test:integration # Run integration tests
|
|
455
|
+
pnpm test:endpoints # Run all endpoint tests
|
|
456
|
+
pnpm test:stock # Run stock endpoint tests
|
|
457
|
+
pnpm test:financial # Run financial endpoint tests
|
|
458
|
+
pnpm test:market # Run market endpoint tests
|
|
459
|
+
pnpm test:forex # Run forex endpoint tests
|
|
460
|
+
pnpm test:economic # Run economic endpoint tests
|
|
461
|
+
pnpm test:list # Run list endpoint tests
|
|
462
|
+
pnpm test:calendar # Run calendar endpoint tests
|
|
463
|
+
pnpm test:company # Run company endpoint tests
|
|
480
464
|
|
|
481
465
|
# Code Quality
|
|
482
466
|
pnpm lint # Run ESLint
|
|
483
467
|
pnpm lint:fix # Fix linting issues
|
|
484
468
|
pnpm format # Format code with Prettier
|
|
469
|
+
pnpm format:check # Check code formatting
|
|
485
470
|
pnpm type-check # TypeScript type checking
|
|
486
471
|
|
|
487
472
|
# Utilities
|
|
@@ -507,7 +492,10 @@ src/
|
|
|
507
492
|
│ ├── mutual-fund.ts # Mutual fund types
|
|
508
493
|
│ ├── bond.ts # Bond types
|
|
509
494
|
│ ├── economic.ts # Economic types
|
|
510
|
-
│
|
|
495
|
+
│ ├── market.ts # Market types
|
|
496
|
+
│ ├── list.ts # List types
|
|
497
|
+
│ ├── calendar.ts # Calendar types
|
|
498
|
+
│ └── company.ts # Company types
|
|
511
499
|
├── endpoints/ # API endpoint classes
|
|
512
500
|
│ ├── index.ts
|
|
513
501
|
│ ├── stock.ts
|
|
@@ -518,7 +506,10 @@ src/
|
|
|
518
506
|
│ ├── mutual-fund.ts
|
|
519
507
|
│ ├── bond.ts
|
|
520
508
|
│ ├── economic.ts
|
|
521
|
-
│
|
|
509
|
+
│ ├── market.ts
|
|
510
|
+
│ ├── list.ts
|
|
511
|
+
│ ├── calendar.ts
|
|
512
|
+
│ └── company.ts
|
|
522
513
|
├── utils/ # Utility functions
|
|
523
514
|
│ ├── index.ts
|
|
524
515
|
│ ├── validation.ts # Input validation
|
|
@@ -537,7 +528,10 @@ src/
|
|
|
537
528
|
│ │ ├── crypto.test.ts
|
|
538
529
|
│ │ ├── etf.test.ts
|
|
539
530
|
│ │ ├── mutual-fund.test.ts
|
|
540
|
-
│ │
|
|
531
|
+
│ │ ├── bond.test.ts
|
|
532
|
+
│ │ ├── list.test.ts
|
|
533
|
+
│ │ ├── calendar.test.ts
|
|
534
|
+
│ │ └── company.test.ts
|
|
541
535
|
│ ├── types/ # Type definition tests
|
|
542
536
|
│ │ ├── common.test.ts
|
|
543
537
|
│ │ ├── stock.test.ts
|
|
@@ -620,3 +614,22 @@ MIT License - see LICENSE file for details.
|
|
|
620
614
|
## Support
|
|
621
615
|
|
|
622
616
|
For issues, questions, or contributions, please visit the [GitHub repository](https://github.com/e-roy/fmp-node-wrapper).
|
|
617
|
+
|
|
618
|
+
## Disclaimer
|
|
619
|
+
|
|
620
|
+
**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.
|
|
621
|
+
|
|
622
|
+
### Important Legal Information
|
|
623
|
+
|
|
624
|
+
- **No Affiliation**: This library is developed independently and is not officially associated with Financial Modeling Prep
|
|
625
|
+
- **No Warranty**: This software is provided "as is" without any warranties, express or implied
|
|
626
|
+
- **User Responsibility**: Users are responsible for:
|
|
627
|
+
- Complying with FMP's terms of service and API usage limits
|
|
628
|
+
- Obtaining and maintaining valid API keys from Financial Modeling Prep
|
|
629
|
+
- Ensuring their usage complies with applicable laws and regulations
|
|
630
|
+
- **Limitation of Liability**: The developers of this wrapper are not responsible for:
|
|
631
|
+
- Any issues with the underlying FMP API service
|
|
632
|
+
- Data accuracy or availability from the FMP API
|
|
633
|
+
- Any financial losses or damages resulting from the use of this library
|
|
634
|
+
- API rate limiting, downtime, or service interruptions
|
|
635
|
+
- **Official Support**: For official support, documentation, or API issues, please contact Financial Modeling Prep directly at their official channels
|