Index: backend/src/main/java/com/tradingmk/backend/controller/TradeRequestController.java
===================================================================
--- backend/src/main/java/com/tradingmk/backend/controller/TradeRequestController.java	(revision a5f92e4507819302a6538fb14e02627e197baff3)
+++ backend/src/main/java/com/tradingmk/backend/controller/TradeRequestController.java	(revision a2a854721f5c2f9d12fdf5d5fbb20d3046ccc322)
@@ -105,6 +105,14 @@
             }
 
+
             holding.setQuantity(holding.getQuantity() - tr.getQuantity());
-            portfolioHoldingRepository.save(holding);
+
+
+            if (holding.getQuantity() <= 0) {
+                portfolioHoldingRepository.delete(holding);
+            } else {
+                portfolioHoldingRepository.save(holding);
+            }
+
 
             BigDecimal totalGain = BigDecimal.valueOf(tr.getQuantity() * tr.getPricePerUnit());
Index: frontend/src/pages/Portfolio/Portfolio.jsx
===================================================================
--- frontend/src/pages/Portfolio/Portfolio.jsx	(revision a5f92e4507819302a6538fb14e02627e197baff3)
+++ frontend/src/pages/Portfolio/Portfolio.jsx	(revision a2a854721f5c2f9d12fdf5d5fbb20d3046ccc322)
@@ -177,5 +177,4 @@
 
         if (isDemo) {
-
             const updatedPortfolio = { ...portfolio };
             const holding = updatedPortfolio.holdings.find(h => h.stockSymbol === symbol);
@@ -184,5 +183,4 @@
                 holding.quantity -= quantity;
                 updatedPortfolio.balance += quantity * (currentPrices[symbol] || 0);
-
 
                 if (holding.quantity <= 0) {
@@ -205,5 +203,5 @@
 
         try {
-            const response = await fetch("http://localhost:8080/api/portfolio/sell", {
+            const response = await fetch("http://localhost:8080/api/trades/request", {
                 method: "POST",
                 headers: {
@@ -215,5 +213,6 @@
                     stockSymbol: symbol,
                     quantity: quantity,
-                    pricePerUnit: currentPrice
+                    pricePerUnit: currentPrices[symbol] || 0,
+                    type: "SELL"
                 })
             });
@@ -222,10 +221,9 @@
                 const text = await response.text();
                 console.error("Error:", text);
-                alert("Failed to sell stock: " + text);
+                alert("Failed to request sell: " + text);
                 return;
             }
 
-
-            alert(`Sold ${quantity} shares of ${symbol}`);
+            alert(`Sell request sent for ${quantity} shares of ${symbol}. Waiting for approval.`);
         } catch (err) {
             console.error("Fetch error:", err);
@@ -233,5 +231,4 @@
         }
     };
-
     return (
         <div className=" max-w-7xl mx-auto space-y-8 pt-20  mb-4">
