Investment-Agent / tools.py
Satyanjay's picture
Upload 4 files
8ef6e64 verified
raw
history blame contribute delete
636 Bytes
from langchain.tools import tool
@tool
def simple_interest(P: float, R: float, T: float):
"""Calculate simple interest"""
return (P * R * T) / 100
@tool
def sip_return(monthly_investment: float, rate: float, years: int):
"""Estimate SIP returns"""
r = rate / (12 * 100)
n = years * 12
return monthly_investment * (((1 + r)**n - 1) * (1 + r) / r)
def portfolio_rule(risk):
if risk.lower() == "low":
return "70% FD, 20% Bonds, 10% Equity"
elif risk.lower() == "medium":
return "50% Mutual Funds, 20% Hybrid, 20% FD, 10% Stocks"
else:
return "70% Equity, 20% MF, 10% Cash"