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