Complete overview of the Bazaar project file organization.
bazaar/
│
├── main.py # Main application entry point
├── data_fetcher.py # Data fetching module (Yahoo Finance API)
├── ui_components.py # UI sections and components
│
├── requirements.txt # Python dependencies
├── .gitignore # Git ignore patterns
├── VERSION # Current version number
│
├── README.md # Complete documentation
├── QUICKSTART.md # Quick start guide
├── FEATURES.md # Features overview
├── CHANGELOG.md # Version history and changes
├── PROJECT_STRUCTURE.md # This file
│
├── setup.sh # Setup script (Linux/macOS)
├── setup.bat # Setup script (Windows)
├── run.sh # Launch script (Linux/macOS)
├── run.bat # Launch script (Windows)
│
└── test_connection.py # System compatibility test script
Purpose: Main application entry point and UI coordinator
Key Components:
BazaarAppclass - Main application controller- UI initialization and layout
- Auto-refresh mechanism
- Window management
- Theme application
Dependencies: tkinter, threading, ui_components, data_fetcher
Purpose: Handles all data fetching operations
Key Components:
DataFetcherclass - Data retrieval coordinator- Methods for fetching:
- Index data (Nifty, Sensex, Bank Nifty, VIX)
- Market summary
- Gainers and losers
- Sectoral performance
- Fear/Greed indicator
Data Sources: Yahoo Finance via yfinance library
Key Features:
- Error handling for network issues
- Data caching and formatting
- Support for multiple indices
- Configurable stock lists
Purpose: Modular UI sections and display components
Key Components:
BaseSection- Abstract base class for all sectionsMarketSummarySection- Market status and overviewTickerSection- Index ticker displaysGainersLosersSection- Top performers and underperformersVixGreedSection- Volatility and sentiment indicatorsSectoralPerformanceSection- Sector performance bars
Design Pattern: Each section is independent and self-contained
Purpose: Python package dependencies
Contents:
yfinance>=0.2.32 # Stock market data
pandas>=2.0.0 # Data manipulation
requests>=2.31.0 # HTTP requests
Size Impact: ~30-40 MB installed
Purpose: Exclude unnecessary files from version control
Excludes:
- Python cache files (
__pycache__,*.pyc) - Virtual environments (
venv/,env/) - IDE files (
.vscode/,.idea/) - Build artifacts (
dist/,build/) - OS files (
.DS_Store,Thumbs.db)
Sections:
- Features overview
- Installation instructions
- Usage guide
- Configuration options
- Troubleshooting
- Contribution guidelines
Target Audience: All users (beginners to advanced)
Focus: Get running in 3 steps
- Prerequisites check
- Installation options
- Running the app
- Basic troubleshooting
Target Audience: New users wanting immediate results
Content:
- Detailed feature descriptions
- Visual examples
- Use cases
- Design rationale
- Future enhancements
Target Audience: Users wanting to understand capabilities
Content:
- Version releases
- New features
- Bug fixes
- Breaking changes
- Planned features
Format: Keep a Changelog standard
Content:
- File organization
- Architecture overview
- Module relationships
- Customization guide
Target Audience: Developers and contributors
Purpose: Automated setup on different platforms
Actions:
- Check Python installation
- Verify pip availability
- Install dependencies from requirements.txt
- Display success/error messages
Platform:
.shfor Linux/macOS.batfor Windows
Usage:
./scripts/setup.sh # Linux/macOS
scripts\setup.bat # WindowsPurpose: Quick launch scripts
Actions:
- Check if dependencies are installed
- Run setup if needed
- Launch main.py
Benefit: One-click execution
Usage:
./scripts/run.sh # Linux/macOS
scripts\run.bat # WindowsPurpose: Pre-flight system check
Tests:
- Python version compatibility
- Required module imports
- Data connection to Yahoo Finance
- UI component creation
Usage: Run before first launch to verify setup
┌─────────────────────────────────────┐
│ main.py │
│ (Controller) │
├─────────────────────────────────────┤
│ - Window Management │
│ - Theme Application │
│ - Auto-refresh Coordinator │
│ - Section Initialization │
└───────────┬─────────────────────────┘
│
├───────────────────────────────┐
│ │
▼ ▼
┌───────────────────────┐ ┌───────────────────────┐
│ ui_components.py │ │ data_fetcher.py │
│ (View Layer) │ │ (Data Layer) │
├───────────────────────┤ ├───────────────────────┤
│ - BaseSection │ │ - DataFetcher │
│ - MarketSummary │◄──┤ - get_index_data() │
│ - TickerSection │◄──┤ - get_gainers() │
│ - GainersLosers │◄──┤ - get_sectoral() │
│ - VixGreed │◄──┤ - get_vix() │
│ - SectoralPerf │◄──┤ │
└───────────────────────┘ └───────────┬───────────┘
│
▼
┌───────────────────────┐
│ Yahoo Finance API │
│ (via yfinance) │
└───────────────────────┘
- User launches app →
main.pyinitializes - BazaarApp created → Initializes DataFetcher and UI components
- Sections created → Each section registers with main app
- Initial data fetch → refresh_data() called
- Threading → Data fetched in background thread
- UI update → Each section's update() method called
- Auto-refresh → Repeats every 60 seconds
- Create section class in
ui_components.py:
class MyNewSection(BaseSection):
def __init__(self, parent, colors, data_fetcher):
super().__init__(parent, colors, data_fetcher, "My Section")
def update(self):
self.clear_content()
# Your update logic here- Register in main.py:
self.my_section = MyNewSection(
self.scrollable_frame, self.colors, self.data_fetcher
)
self.sections.append(self.my_section)- Add method to
DataFetcherclass indata_fetcher.py:
def get_my_data(self):
# Fetch and return data
return data- Call from section:
data = self.data_fetcher.get_my_data()Edit color dictionary in main.py:
self.colors = {
'bg': '#ECE9D8', # Background
'fg': '#000000', # Text
'header': '#0054E3', # Header bar
# ... add more colors
}| Component | Size |
|---|---|
| Python scripts | ~30 KB |
| yfinance | ~15 MB |
| pandas | ~40 MB |
| requests | ~2 MB |
| Dependencies | ~30 MB |
| Total | ~90 MB |
- Use
--exclude-modulewith PyInstaller - Remove unused pandas features
- Use minimal pandas build
- Compress with UPX
- Windows: ~60-80 MB
- macOS: ~70-90 MB
- Linux: ~60-80 MB
- Only connects to Yahoo Finance API
- No user data is transmitted
- No API keys or authentication
- No data is stored permanently
- No user tracking
- No external analytics
- No eval() or exec() usage
- No dynamic code execution
- Input validation on dropdowns
- Run
test_connection.py - Verify each section displays correctly
- Test dropdown functionality
- Test refresh button
- Test auto-refresh
- Test different market conditions (open/closed)
- Unit tests for DataFetcher methods
- UI component tests
- Integration tests
- Mock API responses
Best for: Developers, Python users Size: ~30 KB (just the code) Requires: User installs Python + dependencies
Best for: End users Size: ~60-90 MB Requires: Nothing (standalone)
Best for: pip installation
Command: pip install bazaar-stock-app
Size: ~30 KB + dependencies
-
Configuration File
- User preferences
- Custom stock lists
- Theme customization
-
Plugin System
- Load custom sections
- Third-party integrations
- Community contributions
-
Database Support
- Local data caching
- Historical data storage
- Offline mode
-
API Abstraction
- Multiple data sources
- Fallback providers
- Rate limiting
For questions or contributions, refer to the main README.md