A comprehensive web application for tracking MicroStrategy's mNAV (multiple Net Asset Value) with advanced scraping capabilities, multiple data sources, and real-time updates. Live at https://mnav-webhook.vercel.app
- π Real-time mNAV tracking - Multiple calculation methods (Simple, EV, Adjusted, Official)
- πΊ Big display mode - Large, centered mNAV display with auto-refresh
- π Daily updates - Automatic updates at midnight UTC
- π± Responsive design - Works on desktop and mobile
- π¨ Interactive tooltips - Hover over formulas to see calculations
- π€ Playwright browser automation - Handles JavaScript-heavy sites
- π External scraping services - ScrapingBee and Browserless integration
- π± Social media monitoring - Twitter and StockTwits for mNAV mentions
- π Alternative data sources - TradingView and financial APIs
- π Multiple fallback layers - Ensures data availability
- πΎ Persistent storage - Saves successful scrapes for reliability
- π Manual update interface - Admin can override mNAV values
- π Audit trail - Tracks all manual updates with reasons
- π Token authentication - Secure admin access
- π Status monitoring - Check scraping health and cache status
- π RESTful API with comprehensive data
- π Webhook support for integrations
- π₯ Health check and status endpoints
- π CORS enabled for cross-origin requests
https://mnav-webhook.vercel.app
-
Clone the repository
git clone https://github.com/localecho/mnav-webhook.git cd mnav-webhook -
Set up environment
cp .env.example .env # Edit .env with your API keys -
Install dependencies
pip install -r requirements.txt ./install_playwright.sh # Install browser for scraping -
Run the application
python app.py
-
Test the application
# View main page open http://localhost:5000 # Check API curl http://localhost:5000/api/mnav # Check status curl http://localhost:5000/api/status
-
Build the image
docker build -t mnav-api . -
Run the container
docker run -p 5000:8080 mnav-api
- URL:
/ - Method:
GET - Description: Shows mNAV value in large, centered display
- Query Parameters:
fund_code(optional): Specify fund code (default: 'default')
- Features:
- Large, centered NAV value display
- Fund name shown above the value
- Change indicator with color coding (green for positive, red for negative)
- Auto-refreshes every 30 seconds
- Dark theme for easy viewing
- Responsive design for mobile devices
- URL:
/api/health - Method:
GET - Description: Health status of the API
- Response:
{ "status": "healthy", "timestamp": "2024-01-01T00:00:00.000000", "service": "mnav-api", "version": "1.0.0" }
- URL:
/api/mnav - Method:
GET - Query Parameters:
fund_code(optional): Specific fund code
- Response:
{ "success": true, "data": { "fund_code": "FUND123", "fund_name": "Sample Fund FUND123", "nav": 125.45, "date": "2024-01-01", "change": 1.23, "change_percent": 0.99, "currency": "USD" } }
- URL:
/webhook/mnav - Method:
POST - Headers:
Content-Type: application/json - Body:
{ "fund_code": "FUND123", "nav": 125.45, "date": "2024-01-01" } - Response:
{ "success": true, "message": "Webhook received successfully", "id": 1 }
- URL:
/webhook/mnav/history - Method:
GET - Query Parameters:
page(default: 1)per_page(default: 10)
- Description: View webhook history for debugging
-
Fork/Clone this repository
-
Connect to Railway
- Go to Railway
- Click "New Project" β "Deploy from GitHub repo"
- Select your repository
-
Configure environment (optional)
- Add any required environment variables
-
Deploy
- Railway automatically builds and deploys
-
Install Heroku CLI
-
Create app
heroku create your-app-name
-
Deploy
git push heroku main
See DEPLOYMENT_GUIDE.md for detailed deployment instructions.
PORT: Server port (default: 5000)DEBUG: Enable debug mode (default: False)
# Install test dependencies
pip install pytest pytest-cov
# Run tests
pytest# View big display mode (open in browser)
open http://localhost:5000
# View display for specific fund
open http://localhost:5000?fund_code=TECH
# Health check
curl http://localhost:5000/api/health
# Get mNAV data
curl http://localhost:5000/api/mnav?fund_code=FUND123
# Send webhook
curl -X POST http://localhost:5000/webhook/mnav \
-H "Content-Type: application/json" \
-d '{"fund_code":"FUND123","nav":125.45,"date":"2024-01-01"}'When you visit the root URL (/), you'll see:
SAMPLE FUND DEFAULT
125.45
+1.23 (0.99%)
Last updated: 15:35:22
The display features:
- Extra large font size for the NAV value
- Color-coded change indicator (green/red)
- Dark background for reduced eye strain
- Auto-refresh every 30 seconds
- Mobile responsive design
mnav-api/
βββ app.py # Main application
βββ requirements.txt # Dependencies
βββ Dockerfile # Container config
βββ railway.json # Railway config
βββ Procfile # Process file
βββ README.md # This file
βββ DEPLOYMENT_GUIDE.md # Deployment guide
βββ .github/
βββ workflows/
βββ deploy.yml # CI/CD workflow
- Add route to
app.py - Update documentation
- Add tests
- Deploy
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open Pull Request
This project is open source and available under the MIT License.
For issues, questions, or contributions, please open an issue on GitHub.
Built with β€οΈ using Flask and deployed on Railway