Cover image for Python for Finance

Book description

Python for Finance introduces the Python libraries and tools you need to successfully apply Python for the development of financial applications and interactive financial analytics. The first part shows you how to set-up the infrastructure, the second is more topic-oriented, and the third provides relevant case studies. The author includes topics such as integration with Excel, and handling derivatives valuation (through a Monte Carlo simulation).

Table of Contents

  1. I. Introduction
    1. 1. Why Python for Finance?
      1. What is Python?
        1. Brief History of Python
        2. The Python Ecosystem
        3. Python User Spectrum
        4. The Scientific Stack
      2. Technology in Finance
        1. Technology Spending
        2. Technology as Enabler
        3. Technology and Talent as Barriers to Entry
        4. Ever Increasing Speeds, Frequencies, Data Volumes
        5. The Rise of Real-Time Analytics
      3. Python for Finance
        1. Finance and Python Syntax
        2. Efficiency and Productivity Through Python
          1. Shorter Time-to-Results
          2. Ensuring High Performance
        3. From Prototyping to Production
      4. Conclusions
      5. Further Reading
    2. 2. Infrastructure and Tools
      1. Python Deployment
        1. Anaconda
        2. Python Quant Platform
      2. Tools
        1. Python
        2. IPython
          1. From Shell to Browser
          2. Basic Usage
          3. Markdown and Latex
          4. Magic Commands
          5. System Shell Commands
        3. Spyder
      3. Conclusions
      4. Further Reading
    3. 3. Introductory Examples
      1. Implied Volatilities
      2. Monte Carlo Simulation
        1. Pure Python
        2. Vectorization with NumPy
        3. Full Vectorization with Log Euler Scheme
        4. Graphical Analysis
      3. Technical Analysis
      4. Conclusions
      5. Further Reading
  2. II. Financial Analytics and Development
    1. 4. Data Types and Structures
      1. Basic Data Types
        1. Integers
        2. Floats
        3. Strings
      2. Basic Data Structures
        1. Tuples
        2. Lists
        3. Excursion: Control Structures
        4. Excursion: Functional Programming
        5. Dicts
        6. Sets
      3. NumPy Data Structures
        1. Arrays with Python Lists
        2. Regular NumPy Arrays
        3. Structured Arrays
      4. Vectorization of Code
        1. Basic Vectorization
        2. Memory Layout
      5. Conclusions
      6. Further Reading
    2. 5. Data Visualization
      1. Two-Dimensional Plotting
        1. One-Dimensional Data Set
        2. Two-Dimensional Data Set
        3. Other Plot Styles
      2. Financial Plots
      3. 3d Plotting
      4. Conclusions
      5. Further Reading
    3. 6. Financial Time Series
      1. pandas Basics
        1. First Steps with DataFrame Class
        2. Second Steps with DataFrame Class
        3. Basic Analytics
        4. Series Class
        5. GroupBy Operations
      2. Financial Data
      3. Regression Analysis
      4. High Frequency Data
      5. Conclusions
      6. Further Reading
    4. 7. Input-Output Operations
      1. Basic I/O with Python
        1. Writing Objects to Disk
        2. Reading and Writing Text Files
        3. SQL Databases
        4. Writing and Reading Numpy Arrays
      2. I/O with pandas
        1. SQL Database
        2. From SQL to pandas
        3. Data as CSV File
        4. Data as Excel File
      3. Fast I/O with PyTables
        1. Working with Tables
        2. Working with Compressed Tables
        3. Working with Arrays
        4. Out-of-Memory Computations
      4. Conclusions
      5. Further Reading
    5. 8. Performance Python
      1. Python Paradigms and Performance
      2. Memory Layout and Performance
      3. Parallel Computing
        1. The Monte Carlo Algorithm
        2. The Sequential Calculation
        3. The Parallel Calculation
        4. Performance Comparison
      4. Multiprocessing
      5. Dynamic Compiling
        1. Introductory Example
        2. Binomial Option Pricing
      6. Static Compiling with Cython
      7. Generation of Random Numbers on GPUs
      8. Conclusions
      9. Further Reading
    6. 9. Mathematical Tools
      1. Approximation
        1. Regression
          1. Monomials as Basis Functions
          2. Individual Basis Functions
          3. Noisy Data
          4. Unsorted Data
          5. Multiple Dimensions
        2. Interpolation
      2. Convex Optimization
        1. Global Optimization
        2. Local Optimization
        3. Constrained Optimization
      3. Integration
        1. Numerical Integration
        2. Integration by Simulation
      4. Symbolic Computation
        1. Basics
        2. Equations
        3. Integration
        4. Differentiation
      5. Conclusions
      6. Further Reading
    7. 10. Stochastics
      1. Random Numbers
      2. Simulation
        1. Random Variables
        2. Stochastic Processes
          1. Geometric Brownian Motion
          2. Square-Root Diffusion
          3. Stochastic Volatility
          4. Jump-Diffusion
        3. Variance Reduction
      3. Valuation
        1. European Options
        2. American Options
      4. Risk Measures
        1. Value-at-Risk
        2. Credit Value Adjustments
      5. Conclusions
      6. Further Reading
  3. About the Author
  4. Copyright