{"id":16359328,"url":"https://github.com/gaborvecsei/mad-money-backtesting","last_synced_at":"2025-03-23T01:32:25.612Z","repository":{"id":52718902,"uuid":"369281130","full_name":"gaborvecsei/Mad-Money-Backtesting","owner":"gaborvecsei","description":"Backtesting recommendations from Mad Money and \"The Cramer Effect/Bounce\"","archived":false,"fork":false,"pushed_at":"2022-10-31T00:56:36.000Z","size":3859,"stargazers_count":13,"open_issues_count":0,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-12T02:08:15.812Z","etag":null,"topics":["backtesting","backtesting-trading-strategies","cramer-bounce","cramer-effect","finance","hacktoberfest2021","mad-money","python","trading","trading-strategies"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gaborvecsei.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-05-20T17:03:22.000Z","updated_at":"2024-02-26T06:10:14.000Z","dependencies_parsed_at":"2023-01-20T13:01:52.780Z","dependency_job_id":null,"html_url":"https://github.com/gaborvecsei/Mad-Money-Backtesting","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/gaborvecsei%2FMad-Money-Backtesting","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gaborvecsei%2FMad-Money-Backtesting/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gaborvecsei%2FMad-Money-Backtesting/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gaborvecsei%2FMad-Money-Backtesting/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gaborvecsei","download_url":"https://codeload.github.com/gaborvecsei/Mad-Money-Backtesting/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221842101,"owners_count":16890108,"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":["backtesting","backtesting-trading-strategies","cramer-bounce","cramer-effect","finance","hacktoberfest2021","mad-money","python","trading","trading-strategies"],"created_at":"2024-10-11T02:08:06.350Z","updated_at":"2024-10-28T14:44:05.378Z","avatar_url":"https://github.com/gaborvecsei.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Backtesting the \"Cramer Effect\" \u0026 Recommendations from Cramer\n\n\u003cimg src=\"art/cramer.gif\" width=\"400\" alt=\"Cramer\"\u003e\u003c/a\u003e\n\n**Recommendations from Cramer**: On the show Mad-Money (CNBC) Jim Cramer picks stocks which he recommends to buy.\nWe will use this data to build a portfolio\n\n**The Cramer-effect/Cramer-bounce**: After the show *Mad Money* the recommended stocks are bought by viewers almost\nimmediately (afterhours trading) or on the next day at market open, increasing the price for a short period of time.\n\n[You can read about the setup and results in my Blog Post](https://www.gaborvecsei.com/Mad-Money-Backtesting/)\n\nYou can also access the data easily with the\n[Flat Data Viewer](https://flatgithub.com/gaborvecsei/Mad-Money-Backtesting)\n\n# How to use this repo\n\n- **Automatic data scraping** *(with Github Actions)*: Every day at 00:00 the `scrape_mad_money.py` tool runs\n    and commits the data (if there was a change) to this repo. Feel free to use the created `.csv` file for your own projects\n    - *(Why do we scrape the whole data range every day?)*: This way we can see the changes from commit to commit.\n    If anything happens which would alter the historical data, we would be aware.\n- **(\"manual\") Data scraping**: Use the `scrape_mad_money.py` to get the buy and sell recommendations Cramer made over the years\n    - Result is a `.csv` file which you can use\n- **Backtesting the buy calls**: Use the notebook `mad_money_backtesting.ipynb`\n    - To add your backtesting strategy, go to the `backtesting_strategies.py` file and implement yours based on the\n    existing ones\n\n*Warning: code quality is just \"mehh\", I did not pay much attention here, this is just a quick experiment*\n\n# Backtesting\n\nIn the notebook there are notes how the experiment(s) were conducted and facts, limitations about the approach.\nYou can also add your own approaches.\n\n**Available Strategies:**\n- `BuyAndHold` (and repeat)\n- `AfterShowBuyNextDayCloseSell`\n- `AfterShowBuyNextDayOpenSell`\n- `NextDayOpenBuyNextDayCloseSell`\n\n## Buy and Hold (and repeat) Results\n\n\u003cimg src=\"art/buy_and_hold_returns_mean_median.png\" width=\"600\" alt=\"returns\"\u003e\u003c/a\u003e\n\n\u003cimg src=\"art/buy_and_hold_returns_pos_neg.png\" width=\"600\" alt=\"returns\"\u003e\u003c/a\u003e\n\n## How is this different from the real-life scenario?\n\nWe backtest each mentioned stock individually, then aggregate the results.\nWe define a cash amount for each symbol separately (e.g. $1k) and not an overall budget.\nThis change should not alter the expected returns (in %) much if we assume you have infinite money, so you can\nput your money in each of the mentioned stocks every day.\n\nAs we don't have (free) complete after-hours trading data, the scenario when we \"buy at the end of the Mad Money Show\"\nis approximated with the value of the stock value at market close. This obviously alters the end result for the short\nterm experiments if a stock has high daily volatility and it changes a lot afterhours.\n(Of course the \"buy at next trading day open\" is not effected by this, only if we count on the after hours data).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgaborvecsei%2Fmad-money-backtesting","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgaborvecsei%2Fmad-money-backtesting","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgaborvecsei%2Fmad-money-backtesting/lists"}