A Python Library for Calculating Financial Equations.
Use python package manager (pip) to install the latest version.
pip install -U fincalc
from fincalc import FinancialCalculator
FC = FinancialCalculator()
calculate_factors(equation: str, rfp: int = 5) -> dict
equation
: User input equation.rfp
: Round Floating Points. Defaults to 5.
calculate_ror(equation: str, rfp: int = 5, interest_rate_range: tuple = (-10, 100)) -> dict
equation
: User input equation.rfp
: Round Floating Points. Defaults to 5.interest_rate_range
: Interest Rate Range. Defaults to (-10, 100).
from fincalc import FinancialCalculator
FC = FinancialCalculator()
result = FC.calculate_factors('1500*(P/A,12,3)*(P/F,12,6) + 200*(P/A,12,8,4)')
print(result)
# output
# {
# 'equation': '1500*(P/A,12,3)*(P/F,12,6) + 200*(P/A,12,8,4)',
# 'factors': {'(p/a,12,3)': 2.40183, '(p/f,12,6)': 0.50663, '(p/a,12,8,4)': 3.38462},
# 'answer': '1500*2.40183*0.50663 + 200*3.38462',
# 'result': 2502.1827
# }
from fincalc import FinancialCalculator
FC = FinancialCalculator()
result = FC.calculate_ror('-60000 + 12000*(P/A,i,25) + 3000*(P/F,i,25)')
print(result)
# output
# {
# 'equation': '-60000 + 12000*(P/A,i,25) + 3000*(P/F,i,25)',
# 'factors': ['(P/A,i,25)', '(P/F,i,25)'],
# 'result': 19.79
# }
- (P/F,i%,n)
- (P/A,i%,n)
- (P/A,i%,j%,n)
- (P/G,i%,n)
- (F/P,i%,n)
- (F/A,i%,n)
- (F/A,i%,j%,n)
- (F/G,i%,n)
- (A/P,i%,n)
- (A/F,i%,n)
- (A/G,i%,n)