Skip to content

Course materials for GENERAL EDUCATION SEMINAR (PEARL)

License

Notifications You must be signed in to change notification settings

nakatsuma/GES-PEARL

Repository files navigation

GES-PEARL

Course materials for GENERAL EDUCATION SEMINAR (PEARL)

Teruo Nakatsuma (Faculty of Economics, Keio University, Japan)



How to set up Python and necessary packages

I strongly recommend using Anaconda. It can install Python along with numerous essential packages at once and allows us to manage those packages flexibly.

Step 1: Installing Anaconda

  1. If you have an older Anaconda on your PC, uninstall it completely by folloiwng instructions.

  2. Download an Anaconda installer (Windows, macOS or Linux) from here. Choose a Python 3 installer.

  3. Doubleclick the installer and follow the instructions on the screen. Do not change the default settings.

Step 2: Installing Additional Tools

(Windows) Installing Microsoft Visual Studio Build Tools

  1. Download the installer for Microsoft Visual Studio Build Tools from here.

  2. Doubleclick the installer and follow the instructions on the screen. It is sufficient to install C++ build tools. See this link for the install instructions.

(macOS) Installing Command Line Tools for Xcode

  1. Install Xcode from App Store.

  2. Start Xcode. If a pop-up window asks you to install additional tools, follow the instruction. Quit Xcode.

  3. Start Terminal and install Command Line Tools for Xcode by typing

sudo xcode-select --install

If asked, type your login password.

Step 3: Creating an environment

Start Anaconda Powershell Prompt (Windows) or Terminal (macOS, Linux) and type

conda update conda

This will update conda (package manager) in Anaconda. Then type

conda create -n finance jupyterlab seaborn

This will create a new enviromnemt named finance. Then type

conda activate finance

To install CVXPY, type

conda install -c conda-forge cvxpy

Finally type

python -m ipykernel install --user --name finance --display-name "Python (Finance)"

Now you are ready for Python!


Tips for Troubleshooting

If you encounter any errors during the installation process, go back to the default environment by typing

conda deactivate

and remove finance by typing

conda env remove -n finance

Then retry Step 3.


How to start JupyterLab

Start Anaconda Powershell Prompt (Windows) or Terminal (macOS, Linux) and type

conda activate finance

Then type

jupyter lab

Your default browser will pop up. Click the Python (Finance) button to create a Jupyter notebook.

Anaconda Navigator


Jupyter Notebooks and related files in notebook

file name description
asset_return_data.csv simulated asset returns
capm.csv market capitalization data
ges_alt_risk.ipynb portfolio with alternative risk measures
ges_bond.ipynb yield, duration and convexity of bond
ges_interst.ipynb interest rate
ges_mvf.ipynb mean-variance portfolio
ges_mvf_sample.ipynb mean-variance portfolio with data
ges_npv_irr.ipynb present value, internal rate of return
ges_portfolio.ipynb introduction to portfolio analysis
ges_riskparity.ipybn risk parity portfolio
ges_tracking_error.py traking error minimization problem
stock_market_cap.csv market capitalization data

Python codes and related files in python

file name description
asset_return_data.csv simulated asset returns
capm.csv market capitalization data
ges_ad_portfolio.py mean absolute deviation portfolio
ges_asset_return_simulation.py simulation of asset returns
ges_black_scholes.py Black-Scholes formula for option pricing
ges_bond_duration_convexity.py duration and convexity of bond
ges_bond_yield_curve.py yield curve of bond
ges_bond_yield_price.py price-yield relationship
ges_capm.py CAPM beta estimation
ges_es_portfolio.py expected shortfall portfolio
ges_interest.py interest rate
ges_min_tracking_error.py tracking-error minimization
ges_mvf_example1.py mean-variance portfolio
ges_mvf_example2.py mean-variance portfolio w/o short selling
ges_mvf_example3.py mean-variance portfolio with data
ges_npv_irr.py present value, internal rate of return
ges_option_pricing.py option pricing with binomial tree model
ges_risk_parity.py risk parity portfolio
ges_sv_portfolio.py semivariance portfolio

About

Course materials for GENERAL EDUCATION SEMINAR (PEARL)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published