
Python for Finance
Description
Alles über E-Books | Antworten auf Fragen rund um E-Books, Kopierschutz und Dateiformate finden Sie in unserem Info- & Hilfebereich.
The financial industry has recently adopted Python at a tremendous rate, with some of the largest investment banks and hedge funds using it to build core trading and risk management systems. Updated for Python 3, the second edition of this hands-on book helps you get started with the language, guiding developers and quantitative analysts through Python libraries and tools for building financial applications and interactive financial analytics.
Using practical examples throughout the book, author Yves Hilpisch also shows you how to develop a full-fledged framework for Monte Carlo simulation-based derivatives and risk analytics, based on a large, realistic case study. Much of the book uses interactive IPython Notebooks.
More details
Other editions
Additional editions

Content
- Cover
- Copyright
- Table of Contents
- Preface
- Conventions Used in This Book
- Using Code Examples
- O'Reilly Online Learning
- How to Contact Us
- Acknowledgments
- Part I. Python and Finance
- Chapter 1. Why Python for Finance
- The Python Programming Language
- A Brief History of Python
- The Python Ecosystem
- The Python User Spectrum
- The Scientific Stack
- Technology in Finance
- Technology Spending
- Technology as Enabler
- Technology and Talent as Barriers to Entry
- Ever-Increasing Speeds, Frequencies, and Data Volumes
- The Rise of Real-Time Analytics
- Python for Finance
- Finance and Python Syntax
- Efficiency and Productivity Through Python
- From Prototyping to Production
- Data-Driven and AI-First Finance
- Data-Driven Finance
- AI-First Finance
- Conclusion
- Further Resources
- Chapter 2. Python Infrastructure
- conda as a Package Manager
- Installing Miniconda
- Basic Operations with conda
- conda as a Virtual Environment Manager
- Using Docker Containers
- Docker Images and Containers
- Building an Ubuntu and Python Docker Image
- Using Cloud Instances
- RSA Public and Private Keys
- Jupyter Notebook Configuration File
- Installation Script for Python and Jupyter Notebook
- Script to Orchestrate the Droplet Setup
- Conclusion
- Further Resources
- Part II. Mastering the Basics
- Chapter 3. Data Types and Structures
- Basic Data Types
- Integers
- Floats
- Booleans
- Strings
- Excursion: Printing and String Replacements
- Excursion: Regular Expressions
- Basic Data Structures
- Tuples
- Lists
- Excursion: Control Structures
- Excursion: Functional Programming
- Dicts
- Sets
- Conclusion
- Further Resources
- Chapter 4. Numerical Computing with NumPy
- Arrays of Data
- Arrays with Python Lists
- The Python array Class
- Regular NumPy Arrays
- The Basics
- Multiple Dimensions
- Metainformation
- Reshaping and Resizing
- Boolean Arrays
- Speed Comparison
- Structured NumPy Arrays
- Vectorization of Code
- Basic Vectorization
- Memory Layout
- Conclusion
- Further Resources
- Chapter 5. Data Analysis with pandas
- The DataFrame Class
- First Steps with the DataFrame Class
- Second Steps with the DataFrame Class
- Basic Analytics
- Basic Visualization
- The Series Class
- GroupBy Operations
- Complex Selection
- Concatenation, Joining, and Merging
- Concatenation
- Joining
- Merging
- Performance Aspects
- Conclusion
- Further Reading
- Chapter 6. Object-Oriented Programming
- A Look at Python Objects
- int
- list
- ndarray
- DataFrame
- Basics of Python Classes
- Python Data Model
- The Vector Class
- Conclusion
- Further Resources
- Part III. Financial Data Science
- Chapter 7. Data Visualization
- Static 2D Plotting
- One-Dimensional Data Sets
- Two-Dimensional Data Sets
- Other Plot Styles
- Static 3D Plotting
- Interactive 2D Plotting
- Basic Plots
- Financial Plots
- Conclusion
- Further Resources
- Chapter 8. Financial Time Series
- Financial Data
- Data Import
- Summary Statistics
- Changes over Time
- Resampling
- Rolling Statistics
- An Overview
- A Technical Analysis Example
- Correlation Analysis
- The Data
- Logarithmic Returns
- OLS Regression
- Correlation
- High-Frequency Data
- Conclusion
- Further Resources
- Chapter 9. Input/Output Operations
- Basic I/O with Python
- Writing Objects to Disk
- Reading and Writing Text Files
- Working with SQL Databases
- Writing and Reading NumPy Arrays
- I/O with pandas
- Working with SQL Databases
- From SQL to pandas
- Working with CSV Files
- Working with Excel Files
- I/O with PyTables
- Working with Tables
- Working with Compressed Tables
- Working with Arrays
- Out-of-Memory Computations
- I/O with TsTables
- Sample Data
- Data Storage
- Data Retrieval
- Conclusion
- Further Resources
- Chapter 10. Performance Python
- Loops
- Python
- NumPy
- Numba
- Cython
- Algorithms
- Prime Numbers
- Fibonacci Numbers
- The Number Pi
- Binomial Trees
- Python
- NumPy
- Numba
- Cython
- Monte Carlo Simulation
- Python
- NumPy
- Numba
- Cython
- Multiprocessing
- Recursive pandas Algorithm
- Python
- Numba
- Cython
- Conclusion
- Further Resources
- Chapter 11. Mathematical Tools
- Approximation
- Regression
- Interpolation
- Convex Optimization
- Global Optimization
- Local Optimization
- Constrained Optimization
- Integration
- Numerical Integration
- Integration by Simulation
- Symbolic Computation
- Basics
- Equations
- Integration and Differentiation
- Differentiation
- Conclusion
- Further Resources
- Chapter 12. Stochastics
- Random Numbers
- Simulation
- Random Variables
- Stochastic Processes
- Variance Reduction
- Valuation
- European Options
- American Options
- Risk Measures
- Value-at-Risk
- Credit Valuation Adjustments
- Python Script
- Conclusion
- Further Resources
- Chapter 13. Statistics
- Normality Tests
- Benchmark Case
- Real-World Data
- Portfolio Optimization
- The Data
- The Basic Theory
- Optimal Portfolios
- Efficient Frontier
- Capital Market Line
- Bayesian Statistics
- Bayes' Formula
- Bayesian Regression
- Two Financial Instruments
- Updating Estimates over Time
- Machine Learning
- Unsupervised Learning
- Supervised Learning
- Conclusion
- Further Resources
- Part IV. Algorithmic Trading
- Chapter 14. The FXCM Trading Platform
- Getting Started
- Retrieving Data
- Retrieving Tick Data
- Retrieving Candles Data
- Working with the API
- Retrieving Historical Data
- Retrieving Streaming Data
- Placing Orders
- Account Information
- Conclusion
- Further Resources
- Chapter 15. Trading Strategies
- Simple Moving Averages
- Data Import
- Trading Strategy
- Vectorized Backtesting
- Optimization
- Random Walk Hypothesis
- Linear OLS Regression
- The Data
- Regression
- Clustering
- Frequency Approach
- Classification
- Two Binary Features
- Five Binary Features
- Five Digitized Features
- Sequential Train-Test Split
- Randomized Train-Test Split
- Deep Neural Networks
- DNNs with scikit-learn
- DNNs with TensorFlow
- Conclusion
- Further Resources
- Chapter 16. Automated Trading
- Capital Management
- The Kelly Criterion in a Binomial Setting
- The Kelly Criterion for Stocks and Indices
- ML-Based Trading Strategy
- Vectorized Backtesting
- Optimal Leverage
- Risk Analysis
- Persisting the Model Object
- Online Algorithm
- Infrastructure and Deployment
- Logging and Monitoring
- Conclusion
- Python Scripts
- Automated Trading Strategy
- Strategy Monitoring
- Further Resources
- Part V. Derivatives Analytics
- Chapter 17. Valuation Framework
- Fundamental Theorem of Asset Pricing
- A Simple Example
- The General Results
- Risk-Neutral Discounting
- Modeling and Handling Dates
- Constant Short Rate
- Market Environments
- Conclusion
- Further Resources
- Chapter 18. Simulation of Financial Models
- Random Number Generation
- Generic Simulation Class
- Geometric Brownian Motion
- The Simulation Class
- A Use Case
- Jump Diffusion
- The Simulation Class
- A Use Case
- Square-Root Diffusion
- The Simulation Class
- A Use Case
- Conclusion
- Further Resources
- Chapter 19. Derivatives Valuation
- Generic Valuation Class
- European Exercise
- The Valuation Class
- A Use Case
- American Exercise
- Least-Squares Monte Carlo
- The Valuation Class
- A Use Case
- Conclusion
- Further Resources
- Chapter 20. Portfolio Valuation
- Derivatives Positions
- The Class
- A Use Case
- Derivatives Portfolios
- The Class
- A Use Case
- Conclusion
- Further Resources
- Chapter 21. Market-Based Valuation
- Options Data
- Model Calibration
- Relevant Market Data
- Option Modeling
- Calibration Procedure
- Portfolio Valuation
- Modeling Option Positions
- The Options Portfolio
- Python Code
- Conclusion
- Further Resources
- Appendix A. Dates and Times
- Python
- NumPy
- pandas
- Appendix B. BSM Option Class
- Class Definition
- Class Usage
- Index
- About the Author
- Colophon
System requirements
File format: PDF
Copy-Protection: Adobe-DRM (Digital Rights Management)
System requirements:
- Computer (Windows; MacOS X; Linux): Install the free reader Adobe Digital Editions prior to download (see eBook Help).
- Tablet/smartphone (Android; iOS): Install the free app Adobe Digital Editions or the app PocketBook before downloading (see eBook Help).
- E-reader: Bookeen, Kobo, Pocketbook, Sony, Tolino and many more (only limited: Kindle).
The file format PDF always displays a book page identically on any hardware. This makes PDF suitable for complex layouts such as those used in textbooks and reference books (images, tables, columns, footnotes). Unfortunately, on the small screens of e-readers or smartphones, PDFs are rather annoying, requiring too much scrolling.
This eBook uses Adobe-DRM, a „hard” copy protection. If the necessary requirements are not met, unfortunately you will not be able to open the eBook. You will therefore need to prepare your reading hardware before downloading.
Please note: We strongly recommend that you authorise using your personal Adobe ID after installation of any reading software.
For more information, see our eBook Help page.