{"id":18643917,"url":"https://github.com/major/stock-scripts","last_synced_at":"2025-04-11T12:30:50.189Z","repository":{"id":43190523,"uuid":"326289124","full_name":"major/stock-scripts","owner":"major","description":"Major's random stock scripts","archived":true,"fork":false,"pushed_at":"2024-04-23T21:07:20.000Z","size":37,"stargazers_count":5,"open_issues_count":3,"forks_count":1,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-10T09:13:51.285Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/major.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2021-01-02T23:16:30.000Z","updated_at":"2024-04-24T13:21:26.000Z","dependencies_parsed_at":"2024-04-22T17:50:19.499Z","dependency_job_id":null,"html_url":"https://github.com/major/stock-scripts","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/major%2Fstock-scripts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/major%2Fstock-scripts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/major%2Fstock-scripts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/major%2Fstock-scripts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/major","download_url":"https://codeload.github.com/major/stock-scripts/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248401931,"owners_count":21097328,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T06:08:58.874Z","updated_at":"2025-04-11T12:30:49.944Z","avatar_url":"https://github.com/major.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Major's random stock scripts\n\nThis is a collection of random scripts that I use for managing stock and\noption investments.\n\n## put_finder.py\n\nThe `put_finder.py` script searches for put options to sell that meet your\nannual return requirements. The returns are calculated like this:\n\n```python\nreturn = bid_price / (strike_price - bid_price)\nannualized_return = return * DTE * 365\n```\n\nThe `get_tda_token.py` script will generate the `creds.yaml` that contains\nyour `client_id` and `refresh_token` that are required for the script to work.\nSee the comments in the script for the steps required for creating a TD\nAmeritrade developer account.\n\nThe main script takes a few arguments:\n\n```shell\n➜ ./put_finder.py --help\nusage: put_finder.py [-h] [--credentials-path CREDENTIALS_PATH] [--pop-min POP_MIN] [--pop-max POP_MAX] [--min-return MIN_RETURN] [--dte-max DTE_MAX] ticker\n\nFind options that meet an annual rate of return requirement\n\npositional arguments:\n  ticker                Stock ticker symbol\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --credentials-path CREDENTIALS_PATH\n                        TD Ameritrade Credentials Path (default: ./creds.yaml)\n  --pop-min POP_MIN     Minimum percent chance of profit (default: 70)\n  --pop-max POP_MAX     Maximum percent chance of profit (default: 90)\n  --min-return MIN_RETURN\n                        Minimum annual return percentage (default: 20)\n  --dte-max DTE_MAX     Maximum days until expiration (default: 60)\n\n```\n\nLet's say you're interested in TSLA options that:\n\n* Expire in 21 days or less\n* Have a chance of profit somewhere in the 75-85% range\n* Have an annualized return over 50%\n\nRun the script like this:\n\n```shell\n➜ ./put_finder.py --pop-min 75 --pop-max 85 --min-return 50 --dte-max 21 TSLA\n| 💸                |   Strike | Exp Date   |   DTE |   Bid |   PoP % |   Ret. % |   Annual % |\n|:------------------|---------:|:-----------|------:|------:|--------:|---------:|-----------:|\n| TSLA_010821P710   |    710   | 2021-01-08 |     3 |  5.7  |    75.9 |      0.8 |       98.5 |\n| TSLA_010821P707.5 |    707.5 | 2021-01-08 |     3 |  5.15 |    77.7 |      0.7 |       89.2 |\n| TSLA_010821P705   |    705   | 2021-01-08 |     3 |  4.7  |    79.3 |      0.7 |       81.7 |\n| TSLA_010821P702.5 |    702.5 | 2021-01-08 |     3 |  4.3  |    80.9 |      0.6 |       74.9 |\n| TSLA_010821P700   |    700   | 2021-01-08 |     3 |  3.95 |    82.3 |      0.6 |       69   |\n| TSLA_010821P697.5 |    697.5 | 2021-01-08 |     3 |  3.55 |    83.8 |      0.5 |       62.2 |\n| TSLA_011521P690   |    690   | 2021-01-15 |    10 | 11.05 |    75.6 |      1.6 |       59.4 |\n| TSLA_010821P695   |    695   | 2021-01-08 |     3 |  3.3  |    85   |      0.5 |       58   |\n| TSLA_011521P685   |    685   | 2021-01-15 |    10 | 10    |    77.6 |      1.5 |       54.1 |\n```\n\nAll of the available puts to sell that meet your requirements are displayed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmajor%2Fstock-scripts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmajor%2Fstock-scripts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmajor%2Fstock-scripts/lists"}