The widespread adoption of AI and machine learning is revolutionizing many industries today. Once these technologies are combined with the programmatic availability of historical and real-time financial data, the financial industry will also change fundamentally. With this practical book, you'll learn how to use AI and machine learning to discover statistical inefficiencies in financial markets and exploit them through algorithmic trading. Author Yves Hilpisch shows practitioners, students, and academics in both finance and data science practical ways to apply machine learning and deep learning algorithms to finance. Thanks to lots of self-contained Python examples, you'll be able to replicate all results and figures presented in the book. In five parts, this guide helps you: • Learn central notions and algorithms from AI, including recent breakthroughs on the way to artificial general intelligence (AGI) and superintelligence (SI) • Understand why data-driven finance, AI, and machine learning will have a lasting impact on financial theory and practice • Apply neural networks and reinforcement learning to discover statistical inefficiencies in financial markets • Identify and exploit economic inefficiencies through backtesting and algorithmic trading--the automated execution of trading strategies • Understand how AI will influence the competitive dynamics in the financial industry and what the potential emergence of a financial singularity might bring about Cover 1 Copyright 4 Table of Contents 5 Preface 11 References 15 Conventions Used in This Book 16 Using Code Examples 17 O’Reilly Online Learning 17 How to Contact Us 18 Acknowledgments 18 Part I. Machine Intelligence 21 Chapter 1. Artificial Intelligence 23 Algorithms 23 Types of Data 24 Types of Learning 24 Types of Tasks 28 Types of Approaches 28 Neural Networks 29 OLS Regression 29 Estimation with Neural Networks 33 Classification with Neural Networks 40 Importance of Data 42 Small Data Set 43 Larger Data Set 46 Big Data 48 Conclusions 49 References 50 Chapter 2. Superintelligence 51 Success Stories 52 Atari 52 Go 58 Chess 60 Importance of Hardware 62 Forms of Intelligence 64 Paths to Superintelligence 65 Networks and Organizations 66 Biological Enhancements 66 Brain-Machine Hybrids 67 Whole Brain Emulation 68 Artificial Intelligence 69 Intelligence Explosion 70 Goals and Control 70 Superintelligence and Goals 71 Superintelligence and Control 73 Potential Outcomes 74 Conclusions 76 References 76 Part II. Finance and Machine Learning 79 Chapter 3. Normative Finance 81 Uncertainty and Risk 82 Definitions 82 Numerical Example 83 Expected Utility Theory 86 Assumptions and Results 86 Numerical Example 89 Mean-Variance Portfolio Theory 92 Assumptions and Results 92 Numerical Example 95 Capital Asset Pricing Model 102 Assumptions and Results 103 Numerical Example 105 Arbitrage Pricing Theory 110 Assumptions and Results 111 Numerical Example 113 Conclusions 115 References 116 Chapter 4. Data-Driven Finance 119 Scientific Method 120 Financial Econometrics and Regression 121 Data Availability 124 Programmatic APIs 125 Structured Historical Data 125 Structured Streaming Data 128 Unstructured Historical Data 130 Unstructured Streaming Data 132 Alternative Data 133 Normative Theories Revisited 137 Expected Utility and Reality 138 Mean-Variance Portfolio Theory 143 Capital Asset Pricing Model 150 Arbitrage Pricing Theory 154 Debunking Central Assumptions 163 Normally Distributed Returns 163 Linear Relationships 173 Conclusions 175 References 176 Python Code 176 Chapter 5. Machine Learning 181 Learning 182 Data 182 Success 185 Capacity 189 Evaluation 192 Bias and Variance 198 Cross-Validation 200 Conclusions 203 References 203 Chapter 6. AI-First Finance 205 Efficient Markets 206 Market Prediction Based on Returns Data 212 Market Prediction with More Features 219 Market Prediction Intraday 224 Conclusions 225 References 227 Part III. Statistical Inefficiencies 229 Chapter 7. Dense Neural Networks 231 The Data 232 Baseline Prediction 234 Normalization 238 Dropout 240 Regularization 242 Bagging 245 Optimizers 247 Conclusions 248 References 248 Chapter 8. Recurrent Neural Networks 249 First Example 250 Second Example 254 Financial Price Series 257 Financial Return Series 260 Financial Features 262 Estimation 263 Classification 264 Deep RNNs 265 Conclusions 266 References 267 Chapter 9. Reinforcement Learning 269 Fundamental Notions 270 OpenAI Gym 271 Monte Carlo Agent 275 Neural Network Agent 277 DQL Agent 280 Simple Finance Gym 284 Better Finance Gym 288 FQL Agent 291 Conclusions 297 References 298 Part IV. Algorithmic Trading 299 Chapter 10. Vectorized Backtesting 301 Backtesting an SMA-Based Strategy 302 Backtesting a Daily DNN-Based Strategy 309 Backtesting an Intraday DNN-Based Strategy 315 Conclusions 321 References 321 Chapter 11. Risk Management 323 Trading Bot 324 Vectorized Backtesting 328 Event-Based Backtesting 331 Assessing Risk 338 Backtesting Risk Measures 342 Stop Loss 344 Trailing Stop Loss 346 Take Profit 348 Conclusions 352 References 352 Python Code 353 Finance Environment 353 Trading Bot 355 Backtesting Base Class 359 Backtesting Class 362 Chapter 12. Execution and Deployment 365 Oanda Account 366 Data Retrieval 367 Order Execution 371 Trading Bot 377 Deployment 384 Conclusions 388 References 389 Python Code 389 Oanda Environment 389 Vectorized Backtesting 392 Oanda Trading Bot 393 Part V. Outlook 397 Chapter 13. AI-Based Competition 399 AI and Finance 400 Lack of Standardization 402 Education and Training 403 Fight for Resources 405 Market Impact 406 Competitive Scenarios 407 Risks, Regulation, and Oversight 408 Conclusions 411 References 412 Chapter 14. Financial Singularity 415 Notions and Definitions 416 What Is at Stake? 416 Paths to Financial Singularity 420 Orthogonal Skills and Resources 421 Scenarios Before and After 422 Star Trek or Star Wars 423 Conclusions 424 References 424 Part VI. Appendixes 425 Appendix A. Interactive Neural Networks 427 Tensors and Tensor Operations 427 Simple Neural Networks 429 Estimation 429 Classification 433 Shallow Neural Networks 437 Estimation 437 Classification 441 References 443 Appendix B. Neural Network Classes 445 Activation Functions 445 Simple Neural Networks 446 Estimation 448 Classification 449 Shallow Neural Networks 451 Estimation 453 Classification 454 Predicting Market Direction 455 Appendix C. Convolutional Neural Networks 459 Features and Labels Data 459 Training the Model 461 Testing the Model 463 Resources 465 Index 467 About the Author 476 Colophon 477 Many industries have been revolutionized by the widespread adoption of AI and machine learning. The programmatic availability of historical and real-time financial data in combination with techniques from AI and machine learning will also change the financial industry in a fundamental way. This practical book explains how to use AI and machine learning to discover statistical inefficiencies in financial markets and exploit them through algorithmic trading. Author Yves Hilpisch shows practitioners, students, and academics in both finance and data science how machine and deep learning algorithms can be applied to finance. Thanks to lots of self-contained Python examples, you'll be able to replicate all results and figures presented in the book. Examine how data is reshaping finance from a theory-driven to a data-driven discipline Understand the major possibilities, consequences, and resulting requirements of AI-first finance Get up to speed on the tools, skills, and major use cases to apply AI in finance yourself Apply neural networks and reinforcement learning to discover statistical inefficiencies in financial markets Delve into the concepts of the technological singularity and the financial singularity La 4ème de couverture indique : "The widespread adoption of AI and machine learning is revolutionizing many industries today. Once these technologies are combined with the programmatic availability of historical and real-time financial data, the financial industry will also change fundamentally. With this practical book, you'll learn how to use AI and machine learning to discover statistical inefficiencies in financial markets and exploit them through algorithmic trading. Author Yves Hilpisch shows practitioners, students, and academics in both finance and data science practical ways to apply machine learning and deep learning algorithms to finance. Thanks to lots of self-contained Python examples, you'll be able to replicate all results and figures presented in the book." With this practical book, practitioners, students, and academics in both finance and data science will learn how to use AI and machine learning to discover statistical inefficiencies in financial markets and exploit them through algorithmic trading.