@adaptic/utils 0.0.906 → 0.0.907
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/dist/index.cjs +9 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +9 -9
- package/dist/index.mjs.map +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/rate-limiter.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1315,7 +1315,7 @@ async function fetchWithRetry(url, options = {}, retries = 3, initialBackoff = 1
|
|
|
1315
1315
|
*/
|
|
1316
1316
|
async function validatePolygonApiKey(apiKey) {
|
|
1317
1317
|
try {
|
|
1318
|
-
const response = await fetch(`https://api.
|
|
1318
|
+
const response = await fetch(`https://api.massive.com/v1/meta/symbols?apikey=${apiKey}&limit=1`);
|
|
1319
1319
|
if (response.status === 401) {
|
|
1320
1320
|
throw new Error("Invalid or expired Polygon.io API key");
|
|
1321
1321
|
}
|
|
@@ -5187,7 +5187,7 @@ const fetchTickerInfo = async (symbol, options) => {
|
|
|
5187
5187
|
}
|
|
5188
5188
|
const apiKey = options?.apiKey || POLYGON_API_KEY;
|
|
5189
5189
|
validatePolygonApiKey$1(apiKey);
|
|
5190
|
-
const baseUrl = `https://api.
|
|
5190
|
+
const baseUrl = `https://api.massive.com/v3/reference/tickers/${encodeURIComponent(symbol)}`;
|
|
5191
5191
|
const params = new URLSearchParams({
|
|
5192
5192
|
apiKey,
|
|
5193
5193
|
});
|
|
@@ -5274,7 +5274,7 @@ const fetchLastTrade = async (symbol, options) => {
|
|
|
5274
5274
|
}
|
|
5275
5275
|
const apiKey = options?.apiKey || POLYGON_API_KEY;
|
|
5276
5276
|
validatePolygonApiKey$1(apiKey);
|
|
5277
|
-
const baseUrl = `https://api.
|
|
5277
|
+
const baseUrl = `https://api.massive.com/v2/last/trade/${encodeURIComponent(symbol)}`;
|
|
5278
5278
|
const params = new URLSearchParams({
|
|
5279
5279
|
apiKey,
|
|
5280
5280
|
});
|
|
@@ -5339,7 +5339,7 @@ const fetchPrices = async (params, options) => {
|
|
|
5339
5339
|
const apiKey = options?.apiKey || POLYGON_API_KEY;
|
|
5340
5340
|
validatePolygonApiKey$1(apiKey);
|
|
5341
5341
|
const { ticker, start, end = Date.now().valueOf(), multiplier, timespan, limit = 1000, } = params;
|
|
5342
|
-
const baseUrl = `https://api.
|
|
5342
|
+
const baseUrl = `https://api.massive.com/v2/aggs/ticker/${encodeURIComponent(ticker)}/range/${multiplier}/${timespan}/${start}/${end}`;
|
|
5343
5343
|
const urlParams = new URLSearchParams({
|
|
5344
5344
|
apiKey,
|
|
5345
5345
|
adjusted: "true",
|
|
@@ -5461,7 +5461,7 @@ const fetchGroupedDaily = async (date, options) => {
|
|
|
5461
5461
|
if (!options?.apiKey && !POLYGON_API_KEY) {
|
|
5462
5462
|
throw new Error("Polygon API key is missing");
|
|
5463
5463
|
}
|
|
5464
|
-
const baseUrl = `https://api.
|
|
5464
|
+
const baseUrl = `https://api.massive.com/v2/aggs/grouped/locale/us/market/stocks/${date}`;
|
|
5465
5465
|
const params = new URLSearchParams({
|
|
5466
5466
|
apiKey: options?.apiKey || POLYGON_API_KEY,
|
|
5467
5467
|
adjusted: options?.adjusted !== false ? "true" : "false",
|
|
@@ -5554,7 +5554,7 @@ symbol, date = new Date(), options) => {
|
|
|
5554
5554
|
throw new Error("Polygon API key is missing");
|
|
5555
5555
|
}
|
|
5556
5556
|
const formattedDate = date.toISOString().split("T")[0]; // Format as YYYY-MM-DD
|
|
5557
|
-
const baseUrl = `https://api.
|
|
5557
|
+
const baseUrl = `https://api.massive.com/v1/open-close/${encodeURIComponent(symbol)}/${formattedDate}`;
|
|
5558
5558
|
const params = new URLSearchParams({
|
|
5559
5559
|
apiKey: options?.apiKey || POLYGON_API_KEY,
|
|
5560
5560
|
adjusted: (options?.adjusted ?? true).toString(),
|
|
@@ -5604,7 +5604,7 @@ const fetchTrades = async (symbol, options) => {
|
|
|
5604
5604
|
if (!options?.apiKey && !POLYGON_API_KEY) {
|
|
5605
5605
|
throw new Error("Polygon API key is missing");
|
|
5606
5606
|
}
|
|
5607
|
-
const baseUrl = `https://api.
|
|
5607
|
+
const baseUrl = `https://api.massive.com/v3/trades/${encodeURIComponent(symbol)}`;
|
|
5608
5608
|
const params = new URLSearchParams({
|
|
5609
5609
|
apiKey: options?.apiKey || POLYGON_API_KEY,
|
|
5610
5610
|
});
|
|
@@ -5670,7 +5670,7 @@ const { ALPACA_INDICES_API_KEY } = process.env;
|
|
|
5670
5670
|
const POLYGON_INDICES_CONCURRENCY_LIMIT = 5;
|
|
5671
5671
|
const polygonIndicesLimit = pLimit(POLYGON_INDICES_CONCURRENCY_LIMIT);
|
|
5672
5672
|
// Base URL for Polygon API
|
|
5673
|
-
const POLYGON_API_BASE_URL = "https://api.
|
|
5673
|
+
const POLYGON_API_BASE_URL = "https://api.massive.com";
|
|
5674
5674
|
/**
|
|
5675
5675
|
* Validates that an API key is available
|
|
5676
5676
|
* @param {string | undefined} apiKey - Optional API key to use
|
|
@@ -15234,7 +15234,7 @@ const rateLimiters = {
|
|
|
15234
15234
|
*
|
|
15235
15235
|
* Configured for 5 requests per second (basic plan).
|
|
15236
15236
|
* Adjust if you have a different subscription tier.
|
|
15237
|
-
* See: https://
|
|
15237
|
+
* See: https://massive.com/pricing
|
|
15238
15238
|
*/
|
|
15239
15239
|
polygon: new TokenBucketRateLimiter({
|
|
15240
15240
|
maxTokens: 5,
|