Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Mastering Python for Finance
Mastering Python for Finance

Mastering Python for Finance: Understand, design, and implement state-of-the-art mathematical and statistical applications used in finance with Python

eBook
€8.99 €32.99
Paperback
€41.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Table of content icon View table of contents Preview book icon Preview Book

Mastering Python for Finance

Chapter 1. Python for Financial Applications

In this introductory chapter, we will explore the aspects of Python in order to judge its suitability as a programming language in finance. Notably, Python is widely practiced in various financial sectors, such as banking, investment management, insurance, and even in real estate for building tools that help in financial modeling, risk management, and trading. To help you get the most from the multitude of features that Python has to offer, we will introduce the IPython Notebook as a beneficial tool to help you visualize data and to perform scientific computing for presentation to end users.

In this chapter, we will cover the following topics:

  • Benefits of Python over other programming languages for financial studies
  • Features of Python for financial applications
  • Implementing object-oriented design and functional design in Python
  • Overview of IPython
  • Getting IPython and IPython Notebook started
  • Creating and saving notebook documents
  • Various formats to export a notebook document
  • Notebook document user interface
  • Inserting Markdown language into a notebook document
  • Performing calculations in Python in a notebook document
  • Creating plots in a notebook document
  • Various ways of displaying mathematical equations in a notebook document
  • Inserting images and videos into a notebook document
  • Working with HTML and pandas DataFrame in a notebook document

Is Python for me?

Today's financial programmers have a diverse choice of programming languages in implementing robust software solutions, ranging from C, Java, R, and MATLAB. However, each programming language was designed differently to accomplish specific tasks. Their inner workings, behavior, syntax, and performance affect the results of every user differently.

In this book, we will focus exclusively on the use of Python for analytical and quantitative finance. Originally intended for scientific computations, the Python programming language saw an increasingly widespread use in financial operations. In particular, pandas, a software library written for the Python programming language, was open sourced by an employee of AQR Capital Management to offer high-performance financial data management and quantitative analysis.

Even big financial corporations embrace Python to architect their infrastructure. Bank of America's Quartz platform uses Python for position management, pricing, and risk management. JP Morgan's Athena platform, a cross-market risk management and trading system, uses Python for flexibility in combination with C++ and Java.

The application of Python in finance is vast, and in this book, we will cover the fundamental topics in creating financial applications, such as portfolio optimization, numerical pricing, interactive analytics, big data with Hadoop, and more.

Here are some considerations on why you might use Python for your next financial application.

Free and open source

Python is free in terms of license. Documentation is widely available, and many Python online community groups are available, where one can turn in times of doubt. Because it is free and open source, anyone can easily view or modify the algorithms in order to adapt to customized solutions.

Being accessible to the public opens a whole new level of opportunities. Anyone can contribute existing enhancements or create new modules. For advanced users, interoperability between different programming languages is supported. A Python interpreter may be embedded in C and C++ programs. Likewise, with the appropriate libraries, Python may be integrated with other languages not limited to Fortran, Lisp, PHP, Lua, and more.

Python is available on all major operating systems, such as Windows, Unix, OS/2, Mac, among others.

High-level, powerful, and flexible

Python as a general-purpose, high-level programming language allows the user to focus on problem solving and leave low-level mechanical constructs such as memory management out of the picture.

The expressiveness of the Python programming language syntax helps quantitative developers in implementing prototypes quickly.

Python allows the use of object-oriented, procedural, as well as functional programming styles. Because of this flexibility, it is especially useful in implementing complex mathematical models containing multiple changeable parameters.

A wealth of standard libraries

By now, you should be familiar with the NumPy, SciPy, matplotlib, statsmodels, and pandas modules, as indispensable tools in quantitative analysis and data management.

Other libraries extend the functionalities of Python. For example, one may turn Python into a data visualization tool with the gnuplot package in visualizing mathematical functions and data interactively. With Tk-based GUI tools such as Tkinter, it is possible to turn Python scripts into GUI programs.

A widely popular shell for Python is IPython, which provides interactive computing and high-performance tools for parallel and distributed computing. With IPython Notebook, the rich text web interface of IPython, you can share code, text, mathematical expressions, plots, and other rich media with your target audience. IPython was originally intended for scientists to work with Python and data.

Objected-oriented versus functional programming

If you are working as a programmer in the finance industry, chances are that your program will be built for handling thousands or millions of dollars' worth in transactions. It is crucial that your programs are absolutely free of errors. More often than not, bugs arise due to unforeseen circumstances. As financial software systems and models become larger and more complex, practicing good software design is crucial. While writing the Python code, you may want to consider the object-oriented approach or the functional approach to structure your code for better readability.

The object-oriented approach

As the demand for clarity, speed, and flexibility in your program increases, it is important to keep your code readable, manageable, and lean. One popular technical approach to building software systems is by applying the object-oriented paradigm. Consider the following example of displaying a greeting message as a class:

class Greeting(object):

    def __init__(self, my_greeting):
        self.my_greeting = my_greeting

    def say_hello(self, name):
        print "%s %s" % (self.my_greeting, name)

Tip

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/ support and register to have the files e-mailed directly to you.

We created a class called Greeting that is capable of accepting an input argument in its constructor. For this example, we will define our greeting as "Hello". The say_hello function is invoked with an input name and prints our greeting messages as follows:

>>> greeting = Greeting("Hello")
>>> greeting.say_hello("World")
>>> greeting.say_hello("Dog")
>>> greeting.say_hello("Cat")
Hello World
Hello Dog
Hello Cat

The functional approach

We can achieve the same Greeting functionality using the functional approach. Functional programming is a programming paradigm, where computer programs are structured and styled in such a way that they can be evaluated as mathematical functions. These pseudo mathematical functions avoid changing state data, while increasing reusability and brevity.

In Python, a function object can be assigned to a variable and, like any other variables, can be passed into functions as an argument as well as return its value.

Let's take a look at the following code that gives us the same output:

from functools import partial
def greeting(my_greeting, name):
    print "%s %s" % (my_greeting, name)

Here, we defined a function named greeting that takes in two arguments. Using the partial function of the functools module, we treated the function, greeting, as an input variable, along with our variable greeting message as Hello.

>>> say_hello_to = partial(greeting, "Hello")
>>> say_hello_to("World")
>>> say_hello_to("Dog")
>>> say_hello_to("Cat")

We assigned the say_hello_to variable as its return value, and reused this variable in printing our greetings with three different names by executing it as a function that accepts input arguments.

Which approach should I use?

There is no clear answer to this question. We have just demonstrated that Python supports both the object-oriented approach and the functional approach. We can see that in certain circumstances the functional approach in software development is brevity to a large extent. Using the say_hello_to function provides better readability over greeting.say_hello(). It boils down to the programmer's decision as to what works best in making the code more readable and having ease of maintenance during the software life cycle while collaborating with fellow developers.

As a general rule of thumb, in large and complex software systems representing objects as classes helps in code management between team members. By working with classes, the scope of work can be more easily defined, and system requirements can be easily scaled using object-oriented design. When working with financial mathematical models, using functional programing helps to keep the code working in the same fashion as its accompanying mathematical concepts.

Which Python version should I use?

The code examples in this book have been tested in Python 2.7 but are optimized to run on Python 3. Many of the third-party Python modules mentioned in this book require at least Python 2.7, and some do not have support for Python 3 as yet. To achieve the best compatibility, it is recommended that you install Python 2.7 on your workstation.

If you have not installed Python on your workstation, you can find out more about Python from the official source at https://www.python.org. However, in order to build financial applications from the examples, you are required to use a number of additional third-party Python modules such as NumPy, SciPy, and pandas. It is recommended that you obtain an all-in-one installer to ease the installation procedures. The following are some popular installers that include hundreds of supported packages:

Introducing IPython

IPython is an interactive shell with high-performance tools used for parallel and distributed computing. With the IPython Notebook, you can share code, text, mathematical expressions, plots, and other rich media with your target audience.

In this section, we will learn how to get started and run a simple IPython Notebook.

Getting IPython

Depending on how you have installed Python on your machine, IPython might have been included in your Python environment. Please consult the IPython official documentation for the various installation methods most comfortable for you. The official page is available at http://ipython.org.

IPython can be downloaded from https://github.com/ipython. To install IPython, unpack the packages to a folder. From the terminal, navigate to the top-level source directory and run the following command:

$ python setup.py install

Using pip

The pip tool is a great way to install Python packages automatically. Think of it as a package manager for Python. For example, to install IPython without having to download all the source files, just run the following command in the terminal:

$ pip install ipython

To get pip to work in the terminal, it has to be installed as a Python module. Instructions for downloading and installing pip can be found at https://pypi.python.org/pypi/pip.

The IPython Notebook

The IPython Notebook is the web-based interactive computing interface of IPython used for the whole computation process of developing, documenting, and executing the code. This section covers some of the common features in IPython Notebook that you may consider using for building financial applications.

Here is a screenshot of the IPython Notebook in Windows OS:

The IPython Notebook

Notebooks allow in-browser editing and executing of the code with the outputs attached to the code that generated them. It has the capability of displaying rich media, including images, videos, and HTML components.

Its in-browser editor allows the Markdown language that can provide rich text and commentary for the code.

Mathematical notations can be included with the use of LaTeX, rendered natively by MathJax. With the ability to import Python modules, publication-quality figures can be included inline and rendered using the matplotlib library.

Notebook documents

Notebook documents are saved with the .ipynb extension. Each document contains everything related to an interactive session, stored internally in the JSON format. Since JSON files are represented in plain text, this allows notebooks to be version controlled and easily sharable.

Notebooks can be exported to a range of static formats, including HTML, LaTeX, PDF, and slideshows.

Notebooks can also be available as static web pages and served to the public via URLs using nbviewer (IPython Notebook Viewer) without users having to install Python. Conversion is handled using the nbconvert service.

Running the IPython Notebook

Once you have IPython successfully installed in the terminal, type the following command:

$ ipython notebook

This will start the IPython Notebook server service, which runs in the terminal. By default, the service will automatically open your default web browser and navigate to the landing page. To access the notebook program manually, enter the http://localhost:8888 URL address in your web browser.

Tip

By default, a notebook runs in port 8888. To infer the correct notebook address, check the log output from the terminal.

The landing page of the notebook web application is called the dashboard, which shows all notebooks currently available in the notebook directory. By default, this directory is the one from which the notebook server was started.

Creating a new notebook

Click on New Notebook from the dashboard to create a new notebook. You can navigate to the File | New menu option from within an active notebook:

Creating a new notebook

Here, you will be presented with the notebook name, a menu bar, a toolbar, and an empty code cell.

The menu bar presents different options that may be used to manipulate the way the notebook functions.

The toolbar provides shortcuts to frequently used notebook operations in the form of icons.

Notebook cells

Each logical section in a notebook is known as a cell. A cell is a multi-line text input field that accepts plain text. A single notebook document contains at least one cell and can have multiple cells.

To execute the contents of a cell, from the menu bar, go to Cell | Run, or click on the Play button from the toolbar, or use the keyboard shortcut Shift + Enter.

Each cell can be formatted as a Code, Markdown, Raw NBConvert, or heading cell:

Notebook cells

Code cell

By default, each cell starts off as a code cell, which executes the Python code when you click on the Run button. Cells with a rounded rectangular box and gray background accept text inputs. The outputs of the executed box are displayed in the white space immediately below the text input.

Markdown cell

Markdown cells accept the Markdown language that provides a simple way to format plain text into rich text. It allows arbitrary HTML code for formatting.

Mathematical notations can be displayed with standard LaTeX and AMS-LaTeX (the amsmath package). Surround the LaTeX equation with $ to display inline mathematics, and $$ to display equations in a separate block. When executed, MathJax will render Latex equations with high-quality typography.

Raw NBConvert cell

Raw cells provide the ability to write the output directly and are not evaluated by the notebook.

Heading cells

Cells may be formatted as a heading cell, from level 1 (top level) to level 6 (paragraph). These are useful for the conceptual structure of your document or to construct a table of contents.

Simple exercises with IPython Notebook

Let's get started by creating a new notebook and populating it with some content. We will insert the various types of objects to demonstrate the various tasks.

Creating a notebook with heading and Markdown cells

We will begin by creating a new notebook by performing the following steps:

  1. Click on New Notebook from the dashboard to create a new notebook. If from within an active notebook, navigate to the File | New menu option.
  2. In the input field of the first cell, enter a page title for this notebook. In this example, type in Welcome to Hello World.
  3. From the options toolbar menu, go to Cells | Cell Type and select Heading 1. This will format the text we have entered as the page title. The changes, however, will not be immediate at this time.
  4. From the options toolbar menu, go to Insert | Insert Cell Below. This will create another input cell below our current cell.
  5. In this example, we will insert the following piece of text that contains the Markdown code:
    Text Examples
    ===
    
    This is an example of an *italic* text.
    
    This is an example of a **bold*** text.
    
    This is an example of a list item:
    - Item #1
    - Item #2
    - Item #3
    
    ---
    
    #heading 1
    ##heading 2
    ###heading 3
    ####heading 4
    #####heading 5
    ######heading 6
  6. From the toolbar, select Markdown instead of Code.
  7. To run your code, go to Cell | Run All. This option will run all the Python commands and format your cells as required.

    Tip

    When the current cell is executed successfully, the notebook will focus on the next cell below, ready for your next input. If no cell is available, one will be automatically created and will receive the input focus.

This will give us the following output:

Creating a notebook with heading and Markdown cells

Saving notebooks

Go to File and click on Save and Checkpoint. Our notebook will be saved as an .ipynb file.

Mathematical operations in cells

Let's perform a simple mathematical calculation in the notebook; let's add the numbers 3 and 5 and assign the result to the answer variable by typing in the code cell:

answer = 3 + 5

From the options menu, go to Insert | Insert Cell Below to add a new code cell at the bottom. We want to output the result by typing in the following code in the next cell:

print answer

Next, go to Cell | Run All. Our answer is printed right below the current cell.

Mathematical operations in cells

Displaying graphs

The matplotlib module provides a MATLAB-like plotting framework in Python. With the matplotlib.pyplot function, charts can be plotted and rendered as graphic images for display in a web browser.

Let's demonstrate a simple plotting functionality of the IPython Notebook. In a new cell, paste the following code:

import numpy as np
import math
import matplotlib.pyplot as plt

x = np.linspace(0, 2*math.pi) 
plt.plot(x, np.sin(x), label=r'$\sin(x)$') 
plt.plot(x, np.cos(x), 'ro', label=r'$\cos(x)$') 
plt.title(r'Two plots in a graph') 
plt.legend() 

The first three lines of the code contain the required import statements. Note that the NumPy, math, and matplotlib packages are required for the code to work in the IPython Notebook.

In the next statement, the variable x represents our x axis values from 0 through 7 in real numbers. The following statement plots the sine function for every value of x. The next plot command plots the cosine function for every value of x as a dotted line. The last two lines of the code print the title and legend respectively.

Running this cell gives us the following output:

Displaying graphs

Inserting equations

What is TeX and LaTeX? TeX is the industry standard document markup language for math markup commands. LaTeX is a variant of TeX that separates the document structure from the content.

Mathematical equations can be displayed using LaTeX in the Markdown parser. The IPython Notebook uses MathJax to render LaTeX surrounded with $$ inside Markdown.

For this example, we will display a standard normal cumulative distribution function by typing in the following command in the cell:

$$N(x) = \frac{1}{\sqrt{2\pi}}\int_{-\infty}^{x} e^{- \frac{z^2}{2}}\, dz$$

Select Markdown from the toolbar and run the current cell. This will transform the current cell into its respective equation output:

Inserting equations

Besides using the MathJax typesetting, another way of displaying the same equation is using the math function of the IPython display module, as follows:

from IPython.display import Math
Math(r'N(x) = \frac{1}{\sqrt{2\pi}}\int_{-\infty}^{x} e^{- \frac{z^2}{2}}\, dz')

The preceding code will display the same equation, as shown in the following screenshot:

Inserting equations

Notice that, since this cell is run as a normal code cell, the output equation is displayed immediately below the code cell.

We can also display equations inline with text. For example, we will use the following code with a single $ wrapping around the LaTeX expression:

This expression $\sqrt{3x-1}+(1+x)^2$ is an example of a TeX inline equation

Run this cell as the Markdown cell. This will transform the current cell into the following:

Inserting equations

Displaying images

To work with images, such as JPEG and PNG, use the Image class of the IPython display module. Run the following code to display a sample image:

from IPython.display import Image
Image(url='http://python.org/images/python-logo.gif')

On running the code cell, it will display the following output:

Displaying images

Inserting YouTube videos

The lib.display module of the IPython package contains a YouTubeVideo function, where you can embed videos hosted externally on YouTube into your notebook. For example, run the following code:

from IPython.lib.display import YouTubeVideo

# An introduction to Python by Google.
YouTubeVideo('tKTZoB2Vjuk')  

The video will be displayed below the code, as shown in the following screenshot:

Inserting YouTube videos

Working with HTML

Notebook allows HTML representations to be displayed. One common use of HTML is the ability to display data with tables. The following code outputs a table with two columns and three rows, including a header row:

from IPython.display import HTML
table = """<table>
<tr>
<th>Header 1</th>
<th>Header 2</th>
</tr>
<tr>
<td>row 1, cell 1</td>
<td>row 1, cell 2</td>
</tr>
<tr>
<td>row 2, cell 1</td>
<td>row 2, cell 2</td>
</tr>
</table>"""
HTML(table)

The HTML function will render HTML tags as a string in its input argument. We can see the final output as follows:

Working with HTML

The pandas DataFrame object as an HTML table

In a notebook, pandas allow DataFrame objects to be represented as HTML tables.

In this example, we will retrieve the stock market data from Yahoo! Finance and store them in a pandas DataFrame object with the help of the panas.io.data.web.DataReader function. Let's use the AAPL ticker symbol as the first argument, yahoo as its second argument, the start date of the market data as the third argument, and the end date as the last argument:

import pandas.io.data as web
import datetime

start = datetime.datetime(2014, 1, 1)
end = datetime.datetime(2014, 12, 31)
df = web.DataReader("AAPL", 'yahoo', start, end)
df.head()

With the df.head() command, the first five rows of the DataFrame object that contains the market data is displayed as an HTML table in the notebook:

The pandas DataFrame object as an HTML table

Notebook for finance

You are now ready to place your code in a chronological order and present the key financial information, such as plots and data to your audience. Many industry practitioners use the IPython Notebook as their preferred editor for financial model development in helping them to visualize data better.

You are strongly encouraged to explore the powerful features the IPython Notebook has to offer that best suit your modeling needs. A gallery of interesting notebook projects used in scientific computing can be found at https://github.com/ipython/ipython/wiki/A-gallery-of-interesting-IPython-Notebooks.

Summary

In this chapter, we discussed how Python might be suitable for certain areas of finance and also discussed its advantages for our software applications. We also considered the functional programming paradigm and the object-oriented programming paradigm that are supported in Python, and saw how we can achieve brevity in our applications. There is no clear rule as to how one approach may be favored over the other. Ultimately, Python gives programmers the flexibility to structure their code to the best interests of the project at hand.

We were introduced to IPython, the interactive computing shell for Python, and explored its usefulness in scientific computing and rich media presentation. We worked on simple exercises on our web browser with the IPython Notebook, and learned how to create a new notebook document, insert text with the Markdown language, performed simple calculations, plotted graphs, displayed mathematical equations, inserted images and videos, rendered HTML, and learned how to use pandas to fetch the stock market data from Yahoo! Finance as a DataFrame object before presenting its content as an HTML table. This will help us visualize data and perform rich media presentations to our audience.

Python is just one of the many powerful programing languages that can be considered in quantitative finance studies, not limited to Julia, R, MATLAB, and Java. You should be able to present key concepts more effectively in the Python language. These concepts, once mastered, can easily be applied to any language you choose when creating your next financial application.

In the next chapter, we will explore linear models in finance and techniques used in portfolio management.

Left arrow icon Right arrow icon

Description

If you are an undergraduate or graduate student, a beginner to algorithmic development and research, or a software developer in the financial industry who is interested in using Python for quantitative methods in finance, this is the book for you. It would be helpful to have a bit of familiarity with basic Python usage, but no prior experience is required.

Who is this book for?

If you are an undergraduate or graduate student, a beginner to algorithmic development and research, or a software developer in the financial industry who is interested in using Python for quantitative methods in finance, this is the book for you. It would be helpful to have a bit of familiarity with basic Python usage, but no prior experience is required.

What you will learn

  • Perform interactive computing with IPython Notebook
  • Solve linear equations of financial models and perform ordinary least squares regression
  • Explore nonlinear modeling and solutions for optimum points using rootfinding algorithms and solvers
  • Discover different types of numerical procedures used in pricing options
  • Model fixedincome instruments with bonds and interest rates
  • Manage big data with NoSQL and perform analytics with Hadoop
  • Build a highfrequency algorithmic trading platform with Python
  • Create an eventdriven backtesting tool and measure your strategies
Estimated delivery fee Deliver to Malta

Premium delivery 7 - 10 business days

€32.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Apr 29, 2015
Length: 340 pages
Edition : 1st
Language : English
ISBN-13 : 9781784394516
Category :
Languages :
Concepts :

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to Malta

Premium delivery 7 - 10 business days

€32.95
(Includes tracking information)

Product Details

Publication date : Apr 29, 2015
Length: 340 pages
Edition : 1st
Language : English
ISBN-13 : 9781784394516
Category :
Languages :
Concepts :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 120.97
Mastering Python for Finance
€41.99
Mastering R for Quantitative Finance
€41.99
Python for Finance
€36.99
Total 120.97 Stars icon
Banner background image

Table of Contents

11 Chapters
1. Python for Financial Applications Chevron down icon Chevron up icon
2. The Importance of Linearity in Finance Chevron down icon Chevron up icon
3. Nonlinearity in Finance Chevron down icon Chevron up icon
4. Numerical Procedures Chevron down icon Chevron up icon
5. Interest Rates and Derivatives Chevron down icon Chevron up icon
6. Interactive Financial Analytics with Python and VSTOXX Chevron down icon Chevron up icon
7. Big Data with Python Chevron down icon Chevron up icon
8. Algorithmic Trading Chevron down icon Chevron up icon
9. Backtesting Chevron down icon Chevron up icon
10. Excel with Python Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Half star icon Empty star icon 3.3
(7 Ratings)
5 star 14.3%
4 star 28.6%
3 star 28.6%
2 star 28.6%
1 star 0%
Filter icon Filter
Top Reviews

Filter reviews by




Duncan W. Robinson Jun 14, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Wow… good stuff. Mastering Python for Finance really delivers. It does a fine job blending academic theory with a practitioner’s penchant for useful applications, delivering Python code all the way to guide the reader along his / her journey. I have not worked all of the examples yet, but I am looking forward to doing so – especially the sections that use Hadoop & Python together.
Amazon Verified review Amazon
Federico Han Feb 28, 2018
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
A pretty good survey on many object-oriented implementations common in Finance.Plenty of applications and examples -some indeed with errors , though on the positive it is a useful learning experience to do some minor debugging !-.As with many practical reference books try to buy the print version, this is not bedtime reading stuff.
Amazon Verified review Amazon
Kindleのお客様 Jul 06, 2016
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
金融工学の基礎を一通り習得した人が、pythonでコードをかけるようになるための一冊。目次の内容に対して、特に数学的な証明等なしで天下り的にPythonのコードが羅列されているので、ファイナンスの入門者にはお勧めしない。費用対効果は高い。
Amazon Verified review Amazon
Martin Galli Jan 01, 2017
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
Bon livre en général mais dommage qu'il soit en Python 2.7 et non Python3.5. Sinon, les solutions sont très bien expliquées et l'organisation est claire.
Amazon Verified review Amazon
Ho Yan Chan May 02, 2018
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
ok
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact customercare@packt.com with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at customercare@packt.com using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on customercare@packt.com with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on customercare@packt.com within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on customercare@packt.com who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on customercare@packt.com within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela