책 이미지

책 정보
· 분류 : 외국도서 > 경제경영 > 금융/재정 > 금융공학
· ISBN : 9781119404750
· 쪽수 : 640쪽
· 출판일 : 2019-12-31
목차
I Language Fundamentals 1
1 Fundamentals of the q Programming Language 2
1.1 The (Not So Very) First Steps in q 2
1.2 Atoms and Lists 4
1.2.1 Casting Types 9
1.3 Basic Language Constructs 12
1.3.1 Assigning, Equality and Matching 12
1.3.2 Arithmetic Operations and Right-to-Left Evaluation: Introduction to q Philosophy 14
1.4 Basic Operators 16
1.5 Difference Between Strings and Symbols 26
1.5.1 Enumeration 27
1.6 Matrices and Basic Linear Algebra in q 28
1.7 Launching the Session: Additional Options 31
1.8 Summary and How-Tos 33
2 Dictionaries and Tables: The q Fundamentals 35
2.1 Dictionary 35
2.2 Table 37
2.3 The Truth about Tables 41
2.4 Keyed Tables Are Dictionaries 43
2.5 From a Vector Language to an Algebraic Language 44
3 Functions 48
3.1 Namespace 50
3.1.0.1 .quantQ. Namespace 51
3.2 The Six Adverbs 51
3.2.1 Each 51
3.2.1.1 Each 52
3.2.1.2 Each-left \: 52
3.2.1.3 Each-right /: 53
3.2.1.4 Cross product /:\: 53
3.2.1.5 Each-both ' 54
3.2.2 Each-prior ': 56
3.2.3 Compose (’) 57
3.2.4 Over and Fold / 57
3.2.5 Scan 58
3.2.5.1 EMA: The Exponential Moving Average 59
3.2.6 Converge 60
3.2.6.1 Converge-repeat 60
3.2.6.2 Converge-iterate 61
3.3 Apply 62
3.3.1 @ (apply) 62
3.3.2 (apply) 62
3.4 Protected Evaluations 64
3.5 Vector Operations 65
3.5.1 Aggregators 66
3.5.1.1 Simple Aggregators 66
3.5.1.2 Weighted Aggregators 66
3.5.2 Uniform Functions 67
3.5.2.1 Running Functions 67
3.5.2.2 Window Functions 67
3.6 Convention for User-Defined Functions 68
4 Editors and Other Tools 69
4.1 Console 69
4.2 Jupyter Notebook 70
4.3 GUIs 72
4.3.1 qStudio 73
4.3.2 Q Insight Pad 75
4.4 IDEs: IntelliJ IDEA 77
4.5 Conclusion 78
5 Debugging q Code 80
5.1 Introduction to Making It Wrong: Errors 80
5.1.1 Syntax Errors 81
5.1.2 Runtime Errors 81
5.1.2.1 The type error 82
5.1.2.2 Other Errors 84
5.2 Debugging the Code 86
5.3 Debugging Server-Side 88
II Data Operations 90
6 Splayed and Partitioned Tables 91
6.1 Introduction 91
6.2 Splayed Tables 93
6.3 Partitioned Tables 96
6.4 Conclusion 102
7 Joins 104
7.1 Comma operator 104
7.2 Join Functions 107
7.2.1 ij 107
7.2.2 ej 108
7.2.3 lj 109
7.2.4 pj 109
7.2.5 upsert 110
7.2.6 uj 111
7.2.7 aj 113
7.2.8 aj0 115
7.2.8.1 The next valid join 116
7.2.9 asof 119
7.2.10 wj 120
7.3 Advanced Example: Running TWAP 124
8 Parallelisation 130
8.1 Parallel Vector Operations 131
8.2 Parallelisation over Processes 133
8.3 Map Reduce 134
8.4 Advanced Topic: Parallel File/Directory Access 136
9 Data Cleaning and Filtering 139
9.1 Predicate Filtering 139
9.1.0.1 The where clause 139
9.1.0.2 Aggregation Filtering 141
9.2 Data Cleaning, Normalising and APIs 141
10 Parse Trees 143
10.1 Definition 144
10.1.1 Evaluation 144
10.1.2 Parse Tree Creation 147
10.1.3 Read-Only Evaluation 148
10.2 Functional Queries 148
10.2.1 Functional Select 151
10.2.2 Functional Exec 154
10.2.3 Functional Update 155
10.2.4 Functional Delete 156
11 A Few Use Cases 158
11.1 Rolling VWAP 158
11.1.1 N Tick VWAP 158
11.1.2 Time Window VWAP 159
11.2 Weighted Mid for N Levels of an Orderbook 160
11.3 Consecutive Runs of a Rule 161
11.4 Real-time Signals and Alerts 162
III Data Science 165
12 Basic Overview of Statistics 166
12.1 Histogram 166
12.2 First Moments 170
12.3 Testing Hypothesis 172
12.3.1 Normal p-values 172
12.3.2 Correlation 174
12.3.2.1 Implementation 175
12.3.3 t-test: One-sample 176
12.3.3.1 Implementation 177
12.3.4 t-test: Two-sample 178
12.3.4.1 Implementation 179
12.3.5 Sign Test 179
12.3.5.1 Implementation of the test 181
12.3.5.2 Median Test 184
12.3.6 Wilcoxon Signed-Rank Test 185
12.3.7 Rank Correlation and Somers’ D 187
12.3.7.1 Implementation 188
12.3.8 Multiple Hypothesis Testing 192
12.3.8.1 Bonferroni Correction 195
12.3.8.2 Šidák’s Correction 196
12.3.8.3 Holm’s Method 196
12.3.8.4 Example 197
13 Linear Regression 199
13.1 Linear Regression 200
13.2 Ordinary Least Squares 201
13.3 The Geometric Representation of Linear Regression 204
13.3.1 Moore–Penrose Pseudoinverse 205
13.3.2 Adding Intercept 207
13.4 Implementation of the OLS 210
13.5 Significance of Parameters 212
13.6 How Good is the Fit: R2 213
13.6.1 Adjusted R-squared 216
13.7 Relationship with Maximum Likelihood Estimation and AIC with Small Sample Correction 217
13.8 Estimation Suite 220
13.9 Comparing Two Nested Models: Towards a Stopping Rule 222
13.9.1 Comparing Two General Models 224
13.10 In/Out of Sample Operations 224
13.11Cross-validation 229
13.12 Conclusion 230
14 Time Series Econometrics 231
14.1 Autoregressive and Moving Average Processes 231
14.1.1 Introduction 231
14.1.2 AR(p) process 232
14.1.2.1 Simulation 232
14.1.2.2 Estimation of AR(p) Parameters 233
14.1.2.3 Least Square Method 234
14.1.2.4 Example 235
14.1.2.5 Maximum Likelihood Estimator 235
14.1.2.6 Yule-Walker Technique 235
14.1.3 MA(q) Process 237
14.1.3.1 Estimation of MA(q) Parameters 237
14.1.3.2 Simulation 238
14.1.3.3 Example 238
14.1.4 ARMA(p, q) Process 239
14.1.4.1 Invertibility of the ARMA(p, q) Process 239
14.1.4.2 Hannan-Rissanen Algorithm : Two-step Regression Estimation 240
14.1.4.3 Yule-Walker Estimation 240
14.1.4.4 Maximum Likelihood Estimation 240
14.1.4.5 Simulation 240
14.1.4.6 Forecast 241
14.1.5 ARIMA(p, d, q) Process 241
14.1.6 Code 242
14.1.6.1 Simulation 242
14.1.6.2 Estimation 243
14.1.6.3 Forecast 246
14.2 Stationarity and Granger Causality 249
14.2.1 Stationarity 249
14.2.2 Test of Stationarity - Dickey Fuller and Augmented Dickey Fuller tests 249
14.2.3 Granger Causality 250
14.3 Vector Autoregression 251
14.3.1 VAR(p) process 251
14.3.1.1 Notation 251
14.3.1.2 Estimator 252
14.3.1.3 Example 253
14.3.1.4 Code 256
14.3.2 VARX(p, q) process 259
14.3.2.1 Estimator 260
14.3.2.2 Code 260
15 Fourier Transform 262
15.1 Complex Numbers 262
15.1.1 Properties of Complex Numbers 263
15.2 Discrete Fourier Transform 269
15.3 Addendum: Quaternions 274
15.4 Addendum: Fractals 281
16 Eigensystem and PCA 284
16.1 Theory 284
16.2 Algorithms 286
16.2.1 QR Decomposition 287
16.2.2 QR Algorithm for Eigenvalues 289
16.2.3 Inverse Iteration 290
16.3 Implementation of Eigensystem Calculation 291
16.3.1 QR Decomposition 292
16.3.2 Inverse Iteration 296
16.4 The Data Matrix and the Principal Component Analysis 299
16.4.1 The Data Matrix 299
16.4.2 PCA: The First Principal Component 301
16.4.3 Second Principal Component 303
16.4.4 Terminology and Explained Variance 304
16.4.5 Dimensionality Reduction 306
16.4.6 PCA Regression (PCR) 307
16.5 Implementation of PCA 307
16.6 Appendix: Determinant 310
16.6.1 Theory 310
16.6.2 Techniques to Calculate Determinant 311
16.6.3 Implementation of the Determinant 312
17 Outlier Detection 315
17.1 Local Outlier Factor 316
18 Simulating Asset Prices 324
18.1 Stochastic Volatility Process with Price Jumps 324
18.2 Towards the Numerical Example 325
18.2.1 Numerical Preliminaries 326
18.2.2 Implementing Stochastic Volatility Process with Jumps 329
18.3 Conclusion 332
IV Machine Learning 333
19 Basic Principles of Machine Learning 334
19.1 Non-numeric Features and Normalisation 334
19.1.1 Non-numeric Features 334
19.1.1.1 Ordinal Features 335
19.1.1.2 Categorical Features 336
19.1.2 Normalisation 336
19.1.2.1 Normal Score 337
19.1.2.2 Range Scaling 338
19.2 Iteration: Constructing Machine Learning Algorithms 338
19.2.1 Iteration 338
19.2.2 Constructing Machine Learning Algorithms 341
20 Linear Regression with Regularisation 343
20.1 Bias-Variance Trade-off 343
20.2 Regularisation 345
20.3 Ridge Regression 346
20.4 Implementation of the Ridge Regression 348
20.4.1 Optimisation of the Regularisation Parameter 352
20.5 Lasso Regression 354
20.6 Implementation of the Lasso Regression 356
21 Nearest Neighbours 368
21.1 k-Nearest Neighbours Classifier 368
21.2 Prototype Clustering 372
21.3 Feature Selection: local Nearest Neighbours approach 377
21.3.0.1 Implementation 378
22 Neural Networks 384
22.1 Theoretical Introduction 384
22.1.1 Calibration 386
22.1.1.1 Backpropagation 387
22.1.2 The Learning Rate Parameter 389
22.1.3 Initialisation 390
22.1.4 Overfitting 390
22.1.5 Dimension of the Hidden Layer(s) 391
22.2 Implementation of Neural Networks 391
22.2.1 Multivariate Encoder 392
22.2.2 Neurons 393
22.2.3 Training the Neural Network 394
22.3 Examples 396
22.3.1 Binary Classification 396
22.3.2 M-class Classification 399
22.3.3 Regression 402
22.4 Possible Suggestions 407
23 AdaBoost with Stumps 408
23.1 Boosting 408
23.2 Decision Stumps 409
23.3 AdaBoost 410
23.4 Implementation of AdaBoost 411
23.5 Recommendation for Readers 417
24 Trees 418
24.1 Introduction to Trees 418
24.2 Regression Trees 420
24.2.1 Cost-Complexity Pruning 422
24.3 Classification Tree 423
24.4 Miscellaneous 425
24.5 Implementation of Trees 426
25 Forests 433
25.1 Bootstrap 433
25.2 Bagging 436
25.2.1 Out-of-bag 437
25.3 Implementation 438
25.3.1 Prediction 440
25.3.2 Feature Selection 442
26 Unsupervised Machine Learning: The Apriori Algorithm 445
26.1 Apriori Algorithm 446
26.2 Implementation of the Apriori Algorithm 447
27 Processing Information 456
27.1 Information Retrieval 456
27.1.1 Corpus: Leonardo da Vinci 456
27.1.2 Frequency Counting 457
27.1.3 tf-idf 461
27.2 Information as Features 465
27.2.1 Sample: Simulated Proteins 465
27.2.2 Kernels and Metrics for Proteins 466
27.2.3 Implementation of Inner Products and Nearest Neighbours Principles 467
27.2.4 Further Topics 470
28 Towards AI – Monte Carlo Tree Search 472
28.1 Multi-armed Bandit Problem 472
28.1.1 Analytic Solutions 474
28.1.2 Greedy algorithms 474
28.1.3 Confidence Based Algorithms 475
28.1.4 Bayesian Algorithms 476
28.1.5 Online Gradient Descent Algorithms 478
28.1.6 Implementation of Some Learning Algorithms 478
28.2 Monte Carlo Tree Search 487
28.2.1 Selection step 491
28.2.2 Expansion step 492
28.2.3 Simulation step 492
28.2.4 Back propagation step 493
28.2.5 Finishing the algorithm 493
28.2.6 Remarks and extensions 494
28.3 Monte Carlo Tree Search Implementation – Tic-tac-toe 495
28.3.1 Random Games 496
28.3.2 Towards the MCTS 499
28.3.3 Case Study 506
28.4 Monte Carlo Tree Search – Additional Comments 507
28.4.1 Policy and Value Networks 507
28.4.2 Reinforcement Learning 509
29 Econophysics: The Agent-Based Computational Models 510
29.1 Agent-based Modelling 511
29.1.1 Agent-based Models in Society 511
29.1.2 Agent-based Models in Finance 513
29.2 Ising Agent-Based Model for Financial Markets 514
29.2.1 Ising Model in Physics 514
29.2.2 Ising Model of Interacting Agents 514
29.2.3 Numerical Implementation 515
29.3 Conclusion 518
30 Epilogue: Art 520
Index 524
Bibliography 534