small cap mf , index buy or sell decision?
# 🧠 SMALLCAP INDEX FUND - BUY / REDEEM STRATEGY
# Target Fund: Nippon India Nifty Smallcap 250 Index Fund - Direct Growth
# INPUTS (manual)
index_pct = -2.7 # % change in Nifty Smallcap 250 today till 2PM
smallcap_pe = 19.2 # Current PE of Nifty Smallcap 250
is_short_term = True # If units being redeemed are < 1 year
total_capital = 10_00_000
dip_component = 5_00_000 # capital reserved for dips
buy_pct = 0.0
redeem_pct = 0.0
buy_reason = ""
redeem_reason = ""
# 📉 BUY LOGIC
if index_pct <= -2.5:
if smallcap_pe < 14:
buy_pct = 0.4
buy_reason = "📉 Big dip + undervalued smallcaps"
elif smallcap_pe <= 18:
buy_pct = 0.3
buy_reason = "📉 Big dip + fair valuation"
else:
buy_pct = 0.2
buy_reason = "📉 Big dip but overvalued"
elif -2.5 < index_pct <= -1.0:
if smallcap_pe < 14:
buy_pct = 0.2
buy_reason = "🔻 Mild dip + undervalued"
elif smallcap_pe <= 18:
buy_pct = 0.15
buy_reason = "🔻 Mild dip + fair valuation"
else:
buy_pct = 0.1
buy_reason = "🔻 Mild dip but high PE"
# 📈 REDEEM LOGIC
if index_pct >= 3.0:
if smallcap_pe > 18:
redeem_pct = 0.2
redeem_reason = "📈 Big rally + high PE → take profits"
elif smallcap_pe >= 14:
redeem_pct = 0.15
redeem_reason = "📈 Big rally + fair PE → partial profit"
else:
redeem_pct = 0.10
redeem_reason = "📈 Rally but still undervalued → light redeem"
elif 1.5 <= index_pct < 3.0:
if smallcap_pe > 18:
redeem_pct = 0.4
redeem_reason = "📈 Huge rally + overvaluation"
elif smallcap_pe >= 14:
redeem_pct = 0.3
redeem_reason = "📈 Huge rally + fair PE"
else:
redeem_pct = 0.2
redeem_reason = "📈 Huge rally but PE ok"
# 🧾 Profit & Tax Estimation
estimated_profit = 1.8 * 1e5
tax = 0
if is_short_term:
tax = 0.15 * estimated_profit # STCG
else:
gain_above_exempt = max(0, estimated_profit - 1e5)
tax = 0.10 * gain_above_exempt # LTCG
buy_amount = int(buy_pct * dip_component)
redeem_amount = int(redeem_pct * dip_component)
net_redeem = int(redeem_amount - tax)
# 📤 OUTPUT
print(f"🔢 Index % Change (till 2PM): {index_pct}%")
print(f"📊 Nifty Smallcap 250 PE: {smallcap_pe}")
print("\n💰 Buy Decision:")
print(buy_reason)
print(f"✅ Invest ₹{buy_amount} from ₹{dip_component}")
print("\n💸 Redeem Decision:")
print(redeem_reason)
print(f"➡️ Redeem ₹{redeem_amount}")
print(f"💰 Estimated Profit: ₹{int(estimated_profit)}")
print(f"🧾 Tax: ₹{int(tax)} ({'STCG' if is_short_term else 'LTCG'})")
print(f"✅ Net Redeemable: ₹{net_redeem}")
------------------