Building Option Chain Datasets

Vee Kalkunte
Coinmonks
2 min readJan 14, 2022

--

Project Summary

Sample of the unabridged results

This project gathers, cleans, and exports option chains of the user’s choice. You can ask for one option at a time, or input a list of symbols and get a dataframe / exported CSV of all of their results together.

Check out the code here.

Parameter Details

toCSV, when true, exports either the single or group of options as a csv file. When it’s false, the function returns the data frame option. This allows you to import this code into your own and use the functions as needed as part of your pipeline if you so desire to do that instead of just exporting the results. Set to True by default.

timeIt, which, when true, will tell you how long the code took to execute. If you’d like it to execute, say, every month to figure out what options to buy said month, you’d need to make sure it can run in a reasonable amount of time. To give context for the current speed, for 5000 options, it takes about 7 hours to compile. Set to False by default.

bareMinimum, when true, returns only the name, strike, price, bid, ask, and expiration date of the option contracts. Turn it on if you’re going to call over 1000 symbols (it reduces the time it takes, and reduces the exported data by half), otherwise you can get the entire amount of data offered. The picture is with bareMinimum set to false. Set to False by default.

And finally, rawData, which, when set to true, returns all the data with no cleaning. The cleaning included in this program are: getting rid of any options where the call is lower than the current price or the put is higher than the current price and getting rid of mini options. Set to False by default.

Happy option chain gathering!

--

--

Vee Kalkunte
Coinmonks

Austin College ’22. Part time data nerd and terminally online gamer (They/Them)