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