Brief Overview and Introduction (needs Python 2.7 on the platform)
The Python Quant Platform 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://trial.quant-platform.com.
You can freely choose your your_user_name and password. You can then login under http://analytics.quant-platform.com, using trial as company in combination with your_user_name and password.
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).
If you have questions about the platform or any troubles, you can reach us under firstname.lastname@example.org.
At the moment, the Python Quant Platform comprises the following components and features:
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.
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.
print ("Hello Quant World.")
Hello Quant World.
# simple calculations 3 + 4 * 2
# working with NumPy arrays import numpy as np rn = np.random.standard_normal(100) rn[:10]
array([ 0.82494901, 0.16332511, 0.76873293, 1.14726731, -2.19660228, 0.73128696, 0.06199284, 1.31718399, -0.9857746 , 0.04518282])
# 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).
Combining the pandas library with IPython Notebook makes for a powerful financial analytics environment.
import pandas as pd import pandas.io.data as web
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
AAPL[['Close', '42d', '252d']].plot(figsize=(10, 5))
<matplotlib.axes._subplots.AxesSubplot at 0x7f1b60faadd0>
Below you find a complete talk/tutorial about interactive financial analytics with Python.
from IPython.display import YouTubeVideo YouTubeVideo('XyqlduIcc2g', width=700, height=400)
Loading the R extension for IPython.
# only Python 2.7 %load_ext rpy2.ipython
Pushing data to R.
AAPL_close = AAPL['Close'].values
Plotting data with R.
%R plot(AAPL_close, pch=20, col='red'); grid(); title("AAPL closing values")
Julia is, for example, often faster for iterative function formulations. As an example, consider the Fibonacci sequence.
%%julia # recursive formulation in Julia fib_rec(n) = n < 2 ? n : fib_rec(n - 1) + fib_rec(n - 2) @elapsed fib_rec(40)
fib_rec (generic function with 1 method) 0.78789074
# same in Python def fib_rec(n): if n < 2: return n else: return fib_rec(n - 1) + fib_rec(n - 2) %time fib_rec(40)
CPU times: user 30.4 s, sys: 61 ms, total: 30.5 s Wall time: 30.3 s
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.
# only Python 2.7 import dx %run dx_example.py # sets up market environments # and defines derivative instrument
max_call.payoff_func # payoff of a maximum call option # on two underlyings (European exercise)
"np.maximum(np.maximum(maturity_value['gbm'], maturity_value['jd']) - 34., 0)"
max_call.vega('jd') # numerical Vega with respect # to one risk factor
We are going to generate a Vega surface for one risk factor with respect to the initial values of both risk factors.
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)
%%time vega_gbm = np.zeros_like(a_1) for i in range(np.shape(vega_gbm)): for j in range(np.shape(vega_gbm)): 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 3.93 s, sys: 2 ms, total: 3.93 s Wall time: 3.93 s
dx.plot_greeks_3d([a_1, a_2, vega_gbm], ['gbm', 'jd', 'vega gbm']) # Vega surface plot
The File Manager allows the easy, GUI-based file management on the platform.
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.
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:
For downloading from a Web source, do:
Via a right click, you can:
Via a double click on a file, you can open and edit it (for those files where it is possible, e.g. Python, HTML or CSS files).
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.
This component of the platform allows the editing of a multitude of different file types (e.g. Python, HTML or CSS).
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).
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.
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
Of course, you can do anything else via the system shell given your personal rights on the operating system level. Among others, you can:
Via the Python Quant Platform you can develop and deploy also your (Web) applications. Here is an example that shows real-time streaming of financial data.
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/
The Python Quants group offers trainings on a global basis. Training offerings include, among others:
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. See the trailer of the online course below.
YouTubeVideo('kpIoNpm97UY', width=700, height=400)
There are two books available from The Python Quants group about Python for Quant Finance.
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 the Wiley book page.
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://nyc2014.forpythonquants.com). The last one took place in London on 28. November 2014 (cf. http://lon2014.forpythonquants.com).
Please contact us if you have any questions or want to get involved in our Python community events.