** * * * * * * * * * * * * **** * ** * ** ** *** ** **** ** ****** * ***** * ***** * ****** * * ******** * * ******* * * ***** * *********** * ** * ************* * * ** * ********* * ******* * * ******** * ****** * ** ***** ** * * * ** ******* ** * * * * ******* * * *** ** * ****** ****** ******* ******* * ****** ******* * * * ** ***** * * * ** * ***** * * * ** * **** * * * * * * ***** * * * * * * ***** * * * * * ****** * ** ** * ***** ** ****** * ** ** * **** **** * **** ****** * ** ** * ******* *** **** ** * ******** * * * * ** ***** *** ** *** ***** ******** ** ****** * **** * ** ************** *** * ********* ** * * * ******* * ** **** * * ********* ** ** ** ** * * * *** * ** * ********* ** ******** ** ** * * * ** * ** ** * ******** * ************ ** ** * * * **** ** ** ** * ********* * ************ ** ** ** * * **** ** * * * ******** * ********** ** ** ** * * ****** ***** * * ******* ********** * ** * ** * * **** ** * * * * ******* ************* * ***** * * * ** ** **** ** * * ******* ************* * ****** **** * * ** **** ** * * * ** ******* ************** * ***** *** * * * ****** **** ** * * ****** ******* *************** * ** *** * * * ***** ** ** ** ** * ******* **************** * ** ****************** * * ****** ** ** * * * ******* **************** ** ******** ********** * ****** * ** ** * * ** ******* ************* ** ***** ** * ********** ** ***** * *** * * * * ** ******** ******** ** *** ** ** * ** *********** * **** ******* * * * * ********* ** **** ** ** * ** * * ********* * * * * * ****** ********* * ***** * ** * *** * * ****** ** * * * ** * *********** ********* * ****** * ** ** *** * **** * *** * * * ** * ***************** ******** * ******* * * ** ************ ** * * * ** * ** ************* ******* ******** *** ** * * ** ** ** ** * ** * * *********** ****** ******** *** ** * * * ** ** ** ** ** * ******** * ******* ********** *** ** * ** * * ** * ** * * * ******* ***** ********* ** ** ** ** * * ** * * * ***** ******* * * ****** ********* ** *** ** ** * * ** * * ****** ****** ***** * ***** ********* *** ** ** ** * ******* ****** ** * ** ** * * *** ******** ** ** ** ** * **** * * * * * ** ** * * ******** ** * ** ** * * * * * * * * * ********* *** * * ** ** ** * * * * * * * ******** ** ** * * ** * ** ** * * * **** * * **** *** *** ** ** * ** * ** ** * ** * **** * * ** ******* *** ** * ****** * * ** ** * ** ** * * ** ** ******* ** * * * * ****** * ** ** ** ** * * ** ** ******* *** ** * ** * * * * * ** * * * ** ** ** ******* * ** ** * ** * * * * * * ** ** * ** ******** * ** ** * ** * * * * * * ** * * * ********* * *** ** * * * * * * * * * ***** ********** * ** ** * * * * * * * * ***** ********** * *** * * * ******* * ** **** ****** ********** **** ** * * * ** * ** **** * * *** ***** ***** * ** * ******* * ** * * **** **** ****** * ** * *** ** * ** * * *** ***** ****** * ** ** ** * * ** ** * **** **** *********** * ** ** ** ******* * ** * **** ***** ******* * * ** ** ** ****** * ** ** **** **** ***** ******* * ** ** * * * ** ** **** **** ***** ** * ** ** ** * ****** ** * * ** **** **** **** * * ** ** ** * ******* ** * * ***** *** **** ** * ** * ** * * * ** * * **** *** **** ** ** ** * * * ** ** * ** * * ***** **** **** * ** ** *** * ** ** ** ** **** *** **** * ** ** ** * ** ** ** ******* ***** *** **** * ** * * * ** ** ** ******** **** *** **** * ** * *** * ** ** ** ******** **** *** **** *** * ** * * ** ** * ********* ***** *** **** ********** **** * ** ** ** ** ********* ***** ** *** ****** ************* * ******* ** ** * ********* *** ** **** ***** * * **** ** * ** ** * ********* *** ** **** **** *** * ****** * * ** * * ********* *** *** *** *** ******* ** ** * * ** ** * ********* *** *** **** *** ** ** ** ** * * * * ** ********* *** *** **** *** ** ** ** * * * * * ** ********** **** *** **** *** ** ** ** * * * * * ** ******* *** *** *** *** * ** ******** * ** * ** ** *** ** **** *** * ** **** * ** * ** ** ** *** ** **** *** * ** * ** ********* * ** ** ** *** *** **** *** * ** * ** ** ******* ** ** *** *** **** *** * ** ******* ** * ** ** ** ** *** ** *** *** * ** ********** * ** ** ** * ** * *** ** **** *** * ********* ** ** ** ** * ** * *** ** **** ** ** ** ** * ** ** * ** * *** ** **** ** ******* ** * ** * ** * * ** * *** ** ***** *** ********** * * ** * ** * * * * *** *** ****** *** ********* ** * ** * ** * * * ** *** ** ***** *** **** ** * ** * * * * * ** *** *** ***** ***** *** ** * * * * * ** * ** *** *** ***** ********** *** ** * * * * * ** ** ** *** ** ***** ************ *** ******* * * * * ** ** ** *** * ***** ********** *** **** * * * ** ** ** ** *** ** ***** ****** **** ** * * ** * ** ** ******* *** ** * **** *** ** * * ** * ** ** *** *** ** ******* **** *** ** * * ** * ** ** *** * ************* **** *** ** ******* * * ** * * ** * ** * ************** **** *** * ***** ** * * ** * ** **** ** *************** **** *** * * ** * * * ******* ****** ** *************** *** *** * * ** * * * * * * * *************** *** *** * ** * * ******* ****** * * * **************** *** *** * ** * * * * ** * ***************** **** *** ** * ** * * ** * ******* ******* **** ***** ** * ** * * * * ***** ******** *** ******* ** * ** *** * * * ** ******* *** ****** ** * *** ******* ** * * *** ***** *** **** ** * ******* * * ** * * * **** *** **** ** * * ** * ** * * * ** *** **** * ** * * * ** * ** * * * ** * *** **** * * * * ** * ** * * *** *** * ** ******* * * * ** * ** * * *** *** ******* *** * ******* * ** * ** * * *** *** * * ** ** * * * ** * ** ** *** *** * * ** ** * * ** ** * ** ** *** *** * * ** ** * ***** ******** * ** ** *** *** * ** ** ** ***** ** ** * ** ** * * **** *** * ** ** ** ** * ** ** **** **** ** * ** ** ** ** * ** * ***** **** ** * ** ** ** ** * ** * ****** **** ** * ** ** ** * ** * * * ******* **** ** ******* ** ** * ** * * * ******* **** *** * **** ** ** * * * * * ******* **** *** * * ** ** * ** * * ******** **** ** * ** ** ** ****** ** * * ******** **** ** * * ** ** **** * * * * ******** **** ** * ** ** * * * * ******** **** ** * ** ** * * * * ******** **** *** * ** ** * ** ** ** ******** **** ** * ** ** ******* ** ** ******** ***** ** * * ** * * ** ** ******** **** ** ***** ** ***** * ** * ******** **** ** ******** ***** * ** * ****** ***** ** * * * * ** **** * ***** ** * * * ****** * **** *** * * * ******* * **** ** * * * ******* * **** ** * * * ******* * **** *** * **** * ******* * **** ** ******** ** ******** * **** ** * * ** ******** * **** *** * ** ******** * **** *** * ** ******** ** **** *** ** ** ******** ** **** *** * ** ****** ** **** *** ***** **** ** ** **** *** * ******* ******* ** ** **** *** ** * * ******* ** * *** *** * * * ******* ** * *** *** * * ** ******** ** * *** *** * * ****** ** * **** *** * **** ** ** * **** *** * ******* * ** ** * **** *** * ***** * ** ** * *** *** **** ** * ** ** * *** **** ******** * * ** ** * *** ***** * ****** * * ** ** * *** ***** **** ** * * ** ** ** *** **** ******** * * * * * ** *** *** ***** * * * * * ** ** *** ** * * * * ** * ** *** ** *** * * * * ** * ** *** ******* *** ***** * * * * ** * * *** ******** *** ***** * ******** * * * * * * *** ******** *** * * ******* * * * * * * *** ******* *** * * * * * * * * *** * * *** *** *** * * * * ******** * ** ******* * * *** *** * * ** ** ** ** ******* ** * * ** ** *** * ** ** ** * ** *** * * * ** *** **** ******* ** ** * ** ** * * * *** *** ******* **** ** ** * ** ** * * * * *** *** ** *** * ** ** * ** ** * * *** *** ** * *** * ** * * ** ** * ** *** *** ** * *** ** ** * ** ** * ** ***** *** *** * *** ** ** * ** ** * ** **** *** *** * *** ******* * ** ** * ** ****** *** ** * *** ***** * ** ** * ** ***** * * *** ** * *** ** ******* ** * * ****** * ** *** ** * *** ** *** ** * * ***** * ** ** ** ** *** ** ** * * ***** * ** *** ** ** *** ** ** * * ****** * * *** ** * ** *** ** ** * * ****** ** * ** ** * ** *** ** ** * ****** ** * ** ** * * ******** ** ** * ****** ** * ** ** ******** ** ** ** * ****** * ** * ** ** **** ** ** ** * ****** * * * *** ** ** ** ** ** * ****** * * ** *** ** ** *** ** ** * ******* ** ** * ** *** ** ** *** ** ** *** ******* ** * ** ** ** *** ** ** *** ** ******* ******* ** *** * ** *** ** ******** ** ** * ****** ** * * * *** ** ***** ** ** ****** * * * * *** ** * ****** * * * * *** ** ** ****** * * * * *** ** ** ****** * ** * * * *** ** ****** * ** ** * ** ** ****** * * * ** ** ****** * * ** *** ** ******* * * ** *** ** ******* * * ** *** ** * ****** * * * *** ** * ****** * * * ** ** * ** ****** * ** ** ** ** ** ******* ****** * * *** * ** ** ** *** ** ****** * * ** * ** * * ** ****** * ** * * ** * ** ****** * * ** ** ** * ** ****** * * * * * ** ** ****** * * * * * ** ** ** ****** * * * ** * ** ** ** ***** * * * ** * ** ** ** ****** * * * * ** ** ** **** * * ** * ** * * ** * ***** ** * ** * ** ** *** **** * * ** * ** ******* * ** * * ** ** * ** * * ** *** * * * * * ******* * * * ** ** * ** ** * * * **** * ** ** ** * * * ** * ** ** ** * * * * ** ** * ** ** * * ** ** **
Theoretical foundations for discretionary, algorithmic, and diversified trading with AI
This book is aimed at retail traders, data scientists, students, and practitioners alike who want to harness sophisticated AI in the realm of day trading in the stock market. The book assumes the readers have some familiarity with the Python programming language. For reference and review, the appendices contain cheatsheets on Conda, Python, NumPy, Pandas, Matplotlib, Scikit-Learn, and PyTorch. The book consists of two parts. Part I delivers the theoretical foundations for discretionary, algorithmic, and diversified trading with AI while Part II gives readers the hands-on experience in building a complete AI system for day trading. Readers will find this book useful as it bridges well-established modern finance theories with cutting-edge data science. The strategies that make up the software do not come out of the blue but are solidly founded on the efficient market theory and behavioral finance as two sides of a coin. Although the book discusses sophisticated machine learning and deep learning algorithms for trading model development, the author uses plain language with minimum math for clear explanations. The code snippets in the listings are reusable and can be easily deployed by readers in their algorithmic systems. From the book website, readers can find Python code, figures and animations, errata, new publications about day trading with AI, and additional information about the book. End-of-chapter exercises are used throughout the book to reinforce key technical concepts, and the solutions are available in Appendix E at the end of the book for self-checking. The book is a comprehensive hands-on guide to making AI a personal assistant to trading.
Chapter 1: The Fundamentals
Overviews the fundamental knowledge required for day trading with AI. Topics include the financial markets, types of activities in the markets, psychology, modeling and algorithms, and tools and packages to build an AI system for trading.
Chapter 2: Discretionary Trading
Discusses the fundamentals of discretionary trading. It starts with the technological aspects of trading including time windows, static features, and dynamic features, which are pre-requisites of coding an AI system. Commonly used pattern strategies, psychological pitfalls, and risk management methods are also discussed.
Chapter 3: Algorithmic Trading
An introduction to algorithmic trading. With a correctly defined mindset of using algorithmic trading, we start the chapter with regression and classification as the basics of machine learning and deep learning tasks and employ simple gradient descent and normal equation methods to solve sample trading problems. Then, we delve deeper into more complicated machine learning and deep learning algorithms and evaluate their performances. After discussing feature engineering, we proceed with the strategies to build AI and non-AI models.
Chapter 4: Diversified Trading
Establishes the theoretical foundation for day trading with AI by creating a realm of diversified trading that includes stock, model, and time diversification to ensure an edge toward success. Solidly grounded on the finance theories developed by the fathers of modern finance, independent models are developed by extrapolating the Nobel-Prize-winning principles and the cutting-edge large language models to the context of day trading. At the intersection of modern finance theory and data science, a paradox is unveiled so that we strive toward building independent models to tackle the randomness in financial data.