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}")

------------------



Popular posts from this blog

SAP CPI : camle expression in sap cpi , cm, router, filter and groovy script. format

SAP CPI camel conditions and xpath conditions

oauth call to cpi integraiton suite from sap apim