Skip to content

Latest commit

 

History

History

Docs

Quick Start

Install AmortaPy

Currently only available via Github install.

pip install git+https://github.com/b3mery/AmortaPy.git

Generating a Amortization Table DataFrame:

  • Amortization DataFrame
    import AmortaPy as ap
    
    input_interest_rate = 0.0394
    input_loan = 515000
    input_years = 30
    repayment_freq = 12 # monthly
    
    period_int_rate = input_interest_rate/repayment_freq
    periods = input_years*repayment_freq
    
    df = ap.generate_amortization_table(period_int_rate, input_loan, periods)
  • Amortization DataFrame with additional payments per peirod
    df = ap.generate_amortization_table(period_int_rate, input_loan, periods, additional_payment_per_period=50)

Generatating an Amortization Object

  • Create an amortization schedule

    import AmortaPy as ap
    
    input_interest_rate = 0.0394
    input_loan = 515000
    input_years = 30
    input_repayment_method = 'weekly'
    
    loan = ap.generate_amortization_schedule(input_interest_rate, input_loan, input_years, input_repayment_method)
  • Get a quick summary

    loan # if in Jupyter Notebook
    print(loan) # if in Python file/cmd
  • Tap into the amortization table dataframe

    loan.amortization_schedule.head()
  • Use the Setter Methods to recalculate the schedule. Setters default to inplace updates. Meaning the instance will be updated. If you want to reterive a copy set inplace=False

    # Update the years of the Amortization object and preview the table head again
    loan.set_years(20).amortization_schedule.head()
    
    # Update some attribute and have a new object returned
    loan2 = loan.set_nominal_annual_interest_rate(0.045, inplace=False)
  • AmortaPy Classes support dot notation. This means you can chain commands

    loan2.set_nominal_annual_interest_rate(0.028).set_repayment_frequency_periods('monthly')
  • Like how the inplace argument of False returns a copy of the object you can also explicitly create a copy.

    loan3 = loan.copy()

Graph Visualization

To visualize the Amortization Schedule in a graph you will need to manually install plotly-express

pip install plotly-express
  • Once installed you can simply tap into the figure properties.

    loan.period_balances_chart.show()
    loan.period_repayments_chart.show()
  • You can also create a stacked graph manually using the plot_stacked_bar_chart API which is was created to be reusable with the Amortization class.

  • More custom graphs should be created using plotly or plotly-express directly