@adaptic/utils 0.0.943 → 0.0.945
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 +34 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +34 -9
- package/dist/index.mjs.map +1 -1
- package/dist/types/alpaca/legacy/market-data.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -5526,20 +5526,45 @@ async function getLatestQuotes$1(auth, params) {
|
|
|
5526
5526
|
currency: currency || DEFAULT_CURRENCY,
|
|
5527
5527
|
};
|
|
5528
5528
|
const fetchPromises = [];
|
|
5529
|
-
// Equity quotes from stocks API
|
|
5529
|
+
// Equity quotes from stocks API (with SIP→IEX fallback for free-tier accounts)
|
|
5530
5530
|
if (equitySymbols.length > 0) {
|
|
5531
5531
|
const equityPromise = (async () => {
|
|
5532
|
+
const requestedFeed = feed || DEFAULT_FEED;
|
|
5532
5533
|
const queryParams = new URLSearchParams();
|
|
5533
5534
|
queryParams.append("symbols", equitySymbols.join(","));
|
|
5534
|
-
queryParams.append("feed",
|
|
5535
|
+
queryParams.append("feed", requestedFeed);
|
|
5535
5536
|
queryParams.append("currency", currency || DEFAULT_CURRENCY);
|
|
5536
|
-
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
5541
|
-
|
|
5542
|
-
|
|
5537
|
+
try {
|
|
5538
|
+
const response = await makeRequest(auth, {
|
|
5539
|
+
endpoint: "/v2/stocks/quotes/latest",
|
|
5540
|
+
method: "GET",
|
|
5541
|
+
queryString: `?${queryParams.toString()}`,
|
|
5542
|
+
apiBaseUrl: MARKET_DATA_API.STOCKS.replace("/v2", ""),
|
|
5543
|
+
});
|
|
5544
|
+
Object.assign(results.quotes, response.quotes);
|
|
5545
|
+
}
|
|
5546
|
+
catch (sipError) {
|
|
5547
|
+
// Fall back to IEX feed if SIP is unavailable (free-tier accounts)
|
|
5548
|
+
const isSipPermissionError = sipError instanceof Error &&
|
|
5549
|
+
sipError.message.includes("subscription does not permit");
|
|
5550
|
+
if (isSipPermissionError && requestedFeed === "sip") {
|
|
5551
|
+
getLogger().warn("SIP data unavailable, falling back to IEX feed for equity quotes", { type: "warn" });
|
|
5552
|
+
const iexParams = new URLSearchParams();
|
|
5553
|
+
iexParams.append("symbols", equitySymbols.join(","));
|
|
5554
|
+
iexParams.append("feed", "iex");
|
|
5555
|
+
iexParams.append("currency", currency || DEFAULT_CURRENCY);
|
|
5556
|
+
const response = await makeRequest(auth, {
|
|
5557
|
+
endpoint: "/v2/stocks/quotes/latest",
|
|
5558
|
+
method: "GET",
|
|
5559
|
+
queryString: `?${iexParams.toString()}`,
|
|
5560
|
+
apiBaseUrl: MARKET_DATA_API.STOCKS.replace("/v2", ""),
|
|
5561
|
+
});
|
|
5562
|
+
Object.assign(results.quotes, response.quotes);
|
|
5563
|
+
}
|
|
5564
|
+
else {
|
|
5565
|
+
throw sipError;
|
|
5566
|
+
}
|
|
5567
|
+
}
|
|
5543
5568
|
})();
|
|
5544
5569
|
fetchPromises.push(equityPromise);
|
|
5545
5570
|
}
|