April 2019
Intermediate to advanced
426 pages
11h 13m
English
Suppose you had gathered SPX options data from your broker or purchased historical data from an external source such as the CBOE website. For the purpose of this chapter, the end-of-day SPX option chain prices are observed from Monday, October 15, 2018 to Friday, October 19, 2018 and saved into Comma-separated Values (CSV) files. Sample copies of these files are provided under the files folder of the source codes repository.
In the following example, write a function, read_file(), that accepts the file path in its first argument indicating the location of a CSV file, and returns a tuple of a list of metadata and a list of option chain data:
In [ ]: import csv META_DATA_ROWS = 3 # Header data starts at line ...
Read now
Unlock full access