@massive.com/client-js 9.0.0 → 10.0.0
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 +1 -1
- package/README.md +82 -25
- package/dist/main.d.ts +12303 -3780
- package/dist/main.js +1 -1
- package/massive.com-client-js-10.0.0.tgz +0 -0
- package/package.json +5 -2
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -27,42 +27,93 @@ const rest = restClient(process.env.POLY_API_KEY);
|
|
|
27
27
|
|
|
28
28
|
## Using the client
|
|
29
29
|
|
|
30
|
-
After creating the client, making calls to the Massive API is easy. For example, here's how to get aggregates (bars):
|
|
30
|
+
After creating the client, making calls to the Massive API is easy. For example, here's a complete example on how to get aggregates (bars):
|
|
31
31
|
|
|
32
32
|
```javascript
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
import { restClient } from '@massive.com/client-js';
|
|
34
|
+
|
|
35
|
+
const apiKey = "XXXX";
|
|
36
|
+
const rest = restClient(apiKey, 'https://api.massive.com');
|
|
37
|
+
|
|
38
|
+
async function example_getStocksAggregates() {
|
|
39
|
+
try {
|
|
40
|
+
const response = await rest.getStocksAggregates(
|
|
41
|
+
{
|
|
42
|
+
stocksTicker: "AAPL",
|
|
43
|
+
multiplier: "1",
|
|
44
|
+
timespan: "day",
|
|
45
|
+
from: "2025-11-01",
|
|
46
|
+
to: "2025-11-30",
|
|
47
|
+
adjusted: "true",
|
|
48
|
+
sort: "asc",
|
|
49
|
+
limit: "120"
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
console.log('Response:', response);
|
|
53
|
+
} catch (e) {
|
|
54
|
+
console.error('An error happened:', e);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
example_getStocksAggregates();
|
|
38
59
|
```
|
|
39
60
|
|
|
40
61
|
Or, maybe you want to get the last trades or quotes for a ticker:
|
|
41
62
|
|
|
42
63
|
```javascript
|
|
43
|
-
|
|
44
|
-
rest.getLastStocksTrade("AAPL").then((response) => {
|
|
45
|
-
console.log(response);
|
|
46
|
-
}).catch(e => {
|
|
47
|
-
console.error('An error happened:', e);
|
|
48
|
-
});
|
|
64
|
+
import { restClient } from '@massive.com/client-js';
|
|
49
65
|
|
|
50
|
-
|
|
51
|
-
rest
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
66
|
+
const apiKey = "XXXX";
|
|
67
|
+
const rest = restClient(apiKey, 'https://api.massive.com');
|
|
68
|
+
|
|
69
|
+
async function example_getLastStocksTrade() {
|
|
70
|
+
try {
|
|
71
|
+
const response = await rest.getLastStocksTrade("AAPL");
|
|
72
|
+
console.log('Response:', response);
|
|
73
|
+
} catch (e) {
|
|
74
|
+
console.error('An error happened:', e);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
example_getLastStocksTrade();
|
|
56
79
|
```
|
|
57
80
|
|
|
58
|
-
|
|
81
|
+
```javascript
|
|
82
|
+
import { restClient } from '@massive.com/client-js';
|
|
83
|
+
|
|
84
|
+
const apiKey = "XXXXX";
|
|
85
|
+
const rest = restClient(apiKey, 'https://api.massive.com');
|
|
86
|
+
|
|
87
|
+
async function example_getLastStocksQuote() {
|
|
88
|
+
try {
|
|
89
|
+
const response = await rest.getLastStocksQuote("AAPL");
|
|
90
|
+
console.log('Response:', response);
|
|
91
|
+
} catch (e) {
|
|
92
|
+
console.error('An error happened:', e);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
example_getLastStocksQuote();
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Finally, maybe you want a snapshot of a ticker:
|
|
59
100
|
|
|
60
101
|
```javascript
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
102
|
+
import { restClient } from '@massive.com/client-js';
|
|
103
|
+
|
|
104
|
+
const apiKey = "XXXXX";
|
|
105
|
+
const rest = restClient(apiKey, 'https://api.massive.com');
|
|
106
|
+
|
|
107
|
+
async function example_getStocksSnapshotTicker() {
|
|
108
|
+
try {
|
|
109
|
+
const response = await rest.getStocksSnapshotTicker("AAPL");
|
|
110
|
+
console.log('Response:', response);
|
|
111
|
+
} catch (e) {
|
|
112
|
+
console.error('An error happened:', e);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
example_getStocksSnapshotTicker();
|
|
66
117
|
```
|
|
67
118
|
|
|
68
119
|
See [full examples](./examples/rest/) for more details on how to use this client effectively.
|
|
@@ -79,7 +130,13 @@ const globalFetchOptions = {
|
|
|
79
130
|
};
|
|
80
131
|
const rest = restClient(process.env.POLY_API_KEY, "https://api.massive.com", globalFetchOptions);
|
|
81
132
|
|
|
82
|
-
rest.getStocksAggregates(
|
|
133
|
+
rest.getStocksAggregates({
|
|
134
|
+
stocksTicker: "AAPL",
|
|
135
|
+
multiplier: "1",
|
|
136
|
+
timespan: "day",
|
|
137
|
+
from: "2025-11-01",
|
|
138
|
+
to: "2025-11-30"
|
|
139
|
+
}).then((response) => {
|
|
83
140
|
const data = response.data; // convert axios-wrapped response
|
|
84
141
|
const resultCount = data.resultsCount;
|
|
85
142
|
console.log("Result count:", resultCount);
|