{"id":21233658,"url":"https://github.com/bdr-pro/stockmarket","last_synced_at":"2025-03-15T02:43:51.230Z","repository":{"id":232262076,"uuid":"783879772","full_name":"BDR-Pro/StockMarket","owner":"BDR-Pro","description":"📈 Simple Flask stock market simulator. Users can 🛒 buy \u0026 🛑 sell stocks, dynamically changing prices 📉 via API calls. Easy setup \u0026 curl examples included! 🚀","archived":false,"fork":false,"pushed_at":"2024-04-08T19:01:16.000Z","size":3375,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-21T18:37:14.115Z","etag":null,"topics":[],"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/BDR-Pro.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-04-08T18:54:24.000Z","updated_at":"2024-04-08T18:56:46.000Z","dependencies_parsed_at":null,"dependency_job_id":"dc438dae-78d3-44bd-9abe-eca39d4c3088","html_url":"https://github.com/BDR-Pro/StockMarket","commit_stats":null,"previous_names":["bdr-pro/stockmarket"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BDR-Pro%2FStockMarket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BDR-Pro%2FStockMarket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BDR-Pro%2FStockMarket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BDR-Pro%2FStockMarket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BDR-Pro","download_url":"https://codeload.github.com/BDR-Pro/StockMarket/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243676707,"owners_count":20329432,"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-20T23:59:50.830Z","updated_at":"2025-03-15T02:43:51.223Z","avatar_url":"https://github.com/BDR-Pro.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple Stock Market Simulator\n\nThis is a basic stock market simulator built with Flask for educational purposes. It simulates buying and selling a single stock, where each action affects the stock's price. The simulator includes three main operations: buying stock, selling stock, and checking the stock's current price and available quantity.\n\n## Getting Started\n\n### Prerequisites\n\n- Python 3.6 or later\n- Flask\n\n### Installation\n\nFirst, install Flask using pip if you haven't already:\n\n```bash\npip install Flask\n```\n\n### Running the Simulator\n\n1. Clone this repository or download the `stock_simulator.py` file.\n2. Navigate to the directory containing `stock_simulator.py`.\n3. Run the simulator using the following command:\n\n```bash\npython stock_simulator.py\n```\n\nThe simulator will start running on `http://localhost:5000`.\n\n## API Endpoints\n\n- **Buy Stock**: `/buy` (POST)\n- **Sell Stock**: `/sell` (POST)\n- **Check Stock**: `/stock` (GET)\n\n### Using `curl` to Interact with the Simulator\n\n**Buying Stock:**\n\nTo buy a quantity of stock, use the `/buy` endpoint with a POST request. Replace `amount` with the number of shares you wish to purchase.\n\n```bash\ncurl -X POST http://localhost:5000/buy -H \"Content-Type: application/json\" -d '{\"amount\": 10}'\n```\n\n**Selling Stock:**\n\nTo sell a quantity of stock, use the `/sell` endpoint with a POST request. Replace `amount` with the number of shares you wish to sell.\n\n```bash\ncurl -X POST http://localhost:5000/sell -H \"Content-Type: application/json\" -d '{\"amount\": 5}'\n```\n\n**Checking Stock Price and Quantity:**\n\nTo check the current stock price and available quantity, use the `/stock` endpoint with a GET request.\n\n```bash\ncurl http://localhost:5000/stock\n```\n\n## Note\n\nThis simulator is a simplified representation designed for educational purposes. Real-world trading systems involve more complex considerations such as market liquidity, transaction security, and regulatory compliance.\n\n----\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbdr-pro%2Fstockmarket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbdr-pro%2Fstockmarket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbdr-pro%2Fstockmarket/lists"}