機器學習與量化交易實務
臺北科技大學 115-1 學期課程,課號 366712。
- 學期:115-1
- 授課教師:張庭瑜
- 學分:3
- 選修
- 上課時段:週二 8、9、A 節
課程大綱
本課程旨在帶領學生深入探討機器學習在量化交易與系統性投資策略中的應用。課程內容以嚴謹的數據工程為基礎,教授學生如何處理高頻市場數據(Market Data)與另類數據(Alternative Data,如新聞情緒與社群文本),並從中萃取具備預測力的Alpha 因子。課程前期將著重於特徵工程(Feature Engineering)與金融時間序列的交叉驗證方法(如 Purged Cross-Validation),確保模型在時間序列上的穩健性。中期將系統性地介紹多種預測模型,包含樹狀集成模型(Random Forest, LightGBM)以及深度學習架構(CNN, RNN/LSTM),並探討其在資產定價與波動率預測上的應用。後期則著重於投資組合最佳化與嚴格的策略回測,引導學生使用 Python 生態系(如 Zipline, Alphalens, Pyfolio)評估策略的風險調整後報酬(例如夏普比率與最大回撤)。期末專題要求學生分組實作一個完整的端到端(End-to-End)量化交易策略。 This course explores the application of machine learning in algorithmic trading and systematic investment strategies. Grounded in rigorous data engineering, it teaches students to process market and alternative data (e.g., news sentiment) to extract predictive Alpha factors.The first half focuses on feature engineering and financial time-series cross-validation (e.g., Purged CV) to ensure model robustness. The second half systematically introduces various predictive models, including tree-based ensembles (Random Forest, LightGBM) and deep learning architectures (CNN, RNN/LSTM), applied to asset pricing and volatility prediction. Finally, the course covers portfolio optimization and rigorous backtesting. Students will use the Python ecosystem (Zipline, Alphalens, Pyfolio) to evaluate risk-adjusted performance metrics. The course culminates in a final project where students develop an end-to-end quantitative trading strategy.
課程進度
Week 01 : Machine Learning for Trading - The evolution of algorithmic strategies, the emergence of machine learning and alternative data, and designing ML-driven trading strategies. Week 02 : Market and Fundamental Data - Market microstructure, high-frequency data processing, and using Python to access various market and fundamental data sources. Week 03 : Alternative Data and Applications - Evaluating the signal content of alternative data (e.g., social sentiment, satellite data) and using web scraping for data extraction. Week 04 : Financial Feature Engineering and Alpha Factors - Transforming data into signals, measuring momentum and sentiment factors, and evaluating volatility and size anomalies. Week 05 : Portfolio Optimization and Performance Evaluation - Measuring portfolio risk and return, mean-variance optimization, and evaluating backtest performance. Week 06 : The Machine Learning Process - Supervised and unsupervised learning, designing and tuning models, managing the bias-variance trade-off, and time-series cross-validation. Week 07 : Linear Models and Strategy Backtesting Workflow - Building linear regression models to predict stock prices, understanding and avoiding backtesting pitfalls, and simulating trades using Zipline and backtrader. Week 08 : Midterm Proposal Presentation - Students give group presentations on their midterm proposals. Week 09 : Time-Series Models and Statistical Arbitrage - Univariate and multivariate time-series models (ARIMA, VAR), volatility forecasting, and cointegration for pairs trading. Week 10 : Random Forests and Boosting Methods - Nonlinear tree-based models, Random Forests, XGBoost, and LightGBM ensemble algorithms. Week 11 : Unsupervised Learning and Asset Allocation - Dimensionality reduction (PCA, ICA), clustering algorithms, and hierarchical risk parity (HRP). Week 12 : Text Data, Sentiment Analysis, and Topic Modeling - The NLP workflow, Naive Bayes for sentiment analysis, and Latent Dirichlet Allocation (LDA) for financial news. Week 13 : Word Embeddings and Deep Learning Applications - Training custom word vectors using word2vec, neural network architecture design, and model tuning. Week 14 : Convolutional & Recurrent Neural Networks (CNN & RNN) - CNN applications for financial time series and satellite images, and RNN/LSTM architectures for multivariate time-series forecasting. Week 15 : Autoencoders & Generative Adversarial Networks (GANs) - Extracting data-driven risk factors using Autoencoders, and generating synthetic financial data using TimeGAN. Week 16 : Final Report Presentation - Students give group presentations on their complete strategy backtesting and analysis. Week 17 : Flexible Learning: Self-directed Extension Learning (Academic Literature Review) Groups conduct self-directed learning, searching for and reviewing international academic journals or conference papers related to "Machine Learning for Algorithmic Trading" . Week 18 : Flexible Learning: Paper Reading Report Submission Based on the literature reviewed in Week 17, groups compile their findings to summarize model architectures and backtesting methodologies, submitting a "Literature Review Written Summary Report" as their final learning outcome without an in-class presentation
評量方式
課堂參與 / Class Participation (20%) 包含出席率、課堂互動探討與問答表現。 Includes attendance, active participation in class discussions, and engagement in Q&A sessions. 期中專題提案 / Midterm Proposal (20%) 配合第 8 週的進度,各組需上台報告並繳交書面提案,確認期末將進行回測分析的「機器學習與演算法交易策略」主題方向。 Scheduled for Week 8. Groups will give a presentation and submit a written proposal defining the direction of the machine learning model and algorithmic trading strategy they plan to backtest for the final project. 期末專題報告 / Final Project (40%) 配合第 16 週的進度,各組需上台報告並繳交期末書面報告。內容須結合前 15 週學到的模型與技術,呈現「完整策略回測與績效分析」的實作結果。 Scheduled for Week 16. Groups will present and submit a comprehensive final written report that integrates the models and techniques learned throughout the course to demonstrate complete strategy backtesting and performance analysis. 課外報告(彈性學習週) / Extracurricular Report (Flexible Learning) (20%) 作為第 17-18 週「自主延伸學習(學術文獻研讀)」的學習成果考核。各組須於課外研讀與課程相關之國際學術論文,並於第 18 週繳交「文獻研讀書面摘要報告」列入總成績計算 。 Serving as the learning outcome assessment for the Flexible Learning weeks (Weeks 17-18). Groups will conduct self-directed reading of relevant academic literature outside of class and submit a "Literature Review Written Summary Report" by Week 18, which is factored into the final grade.
教材
【遵守智慧財產權觀念,請使用正版教科書,不得使用非法影印教科書】 使用外文原文書:是 Machine Learning for Algorithmic Trading - Second Edition -Stefan Jansen