In this example, we assume the top three rows of the CSV file contain meta information, with the rest of the options chain prices starting from row four onwards. For each row of options pricing data, the first seven columns contain the bid and ask quotes of a call contract, with the next seven columns for a put contract. The first of each seven column contains a string describing the expiry date, strike price, and contract code. Follow these steps to parse information from our CSV file:
- Each row of meta information is appended in a list variable named meta_data, while each row of options data is appended to a list variable named calls_and_puts. Reading a single file with this function gives us the following:
In ...