Upload 2 files
Browse files- tools/__init__.py +4 -0
- tools/financial_tools.py +25 -0
tools/__init__.py
CHANGED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# tools/__init__.py
|
| 2 |
+
from .financial_tools import time_value_tool
|
| 3 |
+
|
| 4 |
+
__all__ = ["time_value_tool"]
|
tools/financial_tools.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Optional
|
| 2 |
+
from engineconomics import time_value
|
| 3 |
+
from langchain.tools import tool
|
| 4 |
+
|
| 5 |
+
tv = time_value()
|
| 6 |
+
|
| 7 |
+
# Define your tool function
|
| 8 |
+
@tool
|
| 9 |
+
def time_value_tool(CF: float, F: str, i: float, n: float, g: Optional[float] = None) -> float:
|
| 10 |
+
"""
|
| 11 |
+
Computes time value of money factors using standard financial formulas.
|
| 12 |
+
|
| 13 |
+
Parameters:
|
| 14 |
+
CF (float): Assessed cash flow
|
| 15 |
+
F (str): Factor type (e.g., "P/F", "F/A", "P/G", "P/g")
|
| 16 |
+
i (float): Effective interest rate
|
| 17 |
+
n (float): Term in periods
|
| 18 |
+
g (float): Geometric gradient (optional)
|
| 19 |
+
|
| 20 |
+
Returns:
|
| 21 |
+
dictionary
|
| 22 |
+
"""
|
| 23 |
+
output = tv.cfv(CF, F, i, n, g)
|
| 24 |
+
|
| 25 |
+
return output
|