Advanced financial sentiment analysis tool with policy impact assessment
Project description
๐ Stockholm Finance
Note: Pre-commit hooks are now active! ๐
Advanced financial sentiment analysis tool with policy impact assessment, intelligent caching, and professional dashboard interface.
๐ Quick Start
Installation
# From PyPI
pip install stockholm-finance
# From source
git clone https://github.com/aykaym/stockholm.git
cd stockholm
pip install -e .
Docker
# Run with Docker
docker run -it ghcr.io/aykaym/stockholm:latest
# Development environment
docker-compose up dev
Command Line Usage
# Run the main financial analyzer
stockholm-finance
# Launch the interactive dashboard
stockholm-dashboard
Python API Usage
from src.core.financial_analyzer import main
# Run analysis
main()
# Or use the dashboard
from src.ui.textual_dashboard import StockholmDashboard
dashboard = StockholmDashboard()
dashboard.run()
โจ Features
๐ฏ Core Analysis
- Sentiment Analysis: Advanced NLP for market sentiment from news articles
- Policy Analysis: Government policy impact assessment on markets
- Multi-Ticker Support: Analyze sentiment across multiple stocks simultaneously
- Real-time Data: Live market data integration with yfinance
๐พ Smart Caching
- TTL-based Caching: Intelligent cache expiration (15min news, 5min prices)
- Performance Optimization: 50+ cache reads/second, 20+ writes/second
- Storage Efficiency: Compressed JSON storage with automatic cleanup
๐ Interactive Dashboard
- Professional TUI: Rich terminal interface with real-time updates
- Multiple Views: Ticker info, earnings data, price charts, sentiment analysis
- Responsive Design: Adaptive layouts for different terminal sizes
๐งช Enterprise Testing
- 37+ Tests: Comprehensive test suite with 100% pass rate
- Coverage: 80% cache manager, 68% policy analyzer, 39% sentiment analyzer
- Performance: Benchmarked at 10+ articles/second processing
๐ Requirements
- Python: 3.8 or higher
- Dependencies: See
requirements.txt - Optional: Docker for containerized deployment
๐๏ธ Architecture
stockholm/
โโโ src/
โ โโโ core/ # Core analysis engines
โ โโโ data/ # Data fetching and caching
โ โโโ ui/ # User interface components
โ โโโ config/ # Configuration management
โโโ tests/ # Comprehensive test suite
โโโ docs/ # Documentation
โโโ scripts/ # DevOps and utility scripts
โโโ .github/ # CI/CD workflows
๐งช Testing
# Run all tests
python -m pytest tests/ -v
# With coverage
python -m pytest tests/ --cov=src --cov-report=html
# Performance tests
python -m pytest tests/test_performance.py -v
# Use the coverage checker
python check_coverage.py
๐ Development
Local Setup
# Clone repository
git clone https://github.com/yourusername/stockholm.git
cd stockholm
# Create virtual environment
python -m venv venv
source venv/bin/activate # Linux/Mac
venv\Scripts\activate # Windows
# Install dependencies
pip install -r requirements.txt
pip install -e ".[dev]"
# Run tests
python -m pytest tests/ -v
Docker Development
# Development environment
docker-compose up dev
# Run tests in container
docker-compose up test
# Code quality checks
docker-compose up quality
๐ฆ Releases
Automated Releases
The project uses automated versioning and releases:
# Create new release
python scripts/release.py
# Choose release type:
# - patch: Bug fixes (1.0.0 โ 1.0.1)
# - minor: New features (1.0.0 โ 1.1.0)
# - major: Breaking changes (1.0.0 โ 2.0.0)
CI/CD Pipeline
- โ Automated Testing: All Python versions (3.8-3.12)
- โ Security Scanning: Bandit + Safety vulnerability checks
- โ Code Quality: Black, isort, flake8, mypy
- โ Docker Images: Multi-platform builds
- โ GitHub Releases: Automatic changelog generation
๐ Performance
Benchmarks
- Sentiment Analysis: 10+ articles/second
- Cache Performance: 50+ reads/second, 20+ writes/second
- Memory Usage: <100MB for 1000 articles
- Test Suite: 37 tests in <1 second
Scalability
- Concurrent Processing: Multi-threaded analysis support
- Batch Operations: Efficient bulk data processing
- Memory Efficient: Optimized for large datasets
๐ Security
- Dependency Scanning: Automated vulnerability checks
- Code Analysis: Static security analysis with Bandit
- Input Validation: Sanitized data processing
- No Secrets: No hardcoded API keys or credentials
๐ Documentation
- Complete Documentation: Comprehensive user guide
- Testing Guide: Testing strategy and coverage
- DevOps Guide: CI/CD and deployment
- Coverage Report: Code coverage analysis
๐ค Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes with tests
- Run quality checks (
black src/ tests/ && pytest) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
- TextBlob: Natural language processing
- yfinance: Financial data API
- Textual: Modern terminal UI framework
- Rich: Beautiful terminal formatting
- pytest: Testing framework
๐ Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Documentation: Project Docs
Built with โค๏ธ for the financial analysis community
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file stockholm-finance-1.0.7.tar.gz.
File metadata
- Download URL: stockholm-finance-1.0.7.tar.gz
- Upload date:
- Size: 53.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b1b94d25eb923d41eb25a28172d3d0ddefef3a2b05d802252444f406ddfa9f2
|
|
| MD5 |
447d6a0d9b75415f9e6f43f50f177ab8
|
|
| BLAKE2b-256 |
be37ab8875cd661a5f57bf5ad0c10eb2ba437c505856ee6fce6269b4815d5266
|
Provenance
The following attestation bundles were made for stockholm-finance-1.0.7.tar.gz:
Publisher:
release.yml on aykaym/stockholm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
stockholm_finance-1.0.7.tar.gz -
Subject digest:
7b1b94d25eb923d41eb25a28172d3d0ddefef3a2b05d802252444f406ddfa9f2 - Sigstore transparency entry: 238612365
- Sigstore integration time:
-
Permalink:
aykaym/stockholm@33ae6e47544e9bfc082fd04b018771e956421d0c -
Branch / Tag:
refs/tags/v1.0.7 - Owner: https://github.com/aykaym
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@33ae6e47544e9bfc082fd04b018771e956421d0c -
Trigger Event:
push
-
Statement type:
File details
Details for the file stockholm_finance-1.0.7-py3-none-any.whl.
File metadata
- Download URL: stockholm_finance-1.0.7-py3-none-any.whl
- Upload date:
- Size: 59.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d1731376ce32740e1362b356c92a4e9a189c2d96573f7c2843a95247d6d5f1b7
|
|
| MD5 |
5bbb8edb58c8632e25c838a81dba5636
|
|
| BLAKE2b-256 |
aec0b2e106badd1f8933889a6d3196e5ad8464d9836212806412f9b94c65567c
|
Provenance
The following attestation bundles were made for stockholm_finance-1.0.7-py3-none-any.whl:
Publisher:
release.yml on aykaym/stockholm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
stockholm_finance-1.0.7-py3-none-any.whl -
Subject digest:
d1731376ce32740e1362b356c92a4e9a189c2d96573f7c2843a95247d6d5f1b7 - Sigstore transparency entry: 238612368
- Sigstore integration time:
-
Permalink:
aykaym/stockholm@33ae6e47544e9bfc082fd04b018771e956421d0c -
Branch / Tag:
refs/tags/v1.0.7 - Owner: https://github.com/aykaym
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@33ae6e47544e9bfc082fd04b018771e956421d0c -
Trigger Event:
push
-
Statement type: