The Python Quants

Python Quant Platform

Brief Overview and Introduction

Dr. Yves J. Hilpisch

The Python Quants GmbH

analytics@pythonquants.com

www.pythonquants.com

The Platform

General Aspects and Trials

Currently, the Python Quant Platform is in beta/pre-release mode and is developed and maintained by The Python Quants GmbH. It offers Web-/browser-based data and financial analytics for individuals, teams and organizations. Free registrations are possible under http://beta.quant-platform.com.

PQP Registration

You can freely choose your user name and password. You can then login under http://analytics.quant-platform.com, using betatest as company in combination with your user name and password.

PQP login

Please note that trial/test accounts are only for illustration purposes and they can be closed at any time (with all data, code, etc. be permanently deleted).

Please read also the Terms & Conditions as well as our Privacy Policy.

If you have questions about the platform or any troubles, you can reach us under platform@pythonquants.com.

Platform Components & Features

At the moment, the Python Quant Platform comprises the following components and features:

  • IPython Notebook: interactive data and financial analytics in the browser with full Python integration and much more (cf. IPython home page).
  • Anaconda Python Distribution: complete Python stack for financial, scientific and data analytics workflows/applications (cf. Anaconda page); you can easily switch between Python 2.7 and 3.4.
  • DX Analytics: our library for advanced financial and derivatives analytics with Python based on Monte Carlo simulation.
  • File Manager: a GUI-based File Manager to upload, download, copy, remove, rename files on the platform.
  • Chat/Forum: there is a simple chat/forum application available via which you can share thoughts, documents and more.
  • Collaboration: the platform features user/group administration as well as file sharing via public folders.
  • Linux Server: the platform is powered by Linux servers to which you have full shell access.
  • Deployment: the platform is easily scalable since it is cloud-based and can also be easily deployed on your own servers (via Docker containers).
PQP Overview

IPython Notebook

In the left panel of the platform, you find the current working path indicated (in black) as well as the current folder and file structure (as links in purple). Note that in this panel only IPython Notebook files are displayed. Here you can navigate the current folder structure by clicking on a link. Clicking on the double points ".." brings you one level up in the structure. Clicking the refresh button right next to the double points updates the folder/file structure. Clicking on a file link opens the IPython Notebook file.

Basic Approach

You find a link to open a new notebook on top of the left panel. With IPython notebooks, like with this one, you can interactively code Python and do data/financial analytics.

In [1]:
print ("Hello Quant World.")
Hello Quant World.

In [2]:
# simple calculations
3 + 4 * 2
Out[2]:
11
In [3]:
# working with NumPy arrays
import numpy as np
rn = np.random.standard_normal(100)
rn[:10]
Out[3]:
array([-0.32688652,  0.79683012,  0.41564703,  0.5784685 , -0.22102602,
       -0.56581669, -0.06886181, -1.30672687,  0.51128603,  1.05541293])
In [4]:
# plotting
import matplotlib.pyplot as plt
%matplotlib inline
plt.plot(rn.cumsum())
plt.grid(True)

If you are new to IPython Notebook, you could start on the IPython home page and might want to check out the videos that are linked there (cf. video page).

Efficient Financial Analytics

Combining the pandas library with IPython Notebook makes for a powerful financial analytics environment.

In [5]:
import pandas as pd
import pandas.io.data as web
In [6]:
AAPL = web.DataReader('AAPL', data_source='google')
  # reads data from Google Finance
AAPL['42d'] = pd.rolling_mean(AAPL['Close'], 42)
AAPL['252d'] = pd.rolling_mean(AAPL['Close'], 252)
  # 42d and 252d trends
In [7]:
AAPL[['Close', '42d', '252d']].plot(figsize=(10, 5))
Out[7]:
<matplotlib.axes.AxesSubplot at 0x7f6d9afd2b90>

DX Analytics

DX Analytics is a Python library for advanced financial and derivatives analytics written by The Python Quants. It is particularly suited to model multi-risk derivatives and to do a consistent valuation of portfolios of complex derivatives. It mainly uses Monte Carlo simulation since it is the only numerical method capable of valuing and risk managing complex, multi-risk derivatives books.

In [8]:
import dx
%run dx_example.py
  # sets up market environments
  # and defines derivative instrument
In [9]:
max_call.payoff_func
  # payoff of a maximum call option
  # on two underlyings (European exercise)
Out[9]:
"np.maximum(np.maximum(maturity_value['gbm'], maturity_value['jd']) - 34., 0)"
In [10]:
max_call.vega('jd')
  # numerical Vega with respect
  # to one risk factor
Out[10]:
6.051000000000073

We are going to generate a Vega surface for one risk factor with respect to the initial values of both risk factors.

In [11]:
asset_1 = np.arange(28., 46.1, 2.)
asset_2 = asset_1
a_1, a_2 = np.meshgrid(asset_1, asset_2)
value = np.zeros_like(a_1)
In [12]:
%%time
vega_gbm = np.zeros_like(a_1)
for i in range(np.shape(vega_gbm)[0]):
    for j in range(np.shape(vega_gbm)[1]):
        max_call.update('gbm', initial_value=a_1[i, j])
        max_call.update('jd', initial_value=a_2[i, j])
        vega_gbm[i, j] = max_call.vega('gbm')
CPU times: user 5.44 s, sys: 2 ms, total: 5.44 s
Wall time: 5.44 s

In [13]:
dx.plot_greeks_3d([a_1, a_2, vega_gbm], ['gbm', 'jd', 'vega gbm'])
  # Vega surface plot

File Manager

The File Manager allows the easy, GUI-based file management on the platform.

Left Column

In the left column you can navigate the file system. For instance, you find a folder called public which you can use to share files with others.

PQP File Manager

Right Column

In the right column, you find the contents of the folder currently active in the left column. The content is updated by clicking on the refresh butotn. You can, for example, drag and drop files and folders as well as upload files from you local disk. For uploading, you have to do the following:

  1. press the add files button
  2. select (multiple) file(s) from your local disk
  3. press the upload button

Via a double click on a file, you can download it. In addition, via a right click on a file, you can:

  • delete a file/folder
  • rename a file/folder
  • zip a file/folder
  • generate a new folder

All file operations are only implementable based on the respective user's rights on the operating system level. For example, everybody can copy a file to the public folder. This file can then be read and executed by everybody, but only the "owner" of the file can overwrite or delete it.

Shell Access

This component of the platform allows the shell-based access to the Linux server. This part of the platform requires a separate login for security reasons (credentials available upon request).

IPython Shell

For example, you can also interactively code on the shell via IPython Shell. The IPython Shell version is started by simply typing ipython in the system shell.

PQP IPython

Text Editing and Coding

Via the system shell you can of course edit and kind of text document and file with computer code, e.g. Python. To this end, you can use Vim which is started via typing vim filename on the system shell or alternatively Nano (started by nano filename).

PQP Vim Editing

File Operations and Git Repositories

Of course, you can do anything else via the system shell given your personal rights on the operating system level. Among others, you can:

  • do file operations (copying, renaming, moving, etc.)
  • use Git repositories (to clone/pull projects, commit and push them)

Further Resources

Consulting and Development Services

The Python Quants group – i.e. The Python Quants GmbH, Germany, and The Python Quants LLC., New York City – provide consulting and development services with a focus on Python for Finance. The team consists of Python and Financial experts with comprehensive experience in the financial industry and in particular in the Quant Finance space.

For example, The Python Quants have designed and implemented a Python-based Tutorial for Eurex, one of the leading derivatives exchanges in the world. The tutorial is about volatility derivatives and is called VSTOXX Advanced Services and is available under http://www.eurexchange.com/vstoxx/. There are is also strategy backtesting application available under http://www.eurexchange.com/vstoxx/app2/

Python for Quant Finance Trainings

The Python Quants group offers trainings on a global basis. Training offerings include, among others:

  • Python for Finance
  • Derivatives Analytics with Python
  • Performance Python

During trainings, the Python Quant Platform is used for a frictionless start and a highly interactive, collaborative training experience.

There is also a complete Python for Finance Online Course available under http://quantshub.com.

In [14]:
from IPython.display import HTML
HTML('<iframe src=http://quantshub.com/content/python-finance-yves-j-hilpisch width=90% height=300></iframe>')
Out[14]:

Python for Quant Finance Books

There are two books available from The Python Quants group about Python for Quant Finance.

Python for Finance

If you are working in (Quant) Finance and want to use Python for developing interactive analytics workflows or more complex financial applications, then this book is the right source for you. You can order at it at Amazon or at O'Reilly.

Python for Finance

Derivatives Analytics with Python

The other book by The Python Quants group is about advanced, market-based derivatives analytics and uses Python to illustrate and implement all numerical methods introduced (Fourier-based option pricing, Monte Carlo simulation, option model calibration, hedging).

The book will be published in 2015 by Wiley Finance.

See http://derivatives-analytics-with-python.com.

Community and Conferences

Members of The Python Quant group are actively involved in the Python community and organize different meetup groups both in Europe as well as in New York City:

The Python Quants also organize the largest "For Python Quants" conference in the world. At the recent NYC conference in March 2014, more than 220 people have been in attendance (cf. http://forpythonquants.com). The next one will take place in London on 28. November 2014.

Contact us

Please contact us if you have any questions or want to get involved in our Python community events.