The idea is to create a bot to detect cheap option that may have high volatility and thus generate some gain. The financial data (stocks/options/earnings) are retrieve from IEX API https://iexcloud.io/ (I had to pay to get to options data).
For example, the following call for AGNC (which already had a significant value increase) is only 30$ (more or less) and may pay off after the earnings
In case you are not familiar with option trading you can read Info about option trading >> https://www.investopedia.com/options-basics-tutorial-4583012
Program
Incoming earnings
I want option that may have some high volatility and to achieve that I decided to look at the stocks that will report earnings and trade the options that expire few days after that. I hope that earning report may have a significant impact on the options and thus generate gain.
I use this endpoint to get the companies that report earnings in the next 7 days and then filter by company market cap to only work on the 50 biggest stocks. I do that to ensure that the options are liquid enough and that there will be plenty of them.
aPotentialCompanyToCheck = getNextWeekEarning() logging.info(f"We have {len(aPotentialCompanyToCheck)} potential Earnings before filtering") aStates['nbCompanyEarningsUnfilter']=len(aPotentialCompanyToCheck) # We keep the biggest companies only to have lot of options (thus data) aPotentialCompanyToCheck = __filterPotentialEarning(aPotentialCompanyToCheck) logging.info(f"We have {len(aPotentialCompanyToCheck)} potential Earnings before filtering: ") aStates['nbCompanyEarningsFilter']=len(aPotentialCompanyToCheck) prettyprintEarningCandidates(aPotentialCompanyToCheck)
Options finder
The next step of the process is to find all options in the next 7 days after the earnings and filter the one with a strike price in the 10% range of the actual stock value (so they have some chance to happen). For those options we keep the one that are less than 20$ since i don t want to gamble more than that 😉
Past earnings
The program will also get the stock prices for the last 2 earnings so that i can see if the stock is usually volatile around its earning to determine if our option have a change to gain. For example if we have a cheap option with a strike price which is +5% of the actual stock price but in the past the stock never move more than 3% after its earning….we know there are very few chances that our option will be in the money. On the opposite if we have another case with a company that was very volatile in its past earnings with move around 10% then we know that it has some chance to happen again.
To the end we get the stock prices on a 10 days range starting 3 days before earning. The value will be display.
Stock value
The last information the script will extract is the actual stock price of the company to see its trend and help me choose a good option.
Display
All the information retrieved are presented to the user on a website. The graphics are made with plotly library that i strongly recommend https://plotly.com/
Result
Here is the page for one stock
It shows the different data gather by the script:
1 – Stock ticker and earning date
2 – Past earnings for the last 6 months
3 – Actual stock value for the last months
4 – Possible cheap option with their detail
In this example we could buy a call which need to gain 4.9% to generate gain and only costs around 20/30 $.
Conclusion
I tried it for 3 weeks but did not make a gain. There were too many lost to compensate with the winner and end up losing around 10$.
Code is here >>https://bitbucket.org/charly37/getrichfast/src/master/