Applying Python in solving practical issues in finance. Materials in this repo are designed for students taking my course 《Python在金融中的应用》以及《基于机器学习的投资分析》 浙江工商大学 金融学院.
If you have any query or would like to contribute, I would be very happy to hear from you by email [email protected].
-
Python 3.*
-
Anaconda (Spyder) You can download the latest official version from here, and if you experienced a bad connection, a mirror site maintained by Tsinghua is available here. Tutorial in Chinese is available here.
You could surely use other IDE for programming
- Tushare (http://www.tushare.org or https://tushare.pro/)
- IEX Finance (https://pypi.org/project/iexfinance/)
- First Talk: What you need to prepare - Very important (slide)
Preliminary Session
- Numpy and matrix operations (slide and code)
- Matplotlib and image processing (slide and code)
- Pandas and data processing (slide and code)
Data Session
- Data base (SQL and NoSQL): MySQL and MongoDB (You can use MariaDB as an alternative of MySQL) (slide and code)
- API and Data Retrieval: Tushare (slide and code)
Program Session
- Web Crawler I: Financial News from 雪球 (slide and code)
- Web Crawler II: Daily stock price from 网易财经 (slide and code)
- Time series basic: Return, mean, variance, correlation of stock prices, visualization, etc (slide and code)
- Nature Language Processing: Financial sentiment analysis (slide and code)
- Quantative analysis: Sharpe ratio, Information ratio, Maxmium Drawnback, etc (slide and code)
- Statistics Tests: T test, Chi Square test, OLS (slide and code)
Case Study
-
Bond Pricing
-
Porfolio Management (slide and code)
ML Session
-
Basic
- Learning Regression
- Logistic Regression
-
Unsupervised Learning:
- K-means Clustering -- feature detecting
- Genetic Algorithm -- early warning
- Self-Organizing Map
-
Supervised Learning:
- Naive Bayes Classifier (slide and code)
- Decision Tree (Find the best indicator)
- K-nearest neighbor
-
Reinforcement Learning:
- Multi-Arm Bandit (portfolio selection)
- Q-learning
-
Nature Language Processing:
- Financial sentiment analysis