@adaptic/utils 0.0.953 → 0.0.954

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.mjs CHANGED
@@ -5832,10 +5832,12 @@ async function closePosition$1(auth, symbolOrAssetId, params) {
5832
5832
  account: auth.adapticAccountId || "direct",
5833
5833
  symbol: normalizedSymbol,
5834
5834
  });
5835
- // For crypto symbols, query orders using both the normalized and original
5836
- // formats since Alpaca may store orders under "SOL/USD" while we normalized to "SOLUSD"
5835
+ // Alpaca stores crypto orders under "SOL/USD" (slash format) but we may
5836
+ // receive "SOL-USD" (hyphen) or "SOLUSD" (concatenated). Query all three
5837
+ // formats so getOrders returns matching open orders for cancellation.
5838
+ const slashSymbol = normalizedSymbol.replace(/^([A-Z]+)(USD[TC]?)$/i, "$1/$2");
5837
5839
  const orderSymbols = isCryptoSymbol(symbolOrAssetId)
5838
- ? [normalizedSymbol, symbolOrAssetId]
5840
+ ? [...new Set([normalizedSymbol, symbolOrAssetId, slashSymbol])]
5839
5841
  : [normalizedSymbol];
5840
5842
  const openOrders = await getOrders$1(auth, {
5841
5843
  status: "open",