Skip to content

Find maximum covered/secured returns, relies on TD Ameritrade API

Notifications You must be signed in to change notification settings

m8rmclaren/options_calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Optimal CC/CSP Detection - General strategy/goals:

Before I dive in, please heavily note that I'm a sophomore college student studying software engineering, and am by no means a finance expert. Trading stocks/options is basically just a (expensive) hobby, and I thought that my process could be streamlined using some engineering knowledge. Ok now back to it

Goals are to:

  • Find maximum covered/secured returns
  • Develop algorithm to normalize quantitative fundamental analysis (IE using PE, EV/EVIT, EPS, dividend ratio, etc)
  • Evalulate individual options (IE date/strike) for CC/CSP viability based on min/max return, momentum, % risk, etc.

Discover stocks with more upside potential than downside by:

  • Analyzing capital structure
    • low debt compared to equity/assets
    • assume that floor of stock value is implied by cash reported
    • assume that underlying equity volatility decreases as share price approaches positive cash balance
  • Analyzing valuation
    • Measure valuation by considering relative cash flow (value / earnings before interest (EV/EVIT))
    • Analyze PE ratio, higher = better lol
  • Look into share repurchases
  • Dividend ratio
  • Analyze volatility
  • Analyze option scene
    • Maybe average share volume - average option volume gives some clues to investor interest?

Note: Program relies on TD Ameritrade API: https://developer.tdameritrade.com/apis

What does it do as of now?

  • Basically just pulls option chain data of tickers from a TD Ameritrade watchlist, compiles class instances into list, passes list to evaluation function, and compiles new list of dict's containing viable options for CC's.
    • Note that this is extremely primative, and considers a "viable CC" as an OTM option with expiry between 1 and 3 weeks out, that happens to have a delta value above 0.5. My theory around this viewpoint is that OTM options with high delta have lots of momentum around them, and while are probably a bad idea to own, are not a bad idea to sell.

config.json - Layout

{
  "options_endpoint": <TD API endpoint for options chain data>,
  "auth_endpoint": <TD API endpoint for oAuth token generation>,
  "watchlist_id": <TD brokerage watchlist ID to pull ticker symbol data>,
  "account_num": <TD brokerage account ID>,
  "client_id": <Dev API app key + @AMER.OAUTHAP>,
  "apikey": <Dev API app key>,
  "refresh_token": <Refresh token generated by TD auth API endpoint>
}
  • Note that the refresh token must be created manually using https://api.tdameritrade.com/v1/oauth2/token endpoint by creating bearer token.
    • Auth code generated by authenticating TD brokerage with Dev API application. Read the documentation to figure this out, soft of a pain if you're just getting started
  • Ticker symbols are pulled from a predefined watchlist on TD Ameritrade (hence the location for watchlist_id and account_num)
    • These items can be found on TD Ameritrade's website
    • Eventually I'll figure out how to pull down ticker data from the entire stock market to expand the scope of this project

About

Find maximum covered/secured returns, relies on TD Ameritrade API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages