@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.cjs
CHANGED
|
@@ -1317,7 +1317,7 @@ async function fetchWithRetry(url, options = {}, retries = 3, initialBackoff = 1
|
|
|
1317
1317
|
*/
|
|
1318
1318
|
async function validatePolygonApiKey(apiKey) {
|
|
1319
1319
|
try {
|
|
1320
|
-
const response = await fetch(`https://api.
|
|
1320
|
+
const response = await fetch(`https://api.massive.com/v1/meta/symbols?apikey=${apiKey}&limit=1`);
|
|
1321
1321
|
if (response.status === 401) {
|
|
1322
1322
|
throw new Error("Invalid or expired Polygon.io API key");
|
|
1323
1323
|
}
|
|
@@ -5189,7 +5189,7 @@ const fetchTickerInfo = async (symbol, options) => {
|
|
|
5189
5189
|
}
|
|
5190
5190
|
const apiKey = options?.apiKey || POLYGON_API_KEY;
|
|
5191
5191
|
validatePolygonApiKey$1(apiKey);
|
|
5192
|
-
const baseUrl = `https://api.
|
|
5192
|
+
const baseUrl = `https://api.massive.com/v3/reference/tickers/${encodeURIComponent(symbol)}`;
|
|
5193
5193
|
const params = new URLSearchParams({
|
|
5194
5194
|
apiKey,
|
|
5195
5195
|
});
|
|
@@ -5276,7 +5276,7 @@ const fetchLastTrade = async (symbol, options) => {
|
|
|
5276
5276
|
}
|
|
5277
5277
|
const apiKey = options?.apiKey || POLYGON_API_KEY;
|
|
5278
5278
|
validatePolygonApiKey$1(apiKey);
|
|
5279
|
-
const baseUrl = `https://api.
|
|
5279
|
+
const baseUrl = `https://api.massive.com/v2/last/trade/${encodeURIComponent(symbol)}`;
|
|
5280
5280
|
const params = new URLSearchParams({
|
|
5281
5281
|
apiKey,
|
|
5282
5282
|
});
|
|
@@ -5341,7 +5341,7 @@ const fetchPrices = async (params, options) => {
|
|
|
5341
5341
|
const apiKey = options?.apiKey || POLYGON_API_KEY;
|
|
5342
5342
|
validatePolygonApiKey$1(apiKey);
|
|
5343
5343
|
const { ticker, start, end = Date.now().valueOf(), multiplier, timespan, limit = 1000, } = params;
|
|
5344
|
-
const baseUrl = `https://api.
|
|
5344
|
+
const baseUrl = `https://api.massive.com/v2/aggs/ticker/${encodeURIComponent(ticker)}/range/${multiplier}/${timespan}/${start}/${end}`;
|
|
5345
5345
|
const urlParams = new URLSearchParams({
|
|
5346
5346
|
apiKey,
|
|
5347
5347
|
adjusted: "true",
|
|
@@ -5463,7 +5463,7 @@ const fetchGroupedDaily = async (date, options) => {
|
|
|
5463
5463
|
if (!options?.apiKey && !POLYGON_API_KEY) {
|
|
5464
5464
|
throw new Error("Polygon API key is missing");
|
|
5465
5465
|
}
|
|
5466
|
-
const baseUrl = `https://api.
|
|
5466
|
+
const baseUrl = `https://api.massive.com/v2/aggs/grouped/locale/us/market/stocks/${date}`;
|
|
5467
5467
|
const params = new URLSearchParams({
|
|
5468
5468
|
apiKey: options?.apiKey || POLYGON_API_KEY,
|
|
5469
5469
|
adjusted: options?.adjusted !== false ? "true" : "false",
|
|
@@ -5556,7 +5556,7 @@ symbol, date = new Date(), options) => {
|
|
|
5556
5556
|
throw new Error("Polygon API key is missing");
|
|
5557
5557
|
}
|
|
5558
5558
|
const formattedDate = date.toISOString().split("T")[0]; // Format as YYYY-MM-DD
|
|
5559
|
-
const baseUrl = `https://api.
|
|
5559
|
+
const baseUrl = `https://api.massive.com/v1/open-close/${encodeURIComponent(symbol)}/${formattedDate}`;
|
|
5560
5560
|
const params = new URLSearchParams({
|
|
5561
5561
|
apiKey: options?.apiKey || POLYGON_API_KEY,
|
|
5562
5562
|
adjusted: (options?.adjusted ?? true).toString(),
|
|
@@ -5606,7 +5606,7 @@ const fetchTrades = async (symbol, options) => {
|
|
|
5606
5606
|
if (!options?.apiKey && !POLYGON_API_KEY) {
|
|
5607
5607
|
throw new Error("Polygon API key is missing");
|
|
5608
5608
|
}
|
|
5609
|
-
const baseUrl = `https://api.
|
|
5609
|
+
const baseUrl = `https://api.massive.com/v3/trades/${encodeURIComponent(symbol)}`;
|
|
5610
5610
|
const params = new URLSearchParams({
|
|
5611
5611
|
apiKey: options?.apiKey || POLYGON_API_KEY,
|
|
5612
5612
|
});
|
|
@@ -5672,7 +5672,7 @@ const { ALPACA_INDICES_API_KEY } = process.env;
|
|
|
5672
5672
|
const POLYGON_INDICES_CONCURRENCY_LIMIT = 5;
|
|
5673
5673
|
const polygonIndicesLimit = pLimit(POLYGON_INDICES_CONCURRENCY_LIMIT);
|
|
5674
5674
|
// Base URL for Polygon API
|
|
5675
|
-
const POLYGON_API_BASE_URL = "https://api.
|
|
5675
|
+
const POLYGON_API_BASE_URL = "https://api.massive.com";
|
|
5676
5676
|
/**
|
|
5677
5677
|
* Validates that an API key is available
|
|
5678
5678
|
* @param {string | undefined} apiKey - Optional API key to use
|
|
@@ -15236,7 +15236,7 @@ const rateLimiters = {
|
|
|
15236
15236
|
*
|
|
15237
15237
|
* Configured for 5 requests per second (basic plan).
|
|
15238
15238
|
* Adjust if you have a different subscription tier.
|
|
15239
|
-
* See: https://
|
|
15239
|
+
* See: https://massive.com/pricing
|
|
15240
15240
|
*/
|
|
15241
15241
|
polygon: new TokenBucketRateLimiter({
|
|
15242
15242
|
maxTokens: 5,
|