Skip to content

Commit f8c4970

Browse files
authored
feat: new endpoints and updated README (#4)
2 parents f6c071b + 13562a6 commit f8c4970

6 files changed

Lines changed: 818 additions & 291 deletions

File tree

.prettierrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"semi": true,
33
"singleQuote": true,
4-
"printWidth": 140,
4+
"printWidth": 150,
55
"tabWidth": 4,
66
"useTabs": false
77
}

README.md

Lines changed: 139 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# FMPocket
22

3-
**FMPocket** 💶 is a lightweight 🪶 universal client for the Financial Modeling Prep (FMP) API 🌎, built with Typescript support and works seamlessly across Node, Deno, and Bun. Gets your financial data perfectly formatted ⭐️.
3+
**FMPocket** 💶 is a lightweight 🪶 (85.4 kB) universal client for the Financial Modeling Prep (FMP) API 🌎, built with Typescript support and works seamlessly across Node, Deno, and Bun. Gets your financial data perfectly formatted ⭐️.
44

55
[Report a bug](https://github.com/l0uisgrange/fmpocket/issues)[Forum](https://github.com/l0uisgrange/fmpocket/discussions/categories/q-a)
66

@@ -17,12 +17,12 @@ deno install npm:fmpocket
1717

1818
## Quick usage
1919

20-
```typescript
20+
```ts
2121
import { FMPocket } from 'fmpocket';
2222

23-
const fmpocket = FMPocket({ key: process.env.API_KEY });
23+
const fmpocket = FMPocket({ key: process.env.API_KEY! });
2424

25-
let [data] = fmpocket.quote('AAPL');
25+
let [data] = await fmpocket.quote('AAPL');
2626
console.log(data.volume);
2727
```
2828

@@ -39,30 +39,141 @@ The `FMPocket` constructor supports the following options.
3939
| `debug` | Logs the URL before the request | `false` |
4040
| `timeout` | Requests timeout in milliseconds | `null` |
4141

42-
## Supported endpoints
42+
## Endpoints
4343

4444
This is the list of currently supported endpoints. If yours is not in this list, please [open a request](https://github.com/l0uisgrange/fmpocket/issues).
4545

46-
| Method | API endpoint |
47-
| :---------------------------------------------- | :----------------------------- |
48-
| `quote(symbol)` | `/quote` |
49-
| `shortQuote(symbol)` | `/quote-short` |
50-
| `batchQuote(symbols)` | `/batch-quote` |
51-
| `batchShortQuote(symbols)` | `/batch-quote-short` |
52-
| `lightChart({ symbol, from, to })` | `/historical-price-eod/light` |
53-
| `fullChart({ symbol, from, to })` | `/historical-price-eod/full` |
54-
| `intradayChart({ symbol, from, to, interval })` | `/historical-chart/{INTERVAL}` |
55-
| `search({ query, by, exchange, limit })` | `/search-{BY}` |
56-
| `companyProfile({ cik, symbol })` | `/profile` |
57-
| `employeeCount(symbol)` | `/employee-count` |
58-
| `employeeHistoryCount(symbol)` | `/historical-employee-count` |
59-
| `marketCap(symbol)` | `/market-capitalization` |
60-
| `batchMarketCap(symbols)` | `/market-capitalization-batch` |
61-
| `listStock()` | `/index-list` |
62-
| `listCrypto()` | `/cryptocurrency-list` |
63-
| `listForex()` | `/forex-list` |
64-
| `listCommodities()` | `/commodities-list` |
65-
| `marketHours(exchange)` | `/exchange-market-hours` |
66-
| `holidays(exchange)` | `/holidays-by-exchange` |
67-
| `keyMetrics({ symbol, limit, period })` | `/key-metrics` |
68-
| `ratios({ symbol, limit, period })` | `/ratios` |
46+
### Quote
47+
48+
```ts
49+
// Single quote
50+
let [data] = await fmpocket.quote('AAPL');
51+
// Single short quote
52+
let [data] = await fmpocket.shortQuote('BTCUSD');
53+
// Aftermarket trade
54+
let [data] = await fmpocket.aftermarketTrade('AAPL');
55+
// Aftermarket quote
56+
let [data] = await fmpocket.aftermarketQuote('AAPL');
57+
// Price change
58+
let [data] = await fmpocket.priceChange('AAPL');
59+
// Batch quote
60+
let data = await fmpocket.batchQuote(['AAPL', 'EURUSD', 'BTCUSD']);
61+
// Batch short quote
62+
let data = await fmpocket.batchShortQuote(['AAPL', 'EURUSD', 'BTCUSD']);
63+
// Batch aftermarket trade
64+
let data = await fmpocket.batchAftermarketTrade(['AAPL', 'MSFT']);
65+
// Batch aftermarket quote
66+
let data = await fmpocket.batchAftermarketQuote(['AAPL', 'MSFT']);
67+
```
68+
69+
### Historical price
70+
71+
```ts
72+
// EOD light chart
73+
let data = await fmpocket.lightChart({ symbol: 'AAPL', from: '2025-06-13', to: '2025-10-22' });
74+
// EOD non adjusted chart
75+
let data = await fmpocket.unadjustedChart({ symbol: 'AAPL', from: '2025-06-13', to: '2025-10-22' });
76+
// EOD dividend adjusted chart
77+
let data = await fmpocket.dividendChart({ symbol: 'AAPL', from: '2025-06-13', to: '2025-10-22' });
78+
// EOD full chart
79+
let data = await fmpocket.fullChart({ symbol: 'AAPL', from: '2025-06-13', to: '2025-10-22' });
80+
// Intraday chart
81+
let data = await fmpocket.intradayChart({ symbol: 'AAPL', from: '2025-10-10', to: '2025-10-22', interval: '1hour' });
82+
```
83+
84+
### Search
85+
86+
```ts
87+
// Search by name
88+
let data = await fmpocket.search({ query: 'AAPL' });
89+
// Search by symbol (exchange and limit are optional)
90+
let data = await fmpocket.search({ query: 'AP', by: 'symbol', exchange: 'NASDAQ', limit: 10 });
91+
```
92+
93+
### Company information
94+
95+
```ts
96+
// Company profile (by symbol)
97+
let [data] = await fmpocket.companyProfile({ symbol: 'AAPL' });
98+
// Company profile (by CIK)
99+
let [data] = await fmpocket.companyProfile({ cik: '0000320193' });
100+
// Employee count
101+
let [data] = await fmpocket.employeeCount('AAPL');
102+
// Historical employee count
103+
let [data] = await fmpocket.employeeHistoryCount('AAPL');
104+
// Market capitalization
105+
let [data] = await fmpocket.marketCap('AAPL');
106+
// Batch market capitalization
107+
let data = await fmpocket.batchMarketCap('AAPL');
108+
```
109+
110+
### Financial statements
111+
112+
```ts
113+
// Income statement
114+
let [data] = await fmpocket.income({ symbol: 'POW.TO', period: 'Q3' });
115+
// Balance sheet statement
116+
let [data] = await fmpocket.balanceSheet({ symbol: 'POW.TO', period: 'Q3' });
117+
// Cash flow statement
118+
let [data] = await fmpocket.cashFlow({ symbol: 'POW.TO', period: 'Q3' });
119+
// Latest statements
120+
let data = await fmpocket.latest({ page: 2, limit: 10 });
121+
// Key metrics
122+
let [data] = await fmpocket.keyMetrics({ symbol: 'POW.TO', period: 'Q3' });
123+
// Financial ratios
124+
let [data] = await fmpocket.ratios({ symbol: 'POW.TO', period: 'Q3' });
125+
```
126+
127+
### Technical indicators
128+
129+
```ts
130+
// Simple moving average
131+
let data = await fmpocket.sma({ symbol: 'AAPL', periodLength: 20, timeframe: '1min' });
132+
// Exponential moving average
133+
let data = await fmpocket.ema({ symbol: 'AAPL', periodLength: 20, timeframe: '1min' });
134+
// Weighted moving average
135+
let data = await fmpocket.wma({ symbol: 'AAPL', periodLength: 20, timeframe: '1min' });
136+
// Double exponential moving average
137+
let data = await fmpocket.dema({ symbol: 'AAPL', periodLength: 20, timeframe: '1min' });
138+
// Triple exponential moving average
139+
let data = await fmpocket.tema({ symbol: 'AAPL', periodLength: 20, timeframe: '1min' });
140+
// Relative strength index
141+
let data = await fmpocket.rsi({ symbol: 'AAPL', periodLength: 20, timeframe: '1min' });
142+
// Standard deviation
143+
let data = await fmpocket.std({ symbol: 'AAPL', periodLength: 20, timeframe: '1min' });
144+
// Williams
145+
let data = await fmpocket.williams({ symbol: 'AAPL', periodLength: 20, timeframe: '1min' });
146+
// Average directional index
147+
let data = await fmpocket.adx({ symbol: 'AAPL', periodLength: 20, timeframe: '1min' });
148+
```
149+
150+
### List
151+
152+
```ts
153+
// List stocks
154+
let data = await fmpocket.listStock();
155+
// List cryptocurrencies
156+
let data = await fmpocket.listCrypto();
157+
// List forex
158+
let data = await fmpocket.listForex();
159+
// List commodities
160+
let data = await fmpocket.listCommodities();
161+
```
162+
163+
### Market hours
164+
165+
```ts
166+
// Market hours
167+
let [data] = await fmpocket.marketHours('NASDAQ');
168+
// Holidays
169+
let data = await fmpocket.holidays('NASDAQ');
170+
```
171+
172+
### Any
173+
174+
```ts
175+
// Any unsupported endpoint
176+
let [data] = await fmpocket.any('/unsupported-endpoint', null, { foo: 'bar' });
177+
```
178+
179+
This method allows you to use `fmpocket` even for unsupported endpoints if an API update occurs. You can also provide a schema to validate the output.

0 commit comments

Comments
 (0)