VWAP과 Pair Trading이 기계학습과 만나면?

1.
기계학습과 투자를 주제로 하는 논문을 보다보면 예전과 다른 면이 보입니다. Goal Based Investing과 기계학습도 개인적인 관심과 맞물려 정리한 글입니다. 여기서 궁금점을 녋혀보았습니다.

“VWAP과 기계학습이 만나면”
“Pair Trading과 기계학습이 만나면?”

이런 질문을 한 이유는 기관투자자를 위한 알고리즘트레이딩시스템때문입니다. 지난 몇 년동안 증권회사가 기관투자자를 위한 VWAP를 기본으로 한 알고리즘트레이딩시스템을 너도나도 도입하였습니다. 단순한 수준의 Order Management System을 업그레이드한 결과입니다. 2010년 알고리즘트레이딩이 여의도에 회자한 이후 십여년 지난 결과입니다. 그러면 기계학습이 시대적 주류로 진입하는 조건에서 전통적인 알고리즘 모형들이 어떻게 바뀌는지 궁금했습니다.

먼저 VWAP. 수식을 보면 무척 단순합니다.

2015년 Flextrade는 Predicting Intraday Trading Volume and Volume Percentages를 발표합니다. 거래량예츠모형을 실제로 시스템화한 결과입니다.

Download (PDF, 1.46MB)

위 모형처럼 VWAP에 기계학습을 적용한다고 하면 거래량에측이 포인트가 아닐까 합니다. 검색어를 입력하니 가장 먼저 눈에 들어논 논문입니다. Using a Genetic Algorithm to Build a Volume Weighted Average Price Model in a Stock Market인데 저자들이 한국사람입니다. dynamic time warping (DTW)과 genetic algorithm (GA)을 결합한 모형을 검증합니다.

Download (PDF, 4.02MB)

VWAP Forecasting for a Stock using Machine Learning은 Facebook Prophet, LightBGM, AutoRegressive Integrated Moving Average, Recurrent Neural Network, XGBoost의 Mean Absolute Error값과 Mean squared Error을 비교합니다. Mean Absolute Error값과 Mean squared Error은 회구분석의 성과측정 지표입니다. MAE (Mean Absolute Error)는 절대값(에러 – 실제값) 의 평균인 에러 지표로 에러의 절대 값 그 자체를 나타내기 때문에, 값은 낮을수록 좋다고 하네요. MSE(mean squared error)는 가장 일반적이고 직관적인 에러 지표로 에러를 제곱하여 평균을 계산하므로, 값은 낮을수록 좋습니다.RMSE는 MSE에 Root 를 씌운 에러 지표입니다. 값이 낮을수록 좋습니다.

Download (PDF, 386KB)

Volume Prediction With Neural Networks은 Long Short Term Memory (LSTM)을 이용한 모형과 검증을 다룹니다. 이 논문에서 재미난 점은 서론입니다. 별로 다루는 연구자가 없다고 합니다.

Despite its importance, thus far, only a limited number of papers have been published on this topic (Árpád Szűcs, 2017). Thus, the prediction of trading volume, and particularly the intraday change in trading volume, is still an open subject with very limited research.

Download (PDF, 488KB)

마지막으로 Python으로 구현한 프로젝트fh VWAP-Prediction입니다.

Random forest and logistic regression were used for VWAP direction classification (up or down), while PCA and random forest were used for feature selection. Least absolute shrinkage and selection operator (LASSO) regression was performed to predict real VWAP value. We also used a long short-term memory (LSTM) recurrent neural network to predict real VWAP value. See paper.pdf for more details.

2.
페어트레이딩. 이 주제도 한동안 많이 회자하였던 내용입니다. 한동안 뜸했는데 기계학습과 만나면서 논문이 새롭게 나오는 듯 합니다. 아래는 Deep Reinforcement Learning을 기반으로 한 논문들입니다.

Optimizing the Pairs-Trading Strategy Using Deep Reinforcement Learning with Trading and Stop-Loss Boundaries의 저자는 한국인입니다.

Deep Reinforcement Learning for Pairs Trading:Evidence from Soybean Commodities은 ST (Simple Threshold Method), CA-ST (Co-integration method and Simple Threshold Method),와 DRL and the CA-DRL (Co-integration method and Deep Reinforcement Learning)을 적용한 모형입니다.

Structural break-aware pairs trading strategy using deep reinforcement learning는 Structural break(구조변환)개념을 도입한 모형입니다.

The architecture of the proposed two-phase machine learning framework structural break-aware pairs trading strategy (SAPT). The first-phase SWANet (the green rec-
tangle) estimates the occurrence probability of structural breaks with a hybrid model learning from time- and frequency-domain features. The second-phase SADQN (the yellow rectangle) determines the setting of boundaries (including trading and stop-loss boundaries) over time dynamically with a novel reinforcement learning model, where a transaction cost-aware objective and a risk-aware environment setting are incorporated.

아래는 각 논문의 전문입니다.

Download (PDF, 6.02MB)


Download (PDF, 1.83MB)


Download (PDF, 2.69MB)

3.
Github를 보면 Pair Trading 모형을 Python으로 구현한 프로젝트는 많이 있습니다. 그 중 완성도가 높은 것을 소개하면.

Pair-Trading-Reinforcement-LearningA Gentle Implementation of Reinforcement Learning in Pairs Trading에 자세한 설명이 있습니다. Tensorflow을 이용하였습니다.

Pair Trading: A market-neutral trading strategy with integrated Machine Learning는 GeorgiaTech Summer 2020의 프로젝트과제 산출물입니다.

VWAP과 Pair Trading. 광범위하지 않지만 현실영역에서 사용하는 경우가 있네요.국내 Qraft가 제공하는 Qraft Pair trading Framework가 있습니다. 앞서 Optimizing the Pairs-Trading Strategy Using Deep Reinforcement Learning with Trading and Stop-Loss Boundaries의 개념도와 비슷한 모형이네요.(^^)

VWAP을 둘러싼 연구들이 많지 않지만 Exegy Improves Best Execution with Predictive VWAP Algorithm을 보면 실거래에서 이용하는 알고리즘도 있는 듯 합니다. 이 들의 표어입니다. 멋집니다.

Stop Reacting – Start Predicting

Leave a Comment

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다

이 사이트는 스팸을 줄이는 아키스밋을 사용합니다. 댓글이 어떻게 처리되는지 알아보십시오.