Python for Finance cover

Python for Finance

Rating 3.2
Word count
249K words
Chapters
12
Series
Asynchronous Books · Fintech Series
ISBN
9787115457073

Tags

Summary

Python for Finance, originally titled Python for Finance, is written by finance professor Yuxing Yan, with the Chinese edition translated by Zhang Shaojun in collaboration with the author. The book has 12 chapters and is positioned as "a hands-on Python primer written by a finance professor": it teaches both programming and the reasoning behind financial models. The opening chapters start from zero: how to install Python, choose between versions, run programs via a GUI, command line, or DOS window, assign variables and perform basic math, use the math module, and work with data types such as tuples and lists. Chapter 3 applies the syntax to financial scenarios, guiding readers to hand-build a financial calculator that implements functions for present value, annuities, interest-rate conversion, continuous compounding, net present value, payback period, and internal rate of return, while learning to create custom modules, add comments, and debug. Chapter 4 uses a complete program to calculate a call option price, demonstrating engineering habits such as the "empty-shell method" and the "commenting method." The second half moves into core tools and models: Chapters 5 through 7 introduce modules, NumPy and SciPy (matrix operations, linear regression, CAPM, interpolation, random-number seeds, and more), and matplotlib plotting (cash-flow curves, diversification effects, candlestick charts, price-volume charts); Chapter 8 uses pandas and statsmodels for time series, pulling data from multiple sources such as Yahoo Finance, Excel, CSV, and web pages, calculating daily/monthly/annual returns, and performing t-tests, Fama-French three-factor regressions, Fama-MacBeth regressions, value at risk, and the efficient portfolio frontier; Chapters 9 through 12 cover Black-Scholes-Merton option pricing and the Greeks, the binomial method, iterative solving for implied volatility, Monte Carlo simulation and exotic options (average-price, barrier, lookback), and close with volatility, ARCH/GARCH, and GJR-GARCH models. Each chapter includes a summary and exercises, with dense code examples and accompanying datasets. The Chinese edition corresponds to the first English edition, and some data interfaces (such as Yahoo Finance) no longer work, so readers must substitute data sources when working through the code.

Editor's review

市面上的“Python + 金融”书大致分两类:一类是编程书顺手讲几个金融例子,一类是金融书把代码当装饰。这本属于少见的第三条路——作者严玉星是麦吉尔大学金融学博士,在加拿大、新加坡、美国的八所大学讲授过金融建模、期权与期货、投资组合理论,他写书时把“为什么这样算”和“代码怎样写”绑在一起讲。 也因此,它更像一本可以照着敲的课程讲义:从安装 Python 这种零基础问题讲起,一路推到 Black-Scholes-Merton、蒙特卡罗和 GARCH。中间那些“用 Python 写个金融计算器”“用空壳法先搭框架再填代码”“比较 import math 与 from math import *”的细节,是老程序员才有的习惯,学院派教材里往往看不到。第 8 章的时间序列部分尤其厚实,数据从雅虎财经、Excel、CSV、网页、MATLAB 文件多路进来,再算回报率、做 Fama-French 三因子、画有效边界,几乎是一份量化研究的最小工作流。 需要提醒的是:中文版依据的是 2017 年的英文第一版,使用 Python 3 但未涉及现代生态中更常用的 yfinance、pandas 新版 API,示例里抓取雅虎财经数据的代码基本跑不通,需要读者自行更换数据源。豆瓣评分 6.5,评价集中在“技术内容多、金融理论少”“实例实用但偏旧”。如果你要的是现成能跑的量化框架,这不是首选;但若想弄懂期权定价公式怎么落地成代码,它依然值得放在案头。

Who it's for

A good fit for

  • 金融、会计、经济类专业的高校师生,想用 Python 完成课程作业与建模练习
  • 有 Python 基础、想转向量化研究或金融数据分析方向的程序员
  • 金融从业人员,需要亲手实现期权定价、波动率与投资组合模型
  • 准备 FRM、CFA 等考试中数量方法部分、希望代码辅助理解的考生

Not a good fit for

  • 完全零编程基础且不愿边读边动手敲代码的读者
  • 想直接获取可上线交易的量化策略框架与回测系统的从业者
  • 只关注机器学习选股、深度学习高频策略等前沿方法的读者

Reading tips

  1. 按章节顺序敲代码,第 1 至第 4 章务必亲手完成,它们是后面所有模型的地基
  2. 在 Anaconda 环境中配置好 NumPy、SciPy、pandas、matplotlib、statsmodels,可避免安装环节卡壳
  3. 书中抓取雅虎财经数据的示例已失效,建议改用 yfinance 或本地 CSV 数据替代
  4. 第 8 章信息密度最高,可配合《利用 Python 进行数据分析》交叉阅读以补足 pandas 细节

About the publisher

Posts & Telecom Press China · Founded in 1953

Posts & Telecom Press is known for its strengths in science and technology, computing, and information and communications titles, and has extended its publishing into photography, art, software learning, and inspirational growth, giving it a fairly diverse range. Its catalog includes computing and communications works such as Refactoring and Patterns (Revised Edition) and Huawei Switch Learning Guide (Second Edition), alongside bilingual collector's editions such as The Little Prince (Chinese-English-French illustrated collector's edition), The Great Gatsby, and Three Days to See. Beijing Ten Years: 1980-1990 and Ghost Blade: WLOP Personal Illustration Collection reflect its presence in photography and art. Its authors include Antoine de Saint-Exupéry, Helen Keller, Joshua Kerievsky, Wang Da, Zhang Zhaozeng, and WLOP.

Contents

  1. Chapter 1 Introduction to Python and Installation
  2. Chapter 2 Using Python as an Ordinary Calculator
  3. Chapter 3 Writing a Financial Calculator in Python
  4. Chapter 4 Writing Python Programs to Calculate Call Option Prices
  5. Chapter 5 Introduction to Modules
  6. Chapter 6 Introduction to NumPy and SciPy
  7. Chapter 7 Plotting Finance-Related Graphs with matplotlib
  8. Chapter 8 Statistical Analysis of Time Series
  9. Chapter 9 The Black-Scholes-Merton Option Pricing Model
  10. Chapter 10 Python Loops and Calculating Implied Volatility
  11. Chapter 11 Monte Carlo Simulation and Option Pricing
  12. Chapter 12 Volatility and GARCH Models

FAQ

这本书和《Python金融大数据分析》有什么区别?
两者路线不同。希尔皮斯科那本偏工具与衍生品定价的工程实现,代码更现代、篇幅更大;本书由金融学教授撰写,从 Python 语法和金融计算器起步,更强调模型推导与教学节奏,适合当作入门到中阶的课程式读物。
零基础可以读吗?需要什么数学基础?
编程部分从安装和变量赋值讲起,零基础可以跟;但第 9 章之后的期权定价与 GARCH 涉及正态分布、随机过程与计量经济学,最好具备微积分、概率统计和基础金融学知识,否则容易只抄代码不解其意。
书中的代码现在还能运行吗?
核心的 NumPy、SciPy、matplotlib、statsmodels 示例思路仍然适用,但中文版对应英文第一版,抓取雅虎财经数据的接口早已关闭,部分 pandas 写法也已过时,需要读者改用 yfinance 等新数据源,并按新版库调整 API。
属于哪个丛书系列?是第几版?
中文版由人民邮电出版社出版,归入异步图书·金融科技系列,ISBN 978-7-115-45707-3,共 320 页。它对应英文 Python for Finance 的第一版;英文第二版已由 Packt 更新,但中译本未跟进。

Comments

Find this book

This site is an index: you start “Search all sources” in your browser, and the entries it lists all point to third-party sites; please judge their availability yourself.

More by the same author

Top rated in the same category