{"id":26749317,"url":"https://github.com/jialuechen/genmarket","last_synced_at":"2025-04-06T18:16:46.689Z","repository":{"id":247510658,"uuid":"805510719","full_name":"jialuechen/genmarket","owner":"jialuechen","description":"Python Market Simulation Engine Built on top of Generative AI","archived":false,"fork":false,"pushed_at":"2025-04-02T04:14:40.000Z","size":4236,"stargazers_count":104,"open_issues_count":3,"forks_count":9,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-06T18:16:27.162Z","etag":null,"topics":["attention-mechanism","diffusion-models","event-driven","execution","market-making","portfolio-optimization","quant-finance","transformer","vae"],"latest_commit_sha":null,"homepage":"https://jialuechen.github.io/genmarket/","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/jialuechen.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}},"created_at":"2024-05-24T18:30:01.000Z","updated_at":"2025-04-02T04:14:44.000Z","dependencies_parsed_at":"2024-08-25T02:44:14.429Z","dependency_job_id":"5dd7c8a4-e39c-4db1-ba4d-0b3746a7eaec","html_url":"https://github.com/jialuechen/genmarket","commit_stats":null,"previous_names":["jialuechen/deepfolio","jialuechen/genmarket"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jialuechen%2Fgenmarket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jialuechen%2Fgenmarket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jialuechen%2Fgenmarket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jialuechen%2Fgenmarket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jialuechen","download_url":"https://codeload.github.com/jialuechen/genmarket/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247526768,"owners_count":20953143,"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":["attention-mechanism","diffusion-models","event-driven","execution","market-making","portfolio-optimization","quant-finance","transformer","vae"],"created_at":"2025-03-28T11:10:22.392Z","updated_at":"2025-04-06T18:16:46.683Z","avatar_url":"https://github.com/jialuechen.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GenMarket : Market Simulation by Generation\n\n**GenMarket** is a modular, multi-layer generative market simulation framework designed to evaluate trading strategies and market impact under synthetic yet realistic conditions.\n\nIt combines macro regime generation, high-frequency order flow simulation, LOB microstructure modeling, and plug-in execution strategies (e.g. VWAP, TWAP), supporting both controlled experimentation and generative scenario construction.\n\n---\n\n## 🚀 Features\n\n- **Multi-layer simulation**  \n  Top-down generation from macro regimes → order flow → limit order book (LOB).\n\n- **Scenario generation**  \n  Uses VAE/Diffusion model stubs to create synthetic market conditions beyond historical replay.\n\n- **Order flow modeling**  \n  Autoregressive event-level generator simulates realistic buy/sell order streams.\n\n- **LOB simulation engine**  \n  Matches orders with queue logic and customizable liquidity depth.\n\n- **Built-in execution strategies**  \n  Plug-and-play VWAP and TWAP strategies for benchmark testing.\n\n- **Market impact evaluation**  \n  Measures execution price, slippage, and volume impact.\n\n- **Visualization**  \n  Plot order flow, execution trajectory, and size dynamics.\n\n---\n\n## 🧱 Installation\n\n```bash\npip install --upgrade genmarket\n```\n\n---\n\n## 📄 Example Config (`configs/market_crash_scenario.json`)\n\n```json\n{\n  \"regime\": \"volatile\",\n  \"volatility\": 0.35,\n  \"liquidity\": \"low\",\n  \"lob\": {\n    \"levels\": 5,\n    \"latency_ms\": 10\n  },\n  \"strategy\": {\n    \"type\": \"vwap\",\n    \"params\": {\n      \"target_volume\": 100,\n      \"time_horizon\": 10\n    }\n  }\n}\n```\n\n---\n\n## 🧪 Run a Simulation\n\n```bash\npython examples/run_simulation.py\n```\n\n```python\nfrom genmarket import GenMarket\nfrom genmarket.plotting import plot_executions\nimport json\n\nwith open(\"configs/market_crash_scenario.json\") as f:\n    config = json.load(f)\n\ngm = GenMarket(config)\nmetrics = gm.run()\n\nprint(\"Simulation Metrics:\")\nfor k, v in metrics.items():\n    print(f\"{k}: {v}\")\n\n# Visualize execution result\nplot_executions(metrics.get(\"executions\", []))\n```\n\n---\n\n## 🧩 Strategy Plugins\n\n- `VWAPStrategy` – Volume-weighted execution across time horizon  \n- `TWAPStrategy` – Time-weighted slices across fixed intervals  \n\nYou can create your own strategies and add them under `genmarket/strategy_plugins/`.\n\n---\n\n## 🔬 Applications\n\n- Strategy benchmarking under stress scenarios  \n- Execution cost modeling and market impact analysis  \n- Synthetic data generation for pre-trade analytics  \n- Reinforcement learning environment (future support)\n\n---\n\n## 📅 Roadmap\n\n- [ ] Integrate pretrained diffusion/VAE market generators  \n- [ ] Add LLM-driven natural language scenario parser  \n- [ ] Extend to multi-asset \u0026 cross-venue simulation  \n- [ ] Add dashboard interface for real-time simulation control\n\n---\n\n## 📜 License\n\nMIT License. See `LICENSE`.\n\n---\n\n## 📚 Citation\n\n```\n@misc{genmarket2025,\n  title   = {GenMarket: A Multi-Layer Generative Market Simulation Framework},\n  author  = {Jialue Chen},\n  year    = {2025},\n  note    = {https://github.com/jialuechen/genmarket}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjialuechen%2Fgenmarket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjialuechen%2Fgenmarket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjialuechen%2Fgenmarket/lists"}