@adaptic/utils 0.0.945 → 0.0.947
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 +6 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +6 -15
- package/dist/index.mjs.map +1 -1
- package/dist/types/alpaca/legacy/positions.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -5839,14 +5839,9 @@ async function closePosition$1(auth, symbolOrAssetId, params) {
|
|
|
5839
5839
|
if (!position) {
|
|
5840
5840
|
throw new Error(`Position not found for ${symbolOrAssetId}`);
|
|
5841
5841
|
}
|
|
5842
|
-
//
|
|
5843
|
-
|
|
5844
|
-
|
|
5845
|
-
alpacaApiKey: process.env.ALPACA_API_KEY,
|
|
5846
|
-
alpacaApiSecret: process.env.ALPACA_API_SECRET || process.env.ALPACA_SECRET_KEY,
|
|
5847
|
-
};
|
|
5848
|
-
const alpacaAuth = alpacaAuthData;
|
|
5849
|
-
const quotesResponse = await getLatestQuotes$1(alpacaAuth, {
|
|
5842
|
+
// Use the passed auth for quote fetching so multi-account setups
|
|
5843
|
+
// use the correct credentials per account
|
|
5844
|
+
const quotesResponse = await getLatestQuotes$1(auth, {
|
|
5850
5845
|
symbols: [symbolOrAssetId],
|
|
5851
5846
|
});
|
|
5852
5847
|
const quote = quotesResponse.quotes[symbolOrAssetId];
|
|
@@ -6114,14 +6109,10 @@ async function closeAllPositionsAfterHours$1(auth, params = { cancel_orders: tru
|
|
|
6114
6109
|
if (equityPositions.length === 0) {
|
|
6115
6110
|
return;
|
|
6116
6111
|
}
|
|
6117
|
-
|
|
6118
|
-
|
|
6119
|
-
alpacaApiKey: process.env.ALPACA_API_KEY,
|
|
6120
|
-
alpacaApiSecret: process.env.ALPACA_SECRET_KEY,
|
|
6121
|
-
};
|
|
6122
|
-
const alpacaAuth = alpacaAuthObj;
|
|
6112
|
+
// Use the passed auth for quote fetching (not hardcoded env vars)
|
|
6113
|
+
// so multi-account setups use the correct credentials per account
|
|
6123
6114
|
const symbols = equityPositions.map((position) => position.symbol);
|
|
6124
|
-
const quotesResponse = await getLatestQuotes$1(
|
|
6115
|
+
const quotesResponse = await getLatestQuotes$1(auth, { symbols });
|
|
6125
6116
|
for (const position of equityPositions) {
|
|
6126
6117
|
const quote = quotesResponse.quotes[position.symbol];
|
|
6127
6118
|
if (!quote) {
|