{"id":30240177,"url":"https://github.com/shubhs27/stock-analyzer","last_synced_at":"2026-04-04T22:31:19.584Z","repository":{"id":298505113,"uuid":"1000141706","full_name":"shubhs27/Stock-Analyzer","owner":"shubhs27","description":"A Django-based web application for visualizing stock market data with interactive candlestick charts and volume analysis.","archived":false,"fork":false,"pushed_at":"2025-08-03T13:21:04.000Z","size":1260,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-15T04:19:06.339Z","etag":null,"topics":["aws-ec2","django","docker","nginx","plotly","postgresql","stock-analysis"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shubhs27.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,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-11T10:25:20.000Z","updated_at":"2025-08-03T13:22:53.000Z","dependencies_parsed_at":"2025-08-03T15:07:51.987Z","dependency_job_id":"50aebe47-8e71-441e-852b-502d765065ba","html_url":"https://github.com/shubhs27/Stock-Analyzer","commit_stats":null,"previous_names":["shubhs27/django-stock-analyzer"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/shubhs27/Stock-Analyzer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shubhs27%2FStock-Analyzer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shubhs27%2FStock-Analyzer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shubhs27%2FStock-Analyzer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shubhs27%2FStock-Analyzer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shubhs27","download_url":"https://codeload.github.com/shubhs27/Stock-Analyzer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shubhs27%2FStock-Analyzer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31416770,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T20:09:54.854Z","status":"ssl_error","status_checked_at":"2026-04-04T20:09:44.350Z","response_time":60,"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":["aws-ec2","django","docker","nginx","plotly","postgresql","stock-analysis"],"created_at":"2025-08-15T04:11:23.420Z","updated_at":"2026-04-04T22:31:19.576Z","avatar_url":"https://github.com/shubhs27.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Stock Market Analyzer\n\nA Django-based web application for visualizing stock market data with interactive candlestick charts and volume analysis. Built with PostgreSQL database backend and containerized with Docker.\n\n## Features\n\n- **Interactive Candlestick Charts**: Professional-grade OHLC (Open, High, Low, Close) visualization using Plotly.js\n- **Volume Analysis**: Color-coded volume bars showing market sentiment\n- **Multiple Time Aggregations**: View data in daily, weekly, or monthly intervals\n- **CSV Data Import**: Bulk import stock data from CSV files\n- **Data Export**: Download filtered data as CSV\n- **Responsive Design**: Works seamlessly across desktop and mobile devices\n- **Docker Support**: Easy deployment with Docker and Docker Compose\n\n## Screenshots\n\n### Home Page\n\n![Home Page](static/images/home.png)\n\n### Monthly Analysis\n\n![Monthly Chart](static/images/monthly.png)\n\n### Weekly Aggregation\n\n![Weekly Chart](static/images/weekly.png)\n\n### Daily View\n\n![Daily Chart](static/images/daily.png)\n\n## Technology Stack\n\n- **Backend**: Django 4.x, Python 3.x\n- **Database**: PostgreSQL\n- **Frontend**: HTML5, CSS3, JavaScript\n- **Visualization**: Plotly.js\n- **Containerization**: Docker, Docker Compose\n- **Web Server**: Nginx (production)\n\n## Project Structure\n\n```\nSTOCK_VIEWER/\n├── docker-compose.yml          # Docker orchestration\n├── Dockerfile                  # Django app container\n├── nginx.conf                  # Nginx configuration\n├── requirements.txt            # Python dependencies\n├── manage.py                   # Django management script\n├── load_data.py               # CSV import script\n├── stock_viewer/              # Django project settings\n│   ├── settings.py\n│   ├── urls.py\n│   └── wsgi.py\n├── stocks/                    # Main Django app\n│   ├── models.py             # Database models\n│   ├── views.py              # View controllers\n│   ├── urls.py               # URL routing\n│   └── migrations/           # Database migrations\n├── templates/stocks/          # HTML templates\n│   └── index.html\n├── static/                    # Static assets\n│   ├── css/style.css\n│   ├── js/script.js\n│   └── images/               # Screenshots\n├── StocksData/               # CSV data directory\n└── .env                      # Environment variables\n```\n\n## Quick Start\n\n### Prerequisites\n\n- Docker and Docker Compose\n- Python 3.8+ (for local development)\n- Git\n\n### 1. Clone the Repository\n\n```bash\ngit clone \u003crepository-url\u003e\ncd stock_viewer\n```\n\n### 2. Environment Setup\n\nCreate a `.env` file in the root directory:\n\n```env\n# Database Configuration\nDB_NAME=stock_db\nDB_USER=stock_user\nDB_PASSWORD=your_secure_password\nDB_HOST=db\nDB_PORT=5432\n\n# Django Configuration\nSECRET_KEY=your-super-secret-django-key-here\nDEBUG=True\n```\n\n### 3. Docker Deployment\n\n```bash\n# Build and start all services\ndocker-compose up --build\n\n# Run in background\ndocker-compose up -d --build\n```\n\nThe application will be available at `http://localhost:8080`\n\n### 4. Import Stock Data\n\nPlace your CSV files in the `StocksData/` directory with the following format:\n\n```csv\nDate,Open,High,Low,Close/Last,Volume\n01/03/2023,$150.20,$155.40,$149.80,$154.90,1250000\n```\n\nRun the data import script:\n\n```bash\n# Using Docker\ndocker-compose exec web python load_data.py\n\n# Or locally\npython load_data.py\n```\n\n## Development Setup\n\n### Local Development\n\n1. **Create Virtual Environment**:\n\n```bash\npython -m venv venv\nsource venv/bin/activate  # Linux/Mac\n# or\nvenv\\Scripts\\activate     # Windows\n```\n\n2. **Install Dependencies**:\n\n```bash\npip install -r requirements.txt\n```\n\n3. **Setup Database**:\n\n```bash\n# Make sure PostgreSQL is running locally\npython manage.py makemigrations\npython manage.py migrate\n```\n\n4. **Run Development Server**:\n\n```bash\npython manage.py runserver\n```\n\n## API Endpoints\n\n### Chart Data API\n\n- **URL**: `/api/chart-data/`\n- **Method**: POST\n- **Content-Type**: `application/json`\n\n**Request Body**:\n\n```json\n{\n  \"company_id\": 1,\n  \"start_date\": \"2023-01-01\",\n  \"end_date\": \"2023-12-31\",\n  \"aggregation\": \"daily\"\n}\n```\n\n**Response**:\n\n```json\n{\n  \"chart_data\": {\n    \"dates\": [\"2023-01-01\", \"2023-01-02\"],\n    \"opens\": [150.2, 154.9],\n    \"highs\": [155.4, 158.3],\n    \"lows\": [149.8, 153.2],\n    \"closes\": [154.9, 157.8],\n    \"volumes\": [1250000, 1100000]\n  },\n  \"data_points\": 2,\n  \"company_name\": \"AAPL\",\n  \"aggregation\": \"daily\"\n}\n```\n\n## Database Schema\n\n### Companies Table\n\n```sql\nCREATE TABLE stocks_company (\n    id SERIAL PRIMARY KEY,\n    name VARCHAR(100) UNIQUE,\n    symbol VARCHAR(10) UNIQUE,\n    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP\n);\n```\n\n### Stock Data Table\n\n```sql\nCREATE TABLE ohlc_data (\n    id SERIAL PRIMARY KEY,\n    company_symbol VARCHAR(10),\n    date DATE,\n    open DECIMAL(10,2),\n    high DECIMAL(10,2),\n    low DECIMAL(10,2),\n    close DECIMAL(10,2),\n    volume BIGINT,\n    file_source VARCHAR(50),\n    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n    UNIQUE(company_symbol, date)\n);\n```\n\n## Data Import Format\n\nYour CSV files should follow this format:\n\n```csv\nDate,Open,High,Low,Close/Last,Volume\n01/03/2023,$150.20,$155.40,$149.80,$154.90,1250000\n01/04/2023,$154.90,$158.30,$153.20,$157.80,1100000\n```\n\n**Supported formats**:\n\n- Date format: `MM/DD/YYYY`\n- Price columns can include `$` symbol (automatically cleaned)\n- File naming: `COMPANY_SYMBOL.csv` (e.g., `AAPL.csv`)\n\n### Docker Services\n\n- **web**: Django application server\n- **db**: PostgreSQL database\n- **nginx**: Reverse proxy and static file server\n\n## Troubleshooting\n\n### Common Issues\n\n1. **Database Connection Error**:\n\n   - Ensure PostgreSQL is running\n   - Check database credentials in `.env`\n   - Verify network connectivity between containers\n\n2. **CSV Import Fails**:\n\n   - Check CSV format matches expected structure\n   - Ensure date format is `MM/DD/YYYY`\n   - Verify file permissions\n\n3. **Chart Not Loading**:\n   - Check browser console for JavaScript errors\n   - Ensure API endpoint is accessible\n   - Verify data exists for selected date range\n\n### Logs\n\n```bash\n# View application logs\ndocker-compose logs web\n\n# View database logs\ndocker-compose logs db\n\n# Follow logs in real-time\ndocker-compose logs -f\n```\n\n## Future Enhancements\n\n- **Real-time Data Integration**: Live market data feeds with WebSocket support for automatic price updates and streaming quotes\n- **Technical Indicators**: RSI, MACD, Bollinger Bands, moving averages, and other momentum/volatility indicators\n- **Portfolio Management Features**: Track multiple portfolios, transactions, performance analytics, and asset allocation\n- **Comparison Tools**: Side-by-side chart comparisons, peer analysis, and performance benchmarking\n- **User Authentication**: Secure login, personal dashboards, watchlists, and role-based access control\n- **Machine Learning Capabilities**: Price forecasting, pattern recognition, sentiment analysis, and automated trading signals\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshubhs27%2Fstock-analyzer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshubhs27%2Fstock-analyzer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshubhs27%2Fstock-analyzer/lists"}