全部版块 我的主页
› 论坛 › 提问 悬赏 求职 新闻 读书 功能一区 › 经管文库(原现金交易版)
126 0
2026-07-10

2026最新资料,虽然只有230多页,但是内容极其详尽,几乎是手把手的教学金融量化分析的python基本方法、算法、处理流程等等,全部矢量文字,可以用翻译工具直接翻译!

Python is one of the most important programming languages in modern financial institutions. It is widely used for workflow automation, data management,
risk analysis, dashboarding, and other fundamental day-to-day operations. Its
success stems partly from its accessibility to both non-programmers and professional developers. Python emphasises readability and simplicity, making it
suitable even in roles not traditionally associated with writing production code.
For example, it is not uncommon to see quants, data scientists, and even traders
building end-to-end applications or processes in Python to add new functionality or automate repetitive tasks. Python is ideal for shipping high-quality code
quickly.
A key driver, and perhaps also a consequence, of Python’s widespread adoption
is the wealth of open-source libraries, or packages, available to support specific
tasks. In particular, data science and quantitative fields have benefited from fast,
low-level numerical computation tools, advanced statistical modelling libraries,
and even cutting-edge machine learning frameworks being open-sourced. In
recent years, there has also been a trend towards open-sourcing data and crowdsourcing better predictive models via platforms such as Kaggle.com. Once
again, Python is the dominant language in this space. Today, many packages
that demonstrate numerical or statistical techniques also include toy datasets,
which allow practitioners to test ideas and reproduce others’ results with ease.
This REC introduces financial concepts and real-world datasets in the context
of upskilling in Python. It is primarily aimed at finance professionals who wish
to become more hands-on with coding, such as aspiring quants or those already
working with quantitative methods on a regular basis. Another key audience
is junior quants who may have received some training in quantitative finance
and Python but are seeking a deeper, more integrated understanding of how the
two fields intersect, as well as students in quantitative finance looking to apply
their mathematical knowledge to real financial data. That said, we believe the
material will also benefit more senior professionals – especially those with deep
expertise in one area – who are looking to branch out or broaden their knowledge base. Although much of the material in this REC is well established, we
hope that the mix of coding, mathematics, and application will be appealing.
The way the REC is structured is that the first two chapters are pure introductions to Python and the pandas library. The next two chapters introduce
concepts from theoretical finance together with Python code, and the final two
chapters introduce more modern machine learning packages applied to financial data sets. The individual chapters are as follows:
▪ REC1 introduces Python and guides you through your first installation.
▪ REC2 covers pandas and its applications to exploratory data analysis.
▪ REC3 examines stock returns, forecasting, and theoretical models of
asset pricing.
▪ REC4 introduces option pricing and some core numerical techniques
implemented in Python.
▪ REC5 presents machine learning and tree-based methods.
▪ REC6 expands on machine learning, introducing deep learning models via the TensorFlow and Keras packages.
Although there are some benefits to reading the chapters sequentially, it should
be possible to read Chapters 3 to 6 in any order. If you are very new to Python
and quantitative work, we recommend reading Chapters 1 and 2 first.
This REC is written entirely using Jupyter NoteRECs, allowing you to read,
run, and modify the code as you go. Each RECis designed to be interactive,
combining narrative explanation with executable Python code, visualisations,
and real-world financial data. To get the most out of the material, we recommend running and experimenting with the code alongside the text. Throughout
the REC, we use greyed-out notations to represent Python variables or code
snippets. For necessary mathematical notations, we use LaTeX. At times, for
emphasis, we also use italics and bold font. Please note, due to publishing
guidelines, some charts have been modified in post-production to improve readability. Specifically different colours, linestyles, and markers may be used.
Our approach to presenting material for this REC has been to sacrifice some
academic rigour in favour of a more instructional approach. Most of the REC
is composed of material that has formed the backbone of our own teaching and
mentoring over the years. The motivation for bringing it all together was partly
to make our notes more widely available, as well as partly that we had not found
the different topics similarly consolidated elsewhere.
We would like to thank the reader for having the curiosity to take up our REC.
We have spent many hours using and researching the code and techniques
collected here, and we sincerely hope that it will be useful. We thank Levent
Menguturk and Leo Schaabner for helpful suggestions for content. We would
also like to thank Amanda Yun and Poornima Harikrishnan at World Scientific
Publishing for the valuable proofreading of the REC, which surfaced many corrections. In addition, we would like to thank our colleagues, students, and family, in particular, Karla and Arthur, and Loulou, for their support during writing
(and rewriting).
REC1 Introduction to Python.....1
1.1 Introduction 1
1.2 Python .. 1
1.2.1 Installing Python Locally and Launching a
Jupyter NoteREC .... 2
1.2.2 Cells  3
1.2.3 Markdown and Code Cells in Jupyter NoteREC .... 4
1.2.4 The Kernel... 5
1.2.5 Check Python Version... 5
1.2.6 Installing Python Packages. 7
1.3 A Note on Printing to Screen... 7
1.4 Basic Python Operations and Data Types.. 8
1.4.1 int and float .. 8
1.4.2 Arithmetic with int and float 9
1.4.3 Readable Large Numbers with Underscores... 10
1.4.4 string  10
1.4.5 Multiline strings. 11
1.4.6 bool .... 11
1.4.7 None .... 12
1.4.8 Type Conversion.... 12
1.5 Logical Operators  13
1.5.1 The is Keyword.... 15
1.6 Data Structures..... 16
1.6.1 list..... 16
1.6.2 Slicing a list.. 17
1.6.3 Modifying a list.. 17
1.6.4 Searching a list... 18
1.6.5 tuple... 18
1.6.6 set  19
1.6.7 dict..... 21
1.7 Aliasing.... 22
1.7.1 Shallow Copies 23
1.7.2 Deep Copies.... 25
1.8 Loops.. 26
1.8.1 for  26
1.8.2 Scope of the Loop Variable..... 27
1.8.3 Using enumerate.. 27
1.8.4 Looping over Multiple Collections with zip .. 27
1.8.5 while .. 28
1.8.6 Infinite Loops and break . 28
1.8.7 Skipping Loop Iterations with continue . 29
1.8.8 list Comprehension... 29
1.8.9 Why Use Comprehensions?..... 30
1.9 Conditional Expressions... 31
1.9.1 Inline if–else 31
1.10 Functions.. 32
1.10.1 Example: Summing Integers from 1 to n.. 33
1.10.2 Alternative Implementations... 34
1.10.3 Positional versus Keyword Arguments ..... 34
1.10.4 Variable-Length Arguments.... 35
1.10.5 Inspecting Python Bytecode with dis  36
1.11 Exceptions ... 37
1.11.1 Handling Errors with try and except ..... 37
1.11.2 Catching Generic Exceptions ..... 38
1.11.3 Raising Exceptions Intentionally... 38
1.12 RECSummary  38
1.13 Further Reading ... 39
1.14 Exercises .. 39
REC2 Introduction to Pandas...41
2.1 Introduction.... 41
2.2 pandas and DataFrames. 41
2.2.1 Displaying DataFrames.... 42
2.2.2 Empty DataFrames..... 43
2.2.3 Accessing DataFrame Values.44
2.2.4 Using values .. 47
2.2.5 Using reset_index.... 48
REC3 Introduction to Modelling Asset Returns...81
3.1 Introduction.... 81
3.2 The S&P 500.. 81
3.3 Plotting and matplotlib. 82
3.4 Risk Diversification ... 85
3.4.1 Quantifying Diversification .... 86
3.5 Stationarity..... 90
3.5.1 Log Returns as a Stationary Alternative ... 91
3.5.2 The Dickey–Fuller Test..... 93
3.6 Ordinary Least Squares for Forecasting Returns. 94
3.7 Autocorrelation .... 97
3.8 ARIMA Model..... 99
3.8.1 Sanity Check: ARIMA(1, 0, 0) as Linear
Regression ..... 100
3.8.2 Selecting Optimal ARIMA Parameters.. 101
3.8.3 Forecasting Returns .. 102
3.9 The Efficient Markets Hypothesis ... 102
3.10 Excess Returns... 103
3.11 Capital Asset Pricing Model  106
3.11.1 Empirical Test of CAPM. 106
3.11.2 Rolling Regression to Estimate Portfolio Betas.. 108
3.11.3 CAPM Prediction versus Reality .110
3.11.4 Interpretation of CAPM Results...111
3.12 Fama and French.112
3.12.1 Accessing Fama–French Data113
3.12.2 Estimating Fama–French Parameters 114
3.12.3 Visualising the Results.....115
3.12.4 Interpretation..117
3.13 Testing Factor Exposures of ETFs ....118
3.13.1 Concluding Remarks on Fama–French ....119
3.14 RECSummary .....119
3.15 Further Reading . 120
3.16 Exercises  120
REC4 Introduction to Option Pricing123
4.1 Introduction.. 123
4.2 Options... 123
4.3 Introduction to numpy .... 124
4.3.1 Common numpy Functions.... 126
4.3.2 Operations with ndarrays.... 128
4.4 Introduction to scipy..... 130
4.4.1 Numerical Optimisation.. 132
4.5 Introduction to Black–Scholes ... 135
4.5.1 Setting Up Black–Scholes..... 136
4.5.2 Asset-Price Dynamics..... 136
4.5.3 Itô’s Lemma for Option Pricing .. 137
4.5.4 Closed-Form Solution for a European Call... 137
4.6 Pricing via Closed-Form Formula in Python..... 138
4.7 Pricing by Integration .... 142
4.7.1 Pricing a Knock-Out Barrier Option. 144
4.8 Pricing by Monte Carlo Simulation . 146
4.8.1 Pricing a European Call Option via Simulation.. 149
4.8.2 Using Antithetic Variates 150
4.8.3 Pricing an Asian Option.. 151
4.9 Pricing by Finite Difference. 153
4.9.1 Setting up the Finite Difference Grid 153
4.9.2 Approximating the Derivatives... 154
4.9.3 Deriving the Update Rule 154
4.9.4 Finite-Difference Implementation in Python  154
4.9.5 American Put Options..... 160
4.10 Unit Testing.. 164
4.11 Implied Volatility ..... 165
4.12 Delta Hedging .... 166
4.12.1 Delta-Hedging Strategy... 168
4.13 RECSummary .... 169
4.14 Further Reading . 169
4.15 Exercises  170
REC5 Decision Models 171
5.1 Introduction...171
5.2 Introduction to Classification171
5.2.1 Case Study: German Credit Data 172
5.2.2 Imbalanced Data ..174
5.2.3 Undersampling the Majority Class.....175
5.2.4 Oversampling the Minority Class175
5.3 Exploratory Data Analysis....176
5.3.1 Comparing Feature Distributions.176
5.3.2 Correlation Analysis...178
5.4 Introduction to Decision Trees... 179
5.5 Training a Decision Tree to Data 181
5.5.1 Entropy and Information Gain.....181
5.5.2 Building the Tree. 182
5.5.3 Encoding Non-Numeric Data 183
5.5.4 One-Hot Encoding .... 183
5.5.5 Applying One-Hot Encoding in Pandas.. 183
5.5.6 Fitting a Decision Tree to German Credit Data .. 184
5.5.7 Train-Test Split .... 184
5.5.8 Fitting the Tree.... 185
5.5.9 Reducing Overfitting. 186
5.5.10 Visualising the Tree .. 187
5.6 Cross-Validation. 188
5.6.1 Retrain with Best Parameters 190
5.7 Random Forests.. 191
5.8 Boosted Trees..... 193
5.8.1 How Boosted Trees Work ..... 193
5.8.2 Training an XGBoost Classifier.. 195
5.8.3 Custom Objective Functions . 196
5.8.4 Regularisation and Cross-Validation. 197
5.8.5 Regularisation in XGBoost ... 198
5.8.6 Grid Search with Regularisation. 199
5.8.7 Final Model Evaluation... 199
5.9 Early Stopping....200
5.9.1 Early Stopping: Manual Example .....200
5.9.2 Early Stopping with Cross-Validation ..... 201
5.10 Feature Importance ..204
5.10.1 Feature Importance by Split Frequency .. 205
5.10.2 Visualising Feature Importance..206
5.11 RECSummary .... 207
5.12 Further Reading . 207
5.13 Exercises  207
REC6 Keras and Neural Networks ....209
6.1 Introduction.. 209
6.2 Introduction to Neural Networks ..... 209
6.3 Activation Functions  212
6.3.1 Rectified Linear Unit  212
6.3.2 Leaky ReLU.. 212
6.3.3 Sigmoid ... 213
6.3.4 Tanh... 213
6.3.5 Activation Functions in Python... 213
6.4 Neural Networks with TensorFlow and Keras... 215
6.4.1 TensorFlow Implementation.. 215
6.4.2 Keras Implementation ..... 219
6.4.3 How Does Backpropagation Work? .. 220
6.4.4 Setting Up the Neural Network... 221
6.4.5 The Backpropagation Algorithm. 221
6.4.6 Implementing Backpropagation in Python.... 223
6.5 A Note on Activation Functions. 224
6.6 The batch_size Parameter in keras ... 227
6.7 Note on model.fit .. 229
6.8 Time Series Prediction with Neural Networks... 231
6.9 Cross-Validation Through Time. 236
6.9.1 Retraining and Final Evaluation .240
6.10 When Does a Neural Network Outperform? 241
6.11 Examples of Regularisation . 245
6.11.1 Regularisation: Dropout.246
6.11.2 Regularisation: EarlyStopping . 248
6.12 Recurrent Neural Networks . 250
6.12.1 Implementing RNNs in Keras..... 253
6.12.2 Generating Simulated Data with Long-Term
Memory... 254
6.12.3 Training an RNN Model. 255
6.12.4 Using stateful=True in RNNs. 255
6.13 RECSummary .... 257
6.14 Further Reading . 257
6.15 Exercises  258
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群