Coder Social home page Coder Social logo

jaimebunay / budgeting_and_retirement_planning Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 1.19 MB

Using the Plaid and IEX APIs to collect data from banking and investment accounts. Refresh the data to build up to date reports. Conduct budget analysis and Monte Carlo simulations to project retirement portfolio performance.

Jupyter Notebook 100.00%
python pandas financial-analysis apis budgeting retirement-planning portfolio-management monte-carlo-simulation

budgeting_and_retirement_planning's Introduction

Using APIs to Connect to Banking and Investment Accounts

Overview


The purpose of this notebook is to simulate budgeting and financial planning services. It uses APIs to connect to customer's account transactions data for budget analysis, and to fetch historical closing prices for a retirement portfolio. Using the historical data, we will run Monte Carlo simulations to project the portfolio performance over 30 years and conduct retirement analysis. By using APIs, we are able to obtain the latest data and create reports that link the client's banking and investment accounts.

Budget Analysis with the Plaid API

In order to access data in Plaid's free developer Sandbox, we need to generate authentication tokens by using the plaid-python api. The first step is to establish our credentials. For privacy and security reasons, personal keys should never be hardcoded, instead we should use environmental variables for this part of the process.

# Establish Credentials
PLAID_CLIENT_ID = os.getenv('PLAID_CLIENT_ID')
PLAID_SBX_SECRET_KEY = os.getenv('PLAID_SBX_SECRET_KEY')
PLAID_PUBLIC_KEY = os.getenv('PLAID_PUBLIC_KEY')
PLAID_ENV = os.getenv('PLAID_ENV', 'sandbox')
PLAID_PRODUCTS = os.getenv('PLAID_PRODUCTS', 'transactions')

We can refer to the Plaid API Docs to connect and download transactions and account data to conduct budget analysis. The following pie chart breaks down expenses by category for the last 90 days.

expenses

In order to provide financial services like retirement planning, we need to obtain current income data. We can streamline this process by using the Plaid API.

income

Retirement Planner

In this section we use the IEX API to fetch historical closing prices for a retirement portfolio. We can refer to the iexfiance documentation and use the get_historical_data function. Then we use pandas pct_change, mean, and std functions to calculate the portfolio's average daily returns and average daily volatility. Finally, we can project the retirement portfolio performance by using a nested 'for loop` to run Monte Carlo simulations 500 times for the next 30 years.

monte_carlo

Retirement Analysis

In this section we use the numpy.quantile function to estimate the expected returns at 30 years for the 10th, 50th, and 90th percentiles with a $20,000 initial investment.

Returns

For the purpose of this analysis, we will assume a 4% withdrawal rate from the retirement portfolio and compare it to the projected annual income we obtained from Plaid.

analysis

budgeting_and_retirement_planning's People

Contributors

jaimebunay avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.