Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pandas as pd
- import matplotlib.pyplot as plt
- # Constants
- monthly_sip = 100000 # Monthly SIP amount in INR
- inflation_rate = 0.15 # 15% annual inflation
- tax_rate = 0.125 # LTCG Tax rate (12.5%)
- rate_of_return_annual = 0.135 # 13.5% annual return
- # Calculating monthly rate of return
- rate_of_return_monthly = rate_of_return_annual / 12
- # Function to calculate SIP corpus at the end of each year
- def calculate_sip_corpus(P, i, n):
- """Calculate Future Value of SIP"""
- return P * (((1 + i) ** n - 1) / i) * (1 + i)
- # Function to calculate inflated price of the item
- def calculate_inflated_price(initial_price, inflation_rate, years):
- """Calculate the inflated price of the item"""
- return initial_price * ((1 + inflation_rate) ** years)
- # Function to calculate taxable profits and LTCG tax
- def calculate_taxable_profits_and_tax(total_sip_contributions, corpus, tax_rate):
- """Calculate taxable profits and LTCG tax"""
- profits = corpus - total_sip_contributions
- tax = profits * tax_rate
- post_tax_profits = profits - tax
- return profits, tax, post_tax_profits
- # Initial values
- initial_item_price = 15000000 # Initial item price in INR (1.5 crore)
- total_sip_contributions = 0 # Total SIP contributions, initialized to zero
- corpus = 0 # SIP corpus, initialized to zero
- # Store results for each 5-year interval
- output_data = []
- # Simulating the SIP for 30 years
- for year in range(5, 31, 5):
- # Number of months till the current 5-year period
- n_months = 12 * year
- # Calculate SIP corpus for this period
- corpus = calculate_sip_corpus(monthly_sip, rate_of_return_monthly, n_months)
- # Total SIP contributions are simply the SIP amount multiplied by the number of months
- total_sip_contributions = monthly_sip * n_months
- # Calculate the inflated price of the item after 'year' years
- inflated_price = calculate_inflated_price(initial_item_price, inflation_rate, year)
- # Calculate taxable profits, tax, and post-tax profits
- profits, tax, post_tax_profits = calculate_taxable_profits_and_tax(total_sip_contributions, corpus, tax_rate)
- # Prepare the output string in the desired format
- output_data.append({
- "Period": f"Year {year - 4} to {year}",
- "Contributed Amount Till Now": f"{total_sip_contributions / 1e7:.2f} Cr",
- "Profits Made Till Now": f"{profits / 1e7:.2f} Cr",
- "Total Taxes Till Now": f"{tax / 1e5:.2f} L",
- "Total Amount Available for Withdrawal": f"{post_tax_profits / 1e7:.2f} Cr",
- "Inflated Value of Asset": f"{inflated_price / 1e7:.2f} Cr"
- })
- # Create a DataFrame to display the results
- df_output = pd.DataFrame(output_data)
- # Display the output for each 5-year period
- print("SIP Investment Overview (Every 5 Years):")
- for row in df_output.itertuples(index=False, name=None):
- print(f"\n{row[0]} --")
- print(f" - Contributed amount till now: {row[1]}")
- print(f" - Profits made from SIP till now: {row[2]}")
- print(f" - Total taxes paid (12.5% of profits): {row[3]}")
- print(f" - Total amount available for withdrawal: {row[4]}")
- print(f" - Inflated value of the asset at this time: {row[5]}")
- # Plotting the data (optional)
- plt.figure(figsize=(12, 8))
- # Plot SIP Corpus vs Year
- plt.plot(df_output['Period'], df_output['Total Amount Available for Withdrawal'], label='Total Amount Available for Withdrawal', marker='o', color='b')
- # Adding title and labels
- plt.title('Comparison of Total Amount Available for Withdrawal Over 30 Years')
- plt.xlabel('Year Period')
- plt.ylabel('Amount in INR')
- # Show the plot
- plt.grid(True)
- plt.xticks(rotation=45)
- plt.tight_layout()
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement