Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering Python for Finance

You're reading from   Mastering Python for Finance Understand, design, and implement state-of-the-art mathematical and statistical applications used in finance with Python

Arrow left icon
Product type Paperback
Published in Apr 2015
Publisher Packt
ISBN-13 9781784394516
Length 340 pages
Edition 1st Edition
Languages
Arrow right icon
Toc

Table of Contents (12) Chapters Close

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

Merging the data


Since the earliest dates in the text files are 31.12.1986 and 04.01.1999 for the STOXX Europe 600 and VSTOXX data file respectively, we will require both the datasets to begin from a common date at 04.01.1999. We will also use values from the SX5E and V2TX columns to retrieve our EURO STOXX 50 Index and VSTOXX historical data values. The following Python code extracts these values into a new Pandas DataFrame object:

import datetime as dt

cutoff_date = dt.datetime(1999, 1, 4)
data = pd.DataFrame(
{'EUROSTOXX' :stoxxeu600['SX5E'][stoxxeu600.index >= cutoff_date],
 'VSTOXX':vstoxx['V2TX'][vstoxx.index >= cutoff_date]})

Now, let's take a look at our DataFrame information:

>>> print data.info()
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 4072 entries, 1999-01-04 00:00:00 to 2014-11-18 00:00:00
Data columns (total 2 columns):
EUROSTOXX    4071 non-null float64
VSTOXX       4046 non-null float64
dtypes: float64(2)

Also, let's take a look at the top...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime