fmp-node-api 0.0.2
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/LICENSE +21 -0
- package/README.md +622 -0
- package/dist/index.d.mts +1431 -0
- package/dist/index.d.ts +1431 -0
- package/dist/index.js +762 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +717 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +66 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 FMP Node Wrapper
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,622 @@
|
|
|
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
|
+
> **๐ For development information, contributing guidelines, and project details, visit the [main repository](https://github.com/e-roy/fmp-node-wrapper).**
|
|
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
|
+
## Features
|
|
27
|
+
|
|
28
|
+
- ๐ **Complete TypeScript Support** - Full type safety for all API responses
|
|
29
|
+
- ๐ฆ **Organized Structure** - Clean separation of concerns with dedicated modules
|
|
30
|
+
- ๐ง **Easy to Use** - Simple, intuitive API with minimal boilerplate
|
|
31
|
+
- ๐ **Comprehensive Coverage** - Support for all FMP stable endpoints
|
|
32
|
+
- ๐ก๏ธ **Input Validation** - Built-in validation for all parameters
|
|
33
|
+
- ๐ฏ **Modular Design** - Import only what you need
|
|
34
|
+
- ๐งช **Comprehensive Testing** - Full test suite with 45+ tests covering all endpoints
|
|
35
|
+
- ๐ **Real-time Data** - Access to live market data and financial statements
|
|
36
|
+
|
|
37
|
+
## Installation
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm install fmp-node-api
|
|
41
|
+
# or
|
|
42
|
+
yarn add fmp-node-api
|
|
43
|
+
# or
|
|
44
|
+
pnpm add fmp-node-api
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Quick Start
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
import { FMP } from 'fmp-node-api';
|
|
51
|
+
|
|
52
|
+
const fmp = new FMP({ apiKey: 'your-api-key' });
|
|
53
|
+
|
|
54
|
+
// Get stock quote
|
|
55
|
+
const quote = await fmp.stock.getQuote({ symbol: 'AAPL' });
|
|
56
|
+
|
|
57
|
+
// Get financial statements
|
|
58
|
+
const incomeStatement = await fmp.financial.getIncomeStatement({
|
|
59
|
+
symbol: 'AAPL',
|
|
60
|
+
period: 'annual',
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
// Get forex data
|
|
64
|
+
const forexQuote = await fmp.forex.getQuote({ symbol: 'EURUSD' });
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## API Structure
|
|
68
|
+
|
|
69
|
+
The library is organized into logical modules for easy navigation and usage:
|
|
70
|
+
|
|
71
|
+
### Main Client
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
import { FMP } from 'fmp-node-api';
|
|
75
|
+
|
|
76
|
+
const fmp = new FMP({
|
|
77
|
+
apiKey: 'your-api-key',
|
|
78
|
+
baseURL: 'https://financialmodelingprep.com/stable', // optional
|
|
79
|
+
timeout: 10000, // optional
|
|
80
|
+
});
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Available Modules
|
|
84
|
+
|
|
85
|
+
- **`fmp.stock`** - Stock market data (quotes, profiles, historical prices, etc.)
|
|
86
|
+
- **`fmp.financial`** - Financial statements (income, balance sheet, cash flow)
|
|
87
|
+
- **`fmp.forex`** - Foreign exchange data
|
|
88
|
+
- **`fmp.crypto`** - Cryptocurrency data
|
|
89
|
+
- **`fmp.etf`** - ETF data and holdings
|
|
90
|
+
- **`fmp.mutualFund`** - Mutual fund data
|
|
91
|
+
- **`fmp.bond`** - Bond market data
|
|
92
|
+
- **`fmp.economic`** - Economic indicators
|
|
93
|
+
- **`fmp.market`** - Market-wide data and performance
|
|
94
|
+
|
|
95
|
+
## Usage Examples
|
|
96
|
+
|
|
97
|
+
### Stock Data
|
|
98
|
+
|
|
99
|
+
```typescript
|
|
100
|
+
// Get real-time quote
|
|
101
|
+
const quote = await fmp.stock.getQuote({ symbol: 'AAPL' });
|
|
102
|
+
|
|
103
|
+
// Get company profile
|
|
104
|
+
const profile = await fmp.stock.getCompanyProfile({ symbol: 'AAPL' });
|
|
105
|
+
|
|
106
|
+
// Get historical prices
|
|
107
|
+
const historical = await fmp.stock.getHistoricalPrice({
|
|
108
|
+
symbol: 'AAPL',
|
|
109
|
+
from: '2024-01-01',
|
|
110
|
+
to: '2024-12-31',
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
// Get stock splits
|
|
114
|
+
const splits = await fmp.stock.getStockSplits({ symbol: 'AAPL' });
|
|
115
|
+
|
|
116
|
+
// Get dividend history
|
|
117
|
+
const dividends = await fmp.stock.getDividendHistory({ symbol: 'AAPL' });
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Financial Statements
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
// Get income statement
|
|
124
|
+
const income = await fmp.financial.getIncomeStatement({
|
|
125
|
+
symbol: 'AAPL',
|
|
126
|
+
period: 'annual',
|
|
127
|
+
limit: 10,
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
// Get balance sheet
|
|
131
|
+
const balance = await fmp.financial.getBalanceSheet({
|
|
132
|
+
symbol: 'AAPL',
|
|
133
|
+
period: 'quarter',
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
// Get cash flow statement
|
|
137
|
+
const cashFlow = await fmp.financial.getCashFlowStatement({
|
|
138
|
+
symbol: 'AAPL',
|
|
139
|
+
period: 'annual',
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
// Get key metrics
|
|
143
|
+
const metrics = await fmp.financial.getKeyMetrics({ symbol: 'AAPL' });
|
|
144
|
+
|
|
145
|
+
// Get financial ratios
|
|
146
|
+
const ratios = await fmp.financial.getFinancialRatios({ symbol: 'AAPL' });
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Market Data
|
|
150
|
+
|
|
151
|
+
```typescript
|
|
152
|
+
// Get market hours
|
|
153
|
+
const hours = await fmp.market.getMarketHours();
|
|
154
|
+
|
|
155
|
+
// Get market performance
|
|
156
|
+
const performance = await fmp.market.getMarketPerformance();
|
|
157
|
+
|
|
158
|
+
// Get gainers and losers
|
|
159
|
+
const gainers = await fmp.market.getGainers();
|
|
160
|
+
const losers = await fmp.market.getLosers();
|
|
161
|
+
|
|
162
|
+
// Get most active stocks
|
|
163
|
+
const mostActive = await fmp.market.getMostActive();
|
|
164
|
+
|
|
165
|
+
// Get sector performance
|
|
166
|
+
const sectors = await fmp.market.getSectorPerformance();
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Economic Indicators
|
|
170
|
+
|
|
171
|
+
```typescript
|
|
172
|
+
// Get treasury rates
|
|
173
|
+
const treasury = await fmp.economic.getTreasuryRates({
|
|
174
|
+
from: '2024-01-01',
|
|
175
|
+
to: '2024-12-31',
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
// Get federal funds rate
|
|
179
|
+
const fedRate = await fmp.economic.getFederalFundsRate();
|
|
180
|
+
|
|
181
|
+
// Get CPI data
|
|
182
|
+
const cpi = await fmp.economic.getCPI();
|
|
183
|
+
|
|
184
|
+
// Get GDP data
|
|
185
|
+
const gdp = await fmp.economic.getGDP();
|
|
186
|
+
|
|
187
|
+
// Get unemployment data
|
|
188
|
+
const unemployment = await fmp.economic.getUnemployment();
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### Other Asset Classes
|
|
192
|
+
|
|
193
|
+
```typescript
|
|
194
|
+
// Forex
|
|
195
|
+
const forexQuote = await fmp.forex.getQuote({ symbol: 'EURUSD' });
|
|
196
|
+
const forexList = await fmp.forex.getForexList();
|
|
197
|
+
|
|
198
|
+
// Cryptocurrency
|
|
199
|
+
const cryptoQuote = await fmp.crypto.getQuote({ symbol: 'BTCUSD' });
|
|
200
|
+
const cryptoList = await fmp.crypto.getCryptoList();
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
## Testing
|
|
204
|
+
|
|
205
|
+
This package includes comprehensive tests for all endpoints. There are two test scripts available:
|
|
206
|
+
|
|
207
|
+
### Local Development
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
pnpm test
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
- Uses Jest to run all tests
|
|
214
|
+
- Automatically loads API key from `.env` file
|
|
215
|
+
- Requires a valid FMP API key in your `.env` file
|
|
216
|
+
|
|
217
|
+
### CI Environment
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
pnpm test:ci
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
- Uses Jest with explicit environment variable passing
|
|
224
|
+
- Requires `FMP_API_KEY` environment variable to be set
|
|
225
|
+
- Used by CI/CD pipelines
|
|
226
|
+
|
|
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
|
+
### Running Specific Tests
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
# Run only unit tests
|
|
238
|
+
pnpm test:unit
|
|
239
|
+
|
|
240
|
+
# Run only integration tests
|
|
241
|
+
pnpm test:integration
|
|
242
|
+
|
|
243
|
+
# Run tests for specific endpoints
|
|
244
|
+
pnpm test:stock
|
|
245
|
+
pnpm test:financial
|
|
246
|
+
pnpm test:market
|
|
247
|
+
pnpm test:forex
|
|
248
|
+
pnpm test:economic
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
// ETFs
|
|
252
|
+
const etfQuote = await fmp.etf.getQuote({ symbol: 'SPY' });
|
|
253
|
+
const etfHoldings = await fmp.etf.getHoldings({ symbol: 'SPY' });
|
|
254
|
+
|
|
255
|
+
// Mutual Funds
|
|
256
|
+
const mfQuote = await fmp.mutualFund.getQuote({ symbol: 'VFINX' });
|
|
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();
|
|
262
|
+
|
|
263
|
+
````
|
|
264
|
+
|
|
265
|
+
## Response Format
|
|
266
|
+
|
|
267
|
+
All API methods return a standardized response format:
|
|
268
|
+
|
|
269
|
+
```typescript
|
|
270
|
+
interface APIResponse<T> {
|
|
271
|
+
success: boolean;
|
|
272
|
+
data?: T;
|
|
273
|
+
error?: string;
|
|
274
|
+
status?: number;
|
|
275
|
+
}
|
|
276
|
+
````
|
|
277
|
+
|
|
278
|
+
### Example Response
|
|
279
|
+
|
|
280
|
+
```typescript
|
|
281
|
+
{
|
|
282
|
+
success: true,
|
|
283
|
+
data: [
|
|
284
|
+
{
|
|
285
|
+
symbol: 'AAPL',
|
|
286
|
+
price: 150.25,
|
|
287
|
+
change: 2.15,
|
|
288
|
+
changePercent: 1.45,
|
|
289
|
+
// ... other fields
|
|
290
|
+
}
|
|
291
|
+
],
|
|
292
|
+
status: 200
|
|
293
|
+
}
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
## Error Handling
|
|
297
|
+
|
|
298
|
+
```typescript
|
|
299
|
+
try {
|
|
300
|
+
const quote = await fmp.stock.getQuote({ symbol: 'INVALID' });
|
|
301
|
+
|
|
302
|
+
if (!quote.success) {
|
|
303
|
+
console.error('API Error:', quote.error);
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
console.log('Quote:', quote.data);
|
|
308
|
+
} catch (error) {
|
|
309
|
+
console.error('Network Error:', error);
|
|
310
|
+
}
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
## Type Safety
|
|
314
|
+
|
|
315
|
+
The library provides full TypeScript support with comprehensive type definitions:
|
|
316
|
+
|
|
317
|
+
```typescript
|
|
318
|
+
import { StockQuote, CompanyProfile, IncomeStatement } from 'fmp-node-api';
|
|
319
|
+
|
|
320
|
+
// All responses are properly typed
|
|
321
|
+
const quote: APIResponse<StockQuote[]> = await fmp.stock.getQuote({
|
|
322
|
+
symbol: 'AAPL',
|
|
323
|
+
});
|
|
324
|
+
const profile: APIResponse<CompanyProfile[]> = await fmp.stock.getCompanyProfile({
|
|
325
|
+
symbol: 'AAPL',
|
|
326
|
+
});
|
|
327
|
+
const income: APIResponse<IncomeStatement[]> = await fmp.financial.getIncomeStatement({
|
|
328
|
+
symbol: 'AAPL',
|
|
329
|
+
});
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
## Utilities
|
|
333
|
+
|
|
334
|
+
The library includes helpful utilities for data formatting and validation:
|
|
335
|
+
|
|
336
|
+
```typescript
|
|
337
|
+
import {
|
|
338
|
+
formatCurrency,
|
|
339
|
+
formatPercentage,
|
|
340
|
+
formatLargeNumber,
|
|
341
|
+
formatDate,
|
|
342
|
+
formatVolume,
|
|
343
|
+
formatNumber,
|
|
344
|
+
formatTimestamp,
|
|
345
|
+
formatReadableDate,
|
|
346
|
+
} from 'fmp-node-api';
|
|
347
|
+
|
|
348
|
+
// Format financial data
|
|
349
|
+
const formattedPrice = formatCurrency(150.25); // "$150.25"
|
|
350
|
+
const formattedChange = formatPercentage(1.45); // "1.45%"
|
|
351
|
+
const formattedMarketCap = formatLargeNumber(2500000000); // "2.50B"
|
|
352
|
+
const formattedVolume = formatVolume(1500000); // "1.50M"
|
|
353
|
+
const formattedDate = formatDate('2024-01-15'); // "2024-01-15"
|
|
354
|
+
const formattedTimestamp = formatTimestamp(1705276800); // "1/15/2024, 12:00:00 AM"
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
## Advanced Usage
|
|
358
|
+
|
|
359
|
+
### Custom Client Configuration
|
|
360
|
+
|
|
361
|
+
```typescript
|
|
362
|
+
import { FMPClient } from 'fmp-node-api';
|
|
363
|
+
|
|
364
|
+
const client = new FMPClient({
|
|
365
|
+
apiKey: 'your-api-key',
|
|
366
|
+
baseURL: 'https://financialmodelingprep.com/stable',
|
|
367
|
+
timeout: 15000,
|
|
368
|
+
});
|
|
369
|
+
|
|
370
|
+
// Use individual endpoint classes
|
|
371
|
+
const stockEndpoints = new StockEndpoints(client);
|
|
372
|
+
const quote = await stockEndpoints.getQuote({ symbol: 'AAPL' });
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
### Direct API Calls
|
|
376
|
+
|
|
377
|
+
```typescript
|
|
378
|
+
const client = fmp.getClient();
|
|
379
|
+
const response = await client.get('/quote/AAPL');
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
## Testing
|
|
383
|
+
|
|
384
|
+
The library includes a comprehensive test suite with extensive coverage across all endpoints, types, and utilities:
|
|
385
|
+
|
|
386
|
+
### Available Test Scripts
|
|
387
|
+
|
|
388
|
+
```bash
|
|
389
|
+
# Run all tests
|
|
390
|
+
pnpm test
|
|
391
|
+
|
|
392
|
+
# Run specific test categories
|
|
393
|
+
pnpm test:unit # Unit tests (client, main FMP class)
|
|
394
|
+
pnpm test:integration # Integration tests
|
|
395
|
+
pnpm test:endpoints # All endpoint tests
|
|
396
|
+
pnpm test:stock # Stock endpoint tests only
|
|
397
|
+
pnpm test:financial # Financial endpoint tests only
|
|
398
|
+
pnpm test:market # Market endpoint tests only
|
|
399
|
+
pnpm test:forex # Forex endpoint tests only
|
|
400
|
+
pnpm test:economic # Economic endpoint tests only
|
|
401
|
+
|
|
402
|
+
# Manual testing with real API calls
|
|
403
|
+
pnpm test:manual # Test real API integration
|
|
404
|
+
|
|
405
|
+
# Development
|
|
406
|
+
pnpm test:watch # Watch mode for development
|
|
407
|
+
pnpm test:coverage # Generate coverage report
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
**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
|
+
|
|
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
|
+
## Development
|
|
440
|
+
|
|
441
|
+
### Prerequisites
|
|
442
|
+
|
|
443
|
+
- Node.js 18+
|
|
444
|
+
- pnpm (recommended) or npm
|
|
445
|
+
- FMP API key
|
|
446
|
+
|
|
447
|
+
### Setup
|
|
448
|
+
|
|
449
|
+
```bash
|
|
450
|
+
# Clone the repository
|
|
451
|
+
git clone <repository-url>
|
|
452
|
+
cd fmp-node-wrapper
|
|
453
|
+
|
|
454
|
+
# Install dependencies
|
|
455
|
+
pnpm install
|
|
456
|
+
|
|
457
|
+
# Set up environment variables
|
|
458
|
+
cp .env.example .env
|
|
459
|
+
# Add your FMP_API_KEY to .env
|
|
460
|
+
|
|
461
|
+
# Build the package
|
|
462
|
+
pnpm build
|
|
463
|
+
|
|
464
|
+
# Run tests
|
|
465
|
+
pnpm test
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
### Available Scripts
|
|
469
|
+
|
|
470
|
+
```bash
|
|
471
|
+
# Build
|
|
472
|
+
pnpm build # Build the package
|
|
473
|
+
pnpm dev # Watch mode for development
|
|
474
|
+
|
|
475
|
+
# Testing
|
|
476
|
+
pnpm test # Run all tests
|
|
477
|
+
pnpm test:watch # Watch mode
|
|
478
|
+
pnpm test:coverage # Coverage report
|
|
479
|
+
pnpm test:manual # Manual API testing
|
|
480
|
+
|
|
481
|
+
# Code Quality
|
|
482
|
+
pnpm lint # Run ESLint
|
|
483
|
+
pnpm lint:fix # Fix linting issues
|
|
484
|
+
pnpm format # Format code with Prettier
|
|
485
|
+
pnpm type-check # TypeScript type checking
|
|
486
|
+
|
|
487
|
+
# Utilities
|
|
488
|
+
pnpm clean # Clean build artifacts
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
## File Structure
|
|
492
|
+
|
|
493
|
+
```
|
|
494
|
+
src/
|
|
495
|
+
โโโ client.ts # Base HTTP client
|
|
496
|
+
โโโ fmp.ts # Main FMP class
|
|
497
|
+
โโโ index.ts # Main exports
|
|
498
|
+
โโโ shared.ts # Shared types and utilities
|
|
499
|
+
โโโ types/ # Type definitions
|
|
500
|
+
โ โโโ index.ts
|
|
501
|
+
โ โโโ common.ts # Common types
|
|
502
|
+
โ โโโ stock.ts # Stock types
|
|
503
|
+
โ โโโ financial.ts # Financial types
|
|
504
|
+
โ โโโ forex.ts # Forex types
|
|
505
|
+
โ โโโ crypto.ts # Crypto types
|
|
506
|
+
โ โโโ etf.ts # ETF types
|
|
507
|
+
โ โโโ mutual-fund.ts # Mutual fund types
|
|
508
|
+
โ โโโ bond.ts # Bond types
|
|
509
|
+
โ โโโ economic.ts # Economic types
|
|
510
|
+
โ โโโ market.ts # Market types
|
|
511
|
+
โโโ endpoints/ # API endpoint classes
|
|
512
|
+
โ โโโ index.ts
|
|
513
|
+
โ โโโ stock.ts
|
|
514
|
+
โ โโโ financial.ts
|
|
515
|
+
โ โโโ forex.ts
|
|
516
|
+
โ โโโ crypto.ts
|
|
517
|
+
โ โโโ etf.ts
|
|
518
|
+
โ โโโ mutual-fund.ts
|
|
519
|
+
โ โโโ bond.ts
|
|
520
|
+
โ โโโ economic.ts
|
|
521
|
+
โ โโโ market.ts
|
|
522
|
+
โโโ utils/ # Utility functions
|
|
523
|
+
โ โโโ index.ts
|
|
524
|
+
โ โโโ validation.ts # Input validation
|
|
525
|
+
โ โโโ formatting.ts # Data formatting
|
|
526
|
+
โ โโโ constants.ts # API constants
|
|
527
|
+
โโโ __tests__/ # Test files
|
|
528
|
+
โ โโโ client.test.ts
|
|
529
|
+
โ โโโ fmp.test.ts
|
|
530
|
+
โ โโโ integration.test.ts
|
|
531
|
+
โ โโโ endpoints/ # Endpoint tests
|
|
532
|
+
โ โ โโโ stock.test.ts
|
|
533
|
+
โ โ โโโ financial.test.ts
|
|
534
|
+
โ โ โโโ market.test.ts
|
|
535
|
+
โ โ โโโ forex.test.ts
|
|
536
|
+
โ โ โโโ economic.test.ts
|
|
537
|
+
โ โ โโโ crypto.test.ts
|
|
538
|
+
โ โ โโโ etf.test.ts
|
|
539
|
+
โ โ โโโ mutual-fund.test.ts
|
|
540
|
+
โ โ โโโ bond.test.ts
|
|
541
|
+
โ โโโ types/ # Type definition tests
|
|
542
|
+
โ โ โโโ common.test.ts
|
|
543
|
+
โ โ โโโ stock.test.ts
|
|
544
|
+
โ โ โโโ financial.test.ts
|
|
545
|
+
โ โโโ utils/ # Test utilities
|
|
546
|
+
โ โโโ formatting.test.ts
|
|
547
|
+
โ โโโ validation.test.ts
|
|
548
|
+
โ โโโ test-setup.ts
|
|
549
|
+
โโโ scripts/ # Build and utility scripts
|
|
550
|
+
โโโ test-manual.ts # Manual API testing script
|
|
551
|
+
```
|
|
552
|
+
|
|
553
|
+
## Contributing
|
|
554
|
+
|
|
555
|
+
We welcome contributions! This is a community-driven project, and your help is greatly appreciated.
|
|
556
|
+
|
|
557
|
+
### Quick Start
|
|
558
|
+
|
|
559
|
+
1. **Fork the repository**
|
|
560
|
+
2. **Create a feature branch**: `git checkout -b feature/your-feature-name`
|
|
561
|
+
3. **Make your changes** following our development guidelines
|
|
562
|
+
4. **Run quality checks**: `pnpm lint && pnpm test && pnpm type-check`
|
|
563
|
+
5. **Open a Pull Request** with a clear description of your changes
|
|
564
|
+
|
|
565
|
+
### Development Setup
|
|
566
|
+
|
|
567
|
+
```bash
|
|
568
|
+
# Install dependencies
|
|
569
|
+
pnpm install
|
|
570
|
+
|
|
571
|
+
# Set up environment
|
|
572
|
+
cp .env.example .env
|
|
573
|
+
# Add your FMP_API_KEY to .env
|
|
574
|
+
|
|
575
|
+
# Build and test
|
|
576
|
+
pnpm build
|
|
577
|
+
pnpm test
|
|
578
|
+
```
|
|
579
|
+
|
|
580
|
+
### Getting Help
|
|
581
|
+
|
|
582
|
+
- **๐ [Contributing Guide](https://github.com/e-roy/fmp-node-wrapper/blob/main/CONTRIBUTING.md)**: Detailed guidelines and development setup
|
|
583
|
+
- **๐ [Issues](https://github.com/e-roy/fmp-node-wrapper/issues)**: Report bugs or request features
|
|
584
|
+
- **๐ [Documentation](https://fmp-node-wrapper.vercel.app)**: Check the docs first
|
|
585
|
+
|
|
586
|
+
### Before Contributing
|
|
587
|
+
|
|
588
|
+
- [ ] Read the [Contributing Guide](https://github.com/e-roy/fmp-node-wrapper/blob/main/CONTRIBUTING.md)
|
|
589
|
+
- [ ] Check existing issues to avoid duplicates
|
|
590
|
+
- [ ] Test with the latest version of the library
|
|
591
|
+
- [ ] Follow our coding standards and testing requirements
|
|
592
|
+
|
|
593
|
+
## Issues and Support
|
|
594
|
+
|
|
595
|
+
### Reporting Issues
|
|
596
|
+
|
|
597
|
+
Before creating an issue, please:
|
|
598
|
+
|
|
599
|
+
1. **Check existing issues** to avoid duplicates
|
|
600
|
+
2. **Search the documentation** for solutions
|
|
601
|
+
3. **Test with the latest version** of the library
|
|
602
|
+
4. **Provide a minimal reproduction** of the problem
|
|
603
|
+
|
|
604
|
+
### Issue Guidelines
|
|
605
|
+
|
|
606
|
+
- **Be specific**: Provide clear, actionable information
|
|
607
|
+
- **Include examples**: Code examples help reproduce issues
|
|
608
|
+
- **Check versions**: Mention Node.js and library versions
|
|
609
|
+
- **Separate concerns**: Don't mix multiple issues in one report
|
|
610
|
+
|
|
611
|
+
### Support Channels
|
|
612
|
+
|
|
613
|
+
- **๐ [GitHub Issues](https://github.com/e-roy/fmp-node-wrapper/issues)**: For bug reports and feature requests
|
|
614
|
+
- **๐ง [FMP Official Support](https://site.financialmodelingprep.com/developer/docs/stable)**: For issues with the underlying FMP API service
|
|
615
|
+
|
|
616
|
+
## License
|
|
617
|
+
|
|
618
|
+
MIT License - see LICENSE file for details.
|
|
619
|
+
|
|
620
|
+
## Support
|
|
621
|
+
|
|
622
|
+
For issues, questions, or contributions, please visit the [GitHub repository](https://github.com/e-roy/fmp-node-wrapper).
|