Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Mastering Python for Finance
  • Table Of Contents Toc
Mastering Python for Finance

Mastering Python for Finance

3.3 (7)
close
close
Mastering Python for Finance

Mastering Python for Finance

3.3 (7)

Overview of this book

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.
Table of Contents (12 chapters)
close
close
11
Index

Calculating the VSTOXX main index


From the vstoxx.csv file saved earlier, we can use these values to calculate the VSTOXX index values. The formula to calculate the index is given as follows:

Here,

and is the number of seconds in one year and 30 days respectively.

is the time left to the expiry of the nearest OESX in seconds.

is the time left to the expiry of the second nearest OESX in seconds.

The implementation of the preceding formula is given in the calculate_vstoxx_index method:

import math

def calculate_vstoxx_index(dataframe, col_name):    
    secs_per_day = float(60*60*24)
    utility = OptionUtility()
    
    for row_date, row in dataframe.iterrows():
        # Set each expiry date with an 
        # expiration time of 5p.m
        date = row_date.replace(hour=17)  
        
        # Ensure dates and sigmas are in legal range
        expiry_date_1 = utility.get_settlement_date(date)
        expiry_date_2 = utility.fwd_expiry_date(date, 1)
        days_diff = (expiry_date_1-date...
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Mastering Python for Finance
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon