{"id":40316294,"url":"https://github.com/eddietal2/trading_simulator","last_synced_at":"2026-01-23T00:59:30.064Z","repository":{"id":331662124,"uuid":"1131742852","full_name":"eddietal2/trading_simulator","owner":"eddietal2","description":"Trading Simulator for the Stock Market","archived":false,"fork":false,"pushed_at":"2026-01-11T03:12:55.000Z","size":5176,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-11T05:03:59.479Z","etag":null,"topics":["python","simulation","stock-market"],"latest_commit_sha":null,"homepage":"","language":"Python","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/eddietal2.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-10T16:00:16.000Z","updated_at":"2026-01-11T03:12:59.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/eddietal2/trading_simulator","commit_stats":null,"previous_names":["eddietal2/trading_simulator"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/eddietal2/trading_simulator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddietal2%2Ftrading_simulator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddietal2%2Ftrading_simulator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddietal2%2Ftrading_simulator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddietal2%2Ftrading_simulator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eddietal2","download_url":"https://codeload.github.com/eddietal2/trading_simulator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddietal2%2Ftrading_simulator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28597985,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T02:08:49.799Z","status":"ssl_error","status_checked_at":"2026-01-20T02:08:44.148Z","response_time":117,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["python","simulation","stock-market"],"created_at":"2026-01-20T07:00:40.584Z","updated_at":"2026-01-23T00:59:30.044Z","avatar_url":"https://github.com/eddietal2.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"demo/TS_Video_03.gif\" alt=\"Trading Simulator Demo\" width=\"800\"/\u003e\n\u003c/p\u003e\n\n## 🎮 TRY ME\n\n[![Run on Replit](https://replit.com/badge/github/eddietal2/trading_simulator)](https://replit.com/github/eddietal2/trading_simulator)\n\n\u003e Click the badge above to run the simulator in your browser!\n\n---\n\n# Trading Simulator\n\nA comprehensive Python application featuring two distinct trading simulation engines: **Exponential Growth** and **Baseline Harvest Engine**. Perfect for analyzing different investment strategies and risk management approaches.\n\n## 🚀 Features\n\n- **Two Simulation Types**: Choose between compound growth or harvest-based strategies\n- **Dynamic Start Date**: Simulations automatically start from the current week's Monday\n- **Interactive CLI**: Colorful, user-friendly command-line interface\n- **Parameter Persistence**: Save and re-run previous simulations instantly\n- **Comprehensive Reporting**: Weekly breakdowns, monthly summaries, and charts\n- **Professional Output**: Text reports and matplotlib visualizations\n- **Extensible Architecture**: Clean, modular design for easy enhancement\n\n## 📊 Simulation Types\n\n### 1. Exponential Growth Simulator\n- **Strategy**: Pure compound interest growth\n- **Formula**: `A = P(1 + r)^n`\n- **Use Case**: Traditional investment growth modeling\n- **Risk Profile**: High growth potential with compounding\n\n### 2. Baseline Harvest Engine\n- **Strategy**: Accumulation phase → Distribution phase\n- **Phases**: Build to cap → Harvest excess profits\n- **Use Case**: Risk-managed trading with profit extraction\n- **Risk Profile**: Controlled growth with systematic withdrawals\n\n## 🏗️ Architecture\n\nFor a detailed view of the application architecture, see [architecture/architecture.md](architecture/architecture.md).\n\nTo regenerate the architecture diagram:\n\n```bash\npython architecture/generate_architecture.py\n```\n\n## 📦 Installation\n\n1. **Prerequisites**: Python 3.8+\n2. **Virtual Environment** (recommended):\n   ```bash\n   python -m venv .venv\n   # Windows:\n   .venv\\Scripts\\Activate.ps1\n   # macOS/Linux:\n   source .venv/bin/activate\n   ```\n3. **Install Package**:\n   ```bash\n   pip install -e .\n   ```\n\n## 🎯 Usage\n\n### Start the Simulator\n```bash\nstart-simulator\n```\n\n### Direct Execution\n```bash\npython -m simulator.main\n```\n\n### Clear Output Directory\n```bash\nclear-output\n```\n\n### Re-run Last Simulation\nChoose option `3` from the main menu to instantly re-run your previous simulation with saved parameters.\n\n## ⚙️ Simulation Parameters\n\n### Start Date Logic\nThe simulation automatically determines its start date based on the current day:\n- **Weekdays (Mon-Fri)**: Starts from the most recent Monday\n- **Weekends (Sat-Sun)**: Starts from the upcoming Monday\n\n*Example: If today is Sunday 1/11, simulation starts Monday 1/12. If today is Wednesday 1/08, simulation starts Monday 1/05.*\n\n### Common Parameters\n- `initial_pot`: Starting investment amount (default: $1,000)\n- `total_weeks`: Simulation duration in weeks (default: 52)\n\n### Exponential Growth Parameters\n- `weekly_return_rate`: Annual return rate as decimal (default: 0.25 = 25%)\n\n### Baseline Harvest Engine Parameters\n- `weekly_return_rate`: Weekly return rate (default: 0.25 = 25%)\n- `engine_cap`: Maximum pot size before distribution (default: $10,000)\n- `growth_vault_pct`: Vault allocation during growth phase (default: 50%)\n- `harvest_vault_pct`: Vault allocation during harvest phase (default: 25%)\n\n## 📈 Exponential Growth Simulation\n\n**Strategy Overview:**\n- Continuous compound growth\n- No profit extraction during simulation\n- Focus on long-term capital appreciation\n\n**Example Parameters:**\n- Initial Amount: $1,000\n- Weekly Return: 25%\n- Duration: 52 weeks\n\n**Expected Outcome:**\n- Final Amount: ~$1,000 × (1.25)^52\n- Growth Focus: Pure capital accumulation\n\n## 🌾 Baseline Harvest Engine Simulation\n\n**Strategy Overview:**\n- **Phase 1 (Accumulation)**: Reinvest all profits until reaching engine cap\n- **Phase 2 (Distribution)**: Lock pot at cap, systematically withdraw excess profits\n- **Risk Management**: No withdrawals during deficit periods\n\n**Key Rules:**\n1. **Starting Point**: Begin with initial investment\n2. **Growth Phase**: 100% reinvestment until engine cap reached\n3. **Harvest Phase**: Excess profits split between vault and spending\n4. **Deficit Protection**: No distributions if pot falls below cap\n5. **50/50 Split**: Withdrawals divided equally between savings and spending\n\n**Example Parameters:**\n- Initial Amount: $220\n- Weekly Return: 25%\n- Engine Cap: $10,000\n- Duration: 52 weeks\n\n**Typical Results:**\n- **Engine Hit**: Week 18 (when pot reaches $10,000)\n- **Final Pot**: $10,000 (locked)\n- **Total Vault**: $43,606.23 (accumulated savings)\n- **Total Spend**: $43,606.23 (available for spending)\n\n## 📊 Output Formats\n\nEach simulation generates:\n\n### Text Report (`simulation.txt`)\n- Weekly breakdown with dates\n- Monthly summary tables\n- Final statistics\n- Parameter summary\n\n### Chart (`plot.png`)\n- Time series visualization\n- Multiple data streams (pot, vault, spend)\n- Professional matplotlib styling\n\n### Directory Structure\n```\noutput/\n└── run_exponential_2026-01-10_14-30-45/\n    ├── simulation.txt\n    └── plot.png\n```\n\n## 🔧 Technical Details\n\n### Dependencies\n- `numpy`: Numerical computations\n- `matplotlib`: Chart generation\n- `colorama`: Cross-platform terminal colors\n- `pytest`: Testing framework\n\n### Architecture Components\n- **CLI Layer**: User interface and input handling\n- **Simulation Engine**: Core algorithms for both strategies\n- **Data Processing**: Report generation and time series analysis\n- **File Management**: Output organization and parameter persistence\n\n### File Structure\n```\ntrading_simulator/\n├── src/simulator/\n│   ├── main.py           # CLI interface and orchestration\n│   └── simulation.py     # Core simulation algorithms\n├── tests/\n│   └── test_simulation.py # Comprehensive test suite\n├── architecture/\n│   ├── generate_architecture.py\n│   └── architecture.md\n├── output/               # Generated reports and charts\n├── demo/                 # Demo files and media\n└── pyproject.toml       # Project configuration\n```\n\n## 🤝 Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Add tests for new functionality\n4. Ensure all tests pass\n5. Submit a pull request\n\n## 📄 License\n\nThis project is open source. See LICENSE file for details.\n\n---\n\n**Built with ❤️ for educational and analytical purposes**","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feddietal2%2Ftrading_simulator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feddietal2%2Ftrading_simulator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feddietal2%2Ftrading_simulator/lists"}