reedem or buy, stcg after 2pm, knwing % raise nifty50

 # Inputs

nifty_pct = 3.3       # Example: 2.3% rise till 2PM
nifty_pe = 24.0       # High valuation
total_capital = 5_00_000

sip_component = 3_00_000
dip_component = 5_00_000
liquid_component = 2_00_000

# Assumed values for logic
buy_pct = 0.0
redeem_pct = 0.0
buy_reason = ""
redeem_reason = ""

# Assumed gains and holding info
# You should track how long your investments are held
estimated_redeem_profit = 1.5 * 1e5  # ₹1.5L profit
is_short_term = True                 # True = STCG

# Buy logic
if nifty_pct <= -1.0:
    if nifty_pe < 18:
        buy_pct = 0.5
        buy_reason = "šŸ“‰ Deep dip + undervalued"
    elif nifty_pe <= 23:
        buy_pct = 0.3
        buy_reason = "šŸ“‰ Dip + fair valuation"
    else:
        buy_pct = 0.1
        buy_reason = "šŸ“‰ Dip + overvalued market"

# Redeem logic
if nifty_pct >= 2.0 and nifty_pe > 23:
    redeem_pct = 0.3
    redeem_reason = "šŸ“ˆ Big rally + high PE → book profits"

# Calculate amounts
buy_amount = int(buy_pct * dip_component)
redeem_amount = int(redeem_pct * dip_component)

# Tax logic
if is_short_term:
    tax = 0.15 * estimated_redeem_profit  # 15% STCG
else:
    gain_above_exempt = max(0, estimated_redeem_profit - 1e5)
    tax = 0.10 * gain_above_exempt        # 10% LTCG if applicable

# Final net redemption
net_redeem = redeem_amount - int(tax)

# Output
print("šŸ“ˆ Nifty Today:", nifty_pct, "%")
print("šŸ“Š Nifty PE:", nifty_pe)
print("\nšŸ’° Buy Recommendation:")
print(f"→ {buy_reason}, Buy ₹{buy_amount} from dip reserve.")

print("\nšŸ’ø Redeem Recommendation:")
print(f"→ {redeem_reason}, Redeem ₹{redeem_amount}")
print(f"šŸ¦ Estimated Gain: ₹{int(estimated_redeem_profit)}")
print(f"šŸ’ø Tax Applied: ₹{int(tax)} ({'STCG' if is_short_term else 'LTCG'})")
print(f"✅ Net Amount 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