https://github.com/oaerobert/python-for-finance
Implementations of financial mathematics and statistics using the "Python for Finance" textbook. Includes Monte Carlo simulations, predictive stock prices using ML strategies and real world data visualisations.
https://github.com/oaerobert/python-for-finance
matplotlib numpy pandas python
Last synced: 7 days ago
JSON representation
Implementations of financial mathematics and statistics using the "Python for Finance" textbook. Includes Monte Carlo simulations, predictive stock prices using ML strategies and real world data visualisations.
- Host: GitHub
- URL: https://github.com/oaerobert/python-for-finance
- Owner: oaerobert
- Created: 2024-12-10T22:27:18.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-13T11:08:36.000Z (12 months ago)
- Last Synced: 2025-02-13T12:25:45.401Z (12 months ago)
- Topics: matplotlib, numpy, pandas, python
- Language: Jupyter Notebook
- Homepage:
- Size: 2.85 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## 🐍 for Finance
Hey! 👋🏾
My name is Oke and I'm currently a second year Mathematical Economics & Statistics student at the University of Birmingham.
- I bought the textbook "Python for Finance" which currently is enabling me to refine my technical proficiencies in Python and its libraries (**NumPy, Pandas, Statsmodels, Sckit-learn and Matplotlib**).
I've been working through it and I'm documenting the projects of this textbook within this repository.
- This repository showcases my work with Python in analysing and visualising financial data, alongside simulating stock market behaviours and performing statistical tests 📈 It is regularly being updated as I progress within the textbook.
---
#### 1. S&P 500 Data Visualisation 📊
I used the libraries **NumPy**, **Pandas**, and **Matplotlib** to provide clear visualisations of:
- Relative volatilities of different stocks.
- Historical trends and patterns in the stock market using real S&P 500 data.
- Designed user-friendly graphs and plots to make data insights easily interpretable.
#### 2. Monte Carlo Simulations ⏩
I developed a Monte Carlo simulation model for stock price forecasting. I used **NumPy**
- This simulation includes:
- User-defined parameters such as initial stock price, number of simulations, and time of maturity.
- Aimed to help users assess risk and potential returns effectively.
#### 3. ML Trading Strategy using Support Vector Classification 📊
I created a ML based trading strategy to predict stock price movements, and evaluate its performance against a buy and hold strategy.
- It predicts stock returns by comparing cumulative returns of the ML strategy to the buy-and-hold strategy.
- Provides a clear plot of strategy returns vs. actual stock returns for easy interpretation.
- Uses 3 lags as determined by ACF plot to prevent over-fitting of ML model.
- Includes markers in Matplotlib that determine the best time to buy and sell for maximum profits
---
### If you would like to see this code in action 🏄🏾♀️...
Take a look at the files within this repository. The titles correspond to the appropriate project 😇
- Ensure you install the required libraries.
- Copy and paste the code into Python or Jupyter.
- Adapt the code to your specific data and user inputs and use to your discretion :)
---