A comprehensive Python-based financial analysis tool for stock market research and ticker analysis. This toolkit provides command-line interfaces for fetching, analyzing, and monitoring financial data from various sources.
- Comprehensive Financial Analysis: Complete company analysis including financial statements, ratios, and key metrics
- Magic Formula Screening: Implementation of Joel Greenblatt's Magic Formula for stock screening
- Financial Statements: Access to income statements, balance sheets, and cash flow statements
- Price Monitoring: Real-time price alerts and threshold monitoring
- Dividend Analysis: Historical dividend data and analysis
- Caching System: Intelligent caching to reduce API calls and improve performance
- Telegram Notifications: Real-time alerts via Telegram bot integration
- Rich Console Output: Beautiful, formatted output with colors and tables
This toolkit supports all financial instruments available on Yahoo Finance, including:
- Stocks: Companies from global exchanges (US, Europe, Asia, etc.)
- ETFs: Exchange-traded funds from various providers
- Mutual Funds: Traditional and index mutual funds
- Indices: Market indices (S&P 500, NASDAQ, etc.)
- Cryptocurrencies: Digital assets like Bitcoin, Ethereum
- Currencies: Forex pairs and currency exchange rates
- Bonds: Government and corporate bonds (limited availability)
- Commodities: Futures and commodity prices
All data is fetched from Yahoo Finance using the yfinance Python library, providing reliable and comprehensive financial data.
Ticker symbols vary by exchange and may include suffixes. To find the correct ticker:
- Go to Yahoo Finance
- Search for your asset (company name, ETF name, crypto, etc.)
- The ticker appears in the URL:
https://finance.yahoo.com/quote/TICKER/ - Use the full ticker including any exchange suffix
| Asset Type | Example | Ticker | Market/Country |
|---|---|---|---|
| US Stock | Apple Inc. | AAPL | NASDAQ (USA) |
| European Stock | SociΓ©tΓ© BIC | BB.PA | Euronext (France) |
| German Stock | SAP SE | SAP.DE | Xetra (Germany) |
| Dutch Stock | ASML Holding | ASML.AS | Euronext (Netherlands) |
| ETF | Vanguard S&P 500 | VOO | NYSE Arca (USA) |
| Crypto | Bitcoin | BTC-USD | Cryptocurrency |
| Index | S&P 500 | ^GSPC | US Market Index |
| Currency | EUR/USD | EURUSD=X | Forex |
Note: Some assets may have multiple listings. Always verify the ticker on Yahoo Finance for the most accurate data.
- Python 3.8+
- Virtual environment (recommended)
-
Clone the repository:
git clone https://github.com/marouane-dev75/market-research-toolkit.git cd market-research-toolkit -
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
Run the main script to see available commands:
python main.py --help-
Get comprehensive company analysis:
python main.py analysis AAPL
-
View financial statements:
python main.py income MSFT python main.py balance GOOGL yearly python main.py cashflow TSLA
-
Magic Formula screening:
python main.py magic AAPL,GOOGL,MSFT,NVDA,TSLA
-
Price monitoring:
python main.py price AAPL python main.py monitor --status
-
Company information:
python main.py info NVDA
| Command | Aliases | Description |
|---|---|---|
analysis |
a, analyze |
Comprehensive company analysis |
magic |
mf, magic_formula |
Magic Formula stock screening |
income |
inc |
Income statement data |
balance |
bal |
Balance sheet data |
cashflow |
cf |
Cash flow statement data |
dividend |
div |
Dividend history and analysis |
price |
p |
Historical price data |
info |
i |
Company information |
cache |
c |
Cache management |
monitor |
m, watch, alert |
Price monitoring |
# Comprehensive analysis
python main.py analysis AAPL
python main.py a GOOGL # Using alias
# Financial statements with different frequencies
python main.py income MSFT yearly
python main.py balance AAPL quarterly
python main.py cashflow TSLA
# Magic Formula screening
python main.py magic AAPL,GOOGL,MSFT
python main.py mf AAPL,GOOGL yearly
# Price and dividend data
python main.py price NVDA
python main.py dividend AAPL
# Cache management
python main.py cache status
python main.py cache clear AAPL
python main.py cache clear # Clear all
# Monitoring
python main.py monitor --status
python main.py monitor --testThe application uses a YAML configuration file located at src/ticker_analysis/config/config.yml. Key configuration options include:
application:
name: "Ticker Analysis Tool"
version: "1.0.0"
default_output_format: "console"
debug_mode: falsedata:
cache_directory: "cache_data"
cache:
company_info:
ttl_hours: 168 # 1 week
enabled: true
price_data:
ttl_hours: 24 # 1 day
enabled: truetelegram:
enabled: true
bot_token: "YOUR_BOT_TOKEN_HERE"
chat_id: "YOUR_CHAT_ID_HERE"
timeout_seconds: 30
retry_attempts: 3price_monitor:
enabled: true
thresholds:
- "AAPL:gt:150" # Alert when Apple > $150
- "MSFT:lt:300" # Alert when Microsoft < $300
- "GOOGL:gte:2500" # Alert when Google >= $2500-
Create a Telegram Bot:
- Open Telegram and search for
@BotFather - Send
/newbotand follow instructions - Copy the bot token
- Open Telegram and search for
-
Get Your Chat ID:
- Start a chat with your bot
- Send any message
- Visit:
https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates - Find your chat ID in the response
-
Update Configuration:
- Edit
src/ticker_analysis/config/config.yml - Replace
YOUR_BOT_TOKEN_HEREandYOUR_CHAT_ID_HERE
- Edit
Run the comprehensive integration test:
# Activate virtual environment first
source venv/bin/activate
# Run integration tests
python tests/test_integration_global.pyThe test suite validates all CLI commands with test tickers: AAPL, GOOGL, MSFT, NVDA, TSLA.
market-research-toolkit/
βββ main.py # Main entry point
βββ requirements.txt # Python dependencies
βββ src/ticker_analysis/ # Main package
β βββ config/ # Configuration management
β βββ core/ # Core business logic
β β βββ analysis/ # Financial analysis modules
β β βββ data/ # Data fetchers and models
β β βββ screening/ # Stock screening algorithms
β βββ infrastructure/ # Infrastructure services
β β βββ cache/ # Caching system
β β βββ monitoring/ # Price monitoring
β β βββ notifications/ # Notification providers
β βββ interfaces/ # User interfaces
β βββ cli/ # Command-line interface
β βββ console/ # Console formatting
βββ tests/ # Test suites
- Company Analysis: Comprehensive financial metrics and ratios
- Financial Statements: Income statements, balance sheets, cash flows
- Technical Analysis: Price trends and technical indicators
- Dividend Analysis: Dividend history, yield calculations, and trends
- Magic Formula: Joel Greenblatt's proven stock screening methodology
- Custom Metrics: Earnings yield and return on invested capital
- Ranking System: Automated ranking based on Magic Formula criteria
- Intelligent Caching: Configurable TTL for different data types
- Multiple Data Sources: Integration with Yahoo Finance and other providers
- Data Validation: Robust error handling and data validation
- Price Thresholds: Configurable price alerts with multiple operators
- Real-time Notifications: Telegram integration for instant alerts
- Monitoring Dashboard: Status monitoring and configuration testing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License.
For support, please:
- Check the documentation and examples above
- Run commands with
--helpflag for detailed usage - Enable debug mode with
--debugflag for troubleshooting - Open an issue on GitHub for bugs or feature requests