{"id":31946421,"url":"https://github.com/marketcalls/openquest","last_synced_at":"2026-04-18T07:34:09.977Z","repository":{"id":316445658,"uuid":"1063374077","full_name":"marketcalls/openquest","owner":"marketcalls","description":"OpenQuest - Realtime Stock Data Aggregator in QuestDB with Tradingview Realtime Streaming Charts","archived":false,"fork":false,"pushed_at":"2025-09-25T09:33:55.000Z","size":140,"stargazers_count":2,"open_issues_count":2,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-23T11:53:39.888Z","etag":null,"topics":["daisyui","flask","python","questdb","tailwindcss","tradingview"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marketcalls.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-24T14:36:00.000Z","updated_at":"2025-10-04T16:54:01.000Z","dependencies_parsed_at":"2025-09-24T17:45:29.941Z","dependency_job_id":null,"html_url":"https://github.com/marketcalls/openquest","commit_stats":null,"previous_names":["marketcalls/realtime-stockdata-aggregation"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/marketcalls/openquest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marketcalls%2Fopenquest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marketcalls%2Fopenquest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marketcalls%2Fopenquest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marketcalls%2Fopenquest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marketcalls","download_url":"https://codeload.github.com/marketcalls/openquest/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marketcalls%2Fopenquest/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31961345,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T00:39:45.007Z","status":"online","status_checked_at":"2026-04-18T02:00:07.018Z","response_time":103,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["daisyui","flask","python","questdb","tailwindcss","tradingview"],"created_at":"2025-10-14T11:16:16.690Z","updated_at":"2026-04-18T07:34:09.927Z","avatar_url":"https://github.com/marketcalls.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OpenQuest - Real-Time Stock Data Aggregation Platform\n\n[![GitHub](https://img.shields.io/badge/GitHub-OpenQuest-blue)](https://github.com/marketcalls/openquest)\n[![License](https://img.shields.io/badge/License-AGPL--3.0-green)](LICENSE)\n[![Python](https://img.shields.io/badge/Python-3.11%2B-blue)](https://www.python.org/)\n[![QuestDB](https://img.shields.io/badge/QuestDB-Time--Series-orange)](https://questdb.io/)\n[![OpenAlgo](https://img.shields.io/badge/OpenAlgo-Compatible-purple)](https://github.com/marketcalls/openalgo)\n\nOpenQuest is a high-performance, zero-configuration real-time data aggregation tool designed for OpenAlgo. It seamlessly streams tick data from all OpenAlgo-supported exchanges (NSE, BSE, NFO, BFO, BCD, MCX) into QuestDB and provides professional-grade TradingView charts with proper IST timezone support.\n\n## 🚀 Features\n\n- **Zero Configuration**: Configure everything through the intuitive web UI\n- **Real-Time Streaming**: High-frequency LTP, Quote, and Depth data streams\n- **Multi-Exchange Support**: Automatic aggregation for NSE, BSE, NFO, BFO, BCD, and MCX symbols\n- **Professional Charts**: TradingView Lightweight Charts with IST timezone display and day stats (OHLC, Volume, Change %)\n- **Time-Series Database**: QuestDB for ultra-fast tick data storage and retrieval\n- **Modern UI**: Supabase green/black theme with TailwindCSS and DaisyUI\n- **Live Metrics**: Real-time monitoring of tick rates, spreads, and connection status\n- **Multi-Timeframe**: Support for 1m, 5m, 15m, 30m, 1h, and 1d candle aggregation\n- **Efficient Storage**: Optimized database schema for tick-level and aggregated data\n\n## 📋 Prerequisites\n\n- **Python 3.11+** - [Download Python](https://www.python.org/downloads/)\n- **QuestDB** - Running at `http://127.0.0.1:9000`\n- **OpenAlgo** - Running at:\n  - REST API: `http://127.0.0.1:5000`\n  - WebSocket: `ws://127.0.0.1:8765`\n\n## 🛠️ Installation\n\n### 1. Clone the Repository\n\n```bash\ngit clone https://github.com/marketcalls/openquest.git\ncd openquest\n```\n\n### 2. Install Dependencies\n\n```bash\npip install -r requirements.txt\n```\n\n### 3. Start QuestDB\n\nIf you don't have QuestDB running, start it using Docker:\n\n```bash\ndocker run -d \\\n  -p 9000:9000 \\\n  -p 9009:9009 \\\n  -p 8812:8812 \\\n  -p 9003:9003 \\\n  --name questdb \\\n  questdb/questdb\n```\n\nOr download and run QuestDB directly from [questdb.io](https://questdb.io/get-questdb/).\n\n### 4. Verify OpenAlgo is Running\n\nEnsure OpenAlgo is running and accessible:\n- REST API should respond at `http://127.0.0.1:5000/api/v1`\n- WebSocket should be available at `ws://127.0.0.1:8765`\n\n## 🚀 Quick Start\n\n### 1. Run the Application\n\n```bash\npython app.py\n```\n\n### 2. Access the Dashboard\n\nOpen your browser and navigate to:\n```\nhttp://127.0.0.1:5001\n```\n\n### 3. Configure OpenAlgo Connection\n\n1. Enter your **OpenAlgo API Key**\n2. Verify the REST API URL (default: `http://127.0.0.1:5000`)\n3. Verify the WebSocket URL (default: `ws://127.0.0.1:8765`)\n4. Select data streams to enable:\n   - **LTP** (Last Traded Price) - Essential for charts\n   - **Quote** - Bid/Ask prices and spreads\n   - **Depth** - Order book depth (5 levels)\n5. Click **\"Save Configuration\"**\n\n### 4. Start Streaming\n\nClick **\"Start Streaming\"** to begin real-time data aggregation.\n\n### 5. View Charts\n\nNavigate to the **Charts** tab to view real-time TradingView charts with:\n- Multiple timeframes (1m, 5m, 15m, 30m, 1h, 1d)\n- IST timezone display\n- Symbol selection dropdown\n- Professional trading indicators\n\n## 📊 Database Schema\n\nOpenQuest uses QuestDB with the following optimized schema:\n\n### ticks_ltp\n| Column | Type | Description |\n|--------|------|-------------|\n| timestamp | TIMESTAMP | Time of tick (IST) |\n| symbol | SYMBOL | Trading symbol |\n| ltp | DOUBLE | Last traded price |\n| volume | LONG | Last trade quantity (aggregated for candles) |\n\n### ticks_quote\n| Column | Type | Description |\n|--------|------|-------------|\n| timestamp | TIMESTAMP | Time of quote (IST) |\n| symbol | SYMBOL | Trading symbol |\n| ltp | DOUBLE | Last traded price |\n| open | DOUBLE | Day's opening price |\n| high | DOUBLE | Day's highest price |\n| low | DOUBLE | Day's lowest price |\n| close | DOUBLE | Current/closing price |\n| volume | LONG | Total traded volume |\n| last_trade_quantity | LONG | Quantity of last trade |\n| change | DOUBLE | Price change from open |\n| change_percent | DOUBLE | Price change percentage |\n| avg_trade_price | DOUBLE | Average trade price |\n\n### ticks_depth\n| Column | Type | Description |\n|--------|------|-------------|\n| timestamp | TIMESTAMP | Time of depth update (IST) |\n| symbol | SYMBOL | Trading symbol |\n| level | INT | Orderbook level (0-4) |\n| bid | DOUBLE | Bid price at level |\n| ask | DOUBLE | Ask price at level |\n| bid_qty | LONG | Bid quantity |\n| ask_qty | LONG | Ask quantity |\n| bid_orders | INT | Number of bid orders |\n| ask_orders | INT | Number of ask orders |\n\n## 🔌 API Endpoints\n\n### Core Endpoints\n\n| Endpoint | Method | Description |\n|----------|--------|-------------|\n| `/` | GET | Main dashboard UI |\n| `/chart` | GET | TradingView charts interface |\n| `/config` | GET/POST | Configuration management |\n| `/metrics` | GET | Real-time streaming metrics |\n| `/health` | GET | Application health check |\n\n### Control Endpoints\n\n| Endpoint | Method | Description |\n|----------|--------|-------------|\n| `/start_stream` | POST | Start data streaming |\n| `/stop_stream` | POST | Stop data streaming |\n| `/api/symbols` | GET | Get list of active symbols |\n| `/api/candles/\u003csymbol\u003e` | GET | Get historical candles |\n\n### Candles API Parameters\n\n```\nGET /api/candles/RELIANCE?timeframe=1m\u0026limit=500\n```\n\n- **symbol**: Trading symbol (required) - supports all OpenAlgo exchanges\n- **timeframe**: 1m, 5m, 15m, 30m, 1h, 1d (default: 1m)\n- **limit**: Number of candles to return (default: 500, max: 1000)\n\n## 🧪 Testing\n\n### Run Test Suite\n\n```bash\ncd test\npython test_connection.py\n```\n\nThis will verify:\n- QuestDB connection and data storage\n- API endpoints availability\n- WebSocket streaming status\n- Configuration validity\n\n### Manual Testing\n\n1. **Check QuestDB Data**:\n```sql\n-- Connect to QuestDB at http://127.0.0.1:9000\nSELECT * FROM ticks_ltp ORDER BY timestamp DESC LIMIT 10;\n```\n\n2. **Verify Streaming**:\n```bash\ncurl http://127.0.0.1:5001/metrics\n```\n\n3. **Test Chart Data**:\n```bash\ncurl http://127.0.0.1:5001/api/candles/RELIANCE?timeframe=1m\u0026limit=10\n```\n\n## 🎨 UI Features\n\n### Dashboard\n- Real-time connection status\n- Live tick counter\n- Active symbols display\n- Streaming control panel\n- Configuration interface\n\n### Charts\n- TradingView Lightweight Charts v4.1\n- IST timezone with proper display\n- Multiple timeframe support\n- Symbol selection dropdown\n- Real-time day statistics (Open, High, Low, Close, LTP, Change, Change %, Volume)\n- Volume indicators with actual traded volumes\n- Crosshair with price/time display\n\n### Metrics Panel\n- Ticks per second\n- Total tick count\n- Active symbols count\n- Spread analysis\n- Connection health\n\n## ⚙️ Configuration\n\n### config.json Structure\n\n```json\n{\n  \"api_key\": \"your-openalgo-api-key\",\n  \"rest_url\": \"http://127.0.0.1:5000\",\n  \"ws_url\": \"ws://127.0.0.1:8765\",\n  \"ltp_enabled\": true,\n  \"quote_enabled\": true,\n  \"depth_enabled\": false\n}\n```\n\n### Environment Variables (Optional)\n\n```bash\nexport QUESTDB_HOST=127.0.0.1\nexport QUESTDB_PORT=8812\nexport FLASK_PORT=5001\n```\n\n## 🐛 Troubleshooting\n\n### QuestDB Connection Issues\n\n1. **Verify QuestDB is running**:\n```bash\ncurl http://127.0.0.1:9000\n```\n\n2. **Check PostgreSQL wire protocol**:\n```bash\ntelnet 127.0.0.1 8812\n```\n\n3. **Reset tables if needed**:\n```sql\nDROP TABLE IF EXISTS ticks_ltp;\nDROP TABLE IF EXISTS ticks_quote;\nDROP TABLE IF EXISTS ticks_depth;\n```\n\n### No Data Flowing\n\n1. **Verify OpenAlgo WebSocket**:\n   - Check if OpenAlgo is running\n   - Verify API key is correct\n   - Ensure market hours (MCX: 9:00 AM - 11:30 PM IST)\n\n2. **Check logs**:\n```bash\npython app.py  # Check console output for detailed logs\n```\n\n3. **Test WebSocket connection**:\n```python\nimport websocket\nws = websocket.WebSocket()\nws.connect(\"ws://127.0.0.1:8765\")\n# Should connect without error\n```\n\n### Chart Display Issues\n\n1. **Timezone problems**:\n   - Charts display in IST automatically\n   - Hover tooltip shows correct IST time\n   - X-axis labels are formatted for IST\n\n2. **No candles showing**:\n   - Ensure LTP stream is enabled\n   - Wait for sufficient tick data\n   - Check browser console for errors\n\n## 📈 Performance\n\n- **Tick Processing**: ~10,000 ticks/second capability\n- **Database Write**: Batch inserts for efficiency\n- **Memory Usage**: \u003c 100MB typical\n- **CPU Usage**: \u003c 5% during normal operation\n- **Latency**: \u003c 10ms from tick to storage\n- **Volume Aggregation**: Uses actual `last_trade_quantity` from WebSocket data\n- **Price Aggregation**: Based on LTP (Last Traded Price) for accurate OHLC candles\n\n## 🤝 Contributing\n\nWe welcome contributions! Please see our [Contributing Guidelines](CONTRIBUTING.md) for details.\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/AmazingFeature`)\n3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)\n4. Push to the branch (`git push origin feature/AmazingFeature`)\n5. Open a Pull Request\n\n## 📄 License\n\nThis project is licensed under the GNU Affero General Public License v3.0 - see the [LICENSE](LICENSE) file for details.\n\n## 🙏 Acknowledgments\n\n- [OpenAlgo](https://github.com/marketcalls/openalgo) - Algorithmic trading platform\n- [QuestDB](https://questdb.io/) - High-performance time-series database\n- [TradingView Lightweight Charts](https://www.tradingview.com/lightweight-charts/) - Professional charting library\n- [Flask](https://flask.palletsprojects.com/) - Web framework\n- [TailwindCSS](https://tailwindcss.com/) \u0026 [DaisyUI](https://daisyui.com/) - UI styling\n\n## 📞 Support\n\nFor issues and feature requests, please [open an issue](https://github.com/marketcalls/openquest/issues) on GitHub.\n\nFor more information about OpenAlgo integration, visit [OpenAlgo Documentation](https://docs.openalgo.in/).\n\n---\n\n**Made with ❤️ by [MarketCalls](https://github.com/marketcalls)**","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarketcalls%2Fopenquest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarketcalls%2Fopenquest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarketcalls%2Fopenquest/lists"}