{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Lab 5\n", "* Calculate NPV (Net Present Value). The rate is a float, and the cash flows and investments are in a list.\n", "$$\n", "NPV=\\sum_{i=1}^{n} \\frac{CF_{i} }{(1+r)^{i}}-I\n", "$$\n", "* Create a function called NPV to calculate NPV\n", "\n", "* create a function to calculate IRR. To calculate IRR you may approximate the following expression:\n", "\n", " rate= rate*(1-NPV(CFList, rate)/invest). \n", "\n", " Remember that investment is the first cash flow.\n", "\n", "* Create a function to calculate the payback period\n", "* Create a class adding all the properties and methods\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#Supose you have the follwoing cashflow\n", "CF=[-1200,222,333,555,666,666]\n", "CF0=I" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# create a function called NPV to calculate NPV\n", "# sugestion: iterate both by index and value using enumerate function" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#create a function called NPV that returns the NPV value" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#create a function to calculate the payback period" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "# create a class adding all the properties and methods\n", "#\n", "# +-------------+\n", "# | project |\n", "# |-------------| \n", "# | cashflow |\n", "# | name | \n", "# | rate | \n", "# |-------------| \n", "# | __init__ |\n", "# | calcNPV |\n", "# | calcIRR |\n", "# | seeCahsflow |\n", "# +-------------+\n", "#" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.7" } }, "nbformat": 4, "nbformat_minor": 2 }