Skip to content

FinceptTerminal is a modern finance application offering advanced market analytics, investment research, and economic data tools, designed for interactive exploration and data-driven decision-making in a user-friendly environment.

analytics module update

tilakpatel220ec1735061af
diff --git a/.gitignore b/.gitignore
index 062fa215c..a85fc72fb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,6 +12,7 @@ cmder
reqgen.py
fincept_env
python
+treeview.py
testing
fincept_terminal/fyers_session_config.json
fincept_terminal/backup_20250730_072611
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
index 72a7348b5..45609a253 100644
--- a/CODE_OF_CONDUCT.md
+++ b/CODE_OF_CONDUCT.md
@@ -1,58 +1,162 @@
-# **CODE OF CONDUCT**
+# Code of Conduct
-## **Our Pledge**
-We, as contributors and maintainers of this project, pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
+## Our Pledge
-We are committed to fostering an inclusive, welcoming, and respectful environment for all participants.
+We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
----
+We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
+
+## Our Standards
+
+### Positive Behavior
-## **Our Standards**
+Examples of behavior that contributes to a positive environment for our community include:
-Examples of behavior that contributes to a positive environment include:
-- Being respectful and considerate in all interactions.
-- Providing constructive feedback with empathy and encouragement.
-- Being open to different perspectives and ideas.
-- Showing appreciation for contributions, even small ones.
+- Demonstrating empathy and kindness toward other people
+- Being respectful of differing opinions, viewpoints, and experiences
+- Giving and gracefully accepting constructive feedback
+- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
+- Focusing on what is best not just for us as individuals, but for the overall community
+- Using welcoming and inclusive language
+- Being patient with new contributors and helping them learn
+- Recognizing and crediting the work of others
+- Collaborating effectively across different time zones and cultures
+
+### Unacceptable Behavior
Examples of unacceptable behavior include:
-- Using offensive, derogatory, or discriminatory language.
-- Engaging in personal attacks, trolling, or harassment.
-- Posting or sharing inappropriate content, such as offensive language or imagery.
-- Disrupting discussions or workflows intentionally.
----
+- The use of sexualized language or imagery, and sexual attention or advances of any kind
+- Trolling, insulting or derogatory comments, and personal or political attacks
+- Public or private harassment
+- Publishing others' private information, such as a physical or email address, without their explicit permission
+- Spam, excessive self-promotion, or off-topic discussions
+- Deliberately undermining others' contributions or spreading misinformation
+- Aggressive or intimidating behavior toward contributors
+- Other conduct which could reasonably be considered inappropriate in a professional setting
-## **Our Responsibilities**
+## Financial Technology Ethics
-Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to enforce these standards consistently and fairly.
+Given the nature of this financial technology project, we also expect:
-They have the right to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that do not adhere to this Code of Conduct. They may also temporarily or permanently ban individuals whose behavior is deemed inappropriate, threatening, or harmful.
+### Responsible Development
+- Code and features should be designed with user financial safety in mind
+- Contributors should not intentionally introduce security vulnerabilities
+- Financial calculations and data handling must be accurate and reliable
+- Respect for financial privacy and data protection regulations
----
+### Market Integrity
+- No development of features intended for market manipulation
+- Transparent disclosure of any potential conflicts of interest
+- Adherence to applicable financial regulations and compliance standards
+- Responsible handling of market data and trading algorithms
-## **Scope**
+## Enforcement Responsibilities
-This Code of Conduct applies both within project spaces and in public spaces when individuals represent the project or its community. Examples include using the project’s GitHub repository, project-related social media, or communication in private forums.
+Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
----
+Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
-## **Enforcement**
+## Scope
-Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at **[[email protected]]**. All complaints will be reviewed and investigated promptly and fairly.
+This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
-Maintainers are obligated to respect the privacy and security of the reporter and handle complaints confidentially.
+## Reporting Guidelines
----
+### How to Report
+Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [INSERT EMAIL].
-## **Consequences**
+### What to Include
+When reporting, please include:
+- Your contact information
+- Names of any individuals involved
+- A description of the incident
+- Any additional context or supporting materials
+- Whether you've reported this incident to any other forums
-Community members who violate this Code of Conduct may face temporary or permanent repercussions, depending on the severity and frequency of violations. These may include warnings, temporary bans, or permanent expulsion from the community.
+### Response Timeline
+All community leaders are obligated to respect the privacy and security of the reporter of any incident. We will acknowledge receipt of reports within 48 hours and provide regular updates on the investigation process.
----
+## Enforcement
+
+### Investigation Process
+Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
+
+### 1. Correction
+**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
+
+**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
+
+### 2. Warning
+**Community Impact**: A violation through a single incident or series of actions.
+
+**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
+
+### 3. Temporary Ban
+**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
+
+**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
+
+### 4. Permanent Ban
+**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
+
+**Consequence**: A permanent ban from any sort of public interaction within the community.
+
+## Appeals Process
-## **Attribution**
+If you believe you have been unfairly accused or sanctioned, you may appeal the decision by:
-This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org/), version 2.1.
+1. Sending an email to [INSERT APPEALS EMAIL] within 14 days
+2. Including your full name, the incident in question, and reason for appeal
+3. Providing any additional context or evidence
+
+Appeals will be reviewed by a different set of community leaders who were not involved in the original decision.
+
+## Technical Contribution Guidelines
+
+### Code Quality
+- Follow the established architecture patterns (MVP + Services)
+- Include appropriate tests for your contributions
+- Document your code clearly and concisely
+- Respect existing coding standards and conventions
+
+### Collaboration
+- Be constructive in code reviews
+- Provide helpful feedback and suggestions
+- Be open to feedback on your own contributions
+- Help new contributors understand the codebase
+
+### Issue Resolution
+- Search existing issues before creating new ones
+- Provide clear, detailed bug reports with reproduction steps
+- Be patient while issues are being addressed
+- Offer to help resolve issues when possible
+
+## Recognition
+
+We believe in recognizing the valuable contributions of our community members. Contributors who consistently demonstrate positive behavior and make meaningful contributions to the project will be acknowledged through:
+
+- Contributor highlights in project updates
+- Special recognition in release notes
+- Invitation to join the core contributor team
+- Speaking opportunities at community events
+
+## Continuous Improvement
+
+This Code of Conduct is a living document. We welcome feedback and suggestions for improvement from the community. Proposed changes will be discussed openly and decided upon by the core team with community input.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1, available at https://www.contributor-covenant.org/version/2/1/code_of_conduct.html.
+
+Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
+
+For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
+
+## Contact Information
+
+- Primary Contact: [email protected]
+
+---
-For more information, visit the Contributor Covenant’s website at [https://www.contributor-covenant.org/](https://www.contributor-covenant.org/).
+*By participating in this project, you agree to abide by this Code of Conduct. Thank you for helping make this a welcoming, professional community for everyone.*
\ No newline at end of file
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index f790e9f9d..4130eace5 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,62 +1,288 @@
-# 🎉 Contribute to Fincept Terminal 🚀
+# Contributing to Fincept Terminals
-Hey there, awesome developer! 👋 Want to make Fincept Terminal even cooler? We’d love your help! Here’s how you can contribute:
+Welcome to the Fincept Terminal community! Your contributions help build the future of open-source financial technology.
-## 🚀 Where We Need You
+## Project Architecture Overview
-💡 **Data Portals Integration**
- - Connect government financial databases (e.g., [data.gov.in](https://data.gov.in), [data.gov](https://www.data.gov/)).
- - Standardize global economic and financial data.
+Fincept Terminal uses a **Hybrid MVP (Model-View-Presenter) + Services** architecture designed for massive scalability and modular development. This architecture allows thousands of developers to contribute independently without breaking existing functionality.
-📊 **Stock Backtesting & Analysis**
- - Build robust backtesting tools.
- - Implement new financial data visualization features.
+### Why This Architecture?
-🌎 **New Data Sources**
- - Integrate global financial & alternative data providers.
- - Enhance data pipelines for market research.
+- **Modularity**: Add new features without affecting existing code
+- **Team Collaboration**: Different teams can work on different layers simultaneously
+- **Easy Testing**: Each layer can be tested in isolation
+- **Beginner Friendly**: Clear separation makes it easy to understand and contribute
+- **Bloomberg Scale**: Designed to handle thousands of data sources and features
-📈 **Brokerage API Integration**
- - Connect stock brokers so users can **buy/sell directly** from the terminal.
- - Work on **country-specific broker plugins**.
+## Directory Structure
-📖 **Fincept Docs**
+```
+/fincept_terminal
+├── /models # Data structures and entities
+│ ├── /analytics
+│ │ └── analytics_models.py
+│ ├── /dashboard
+│ │ └── dashboard_models.py
+│ ├── /portfolio
+│ │ └── portfolio_models.py
+│ ├── /watchlist
+│ │ └── watchlist_models.py
+│ └── /shared # Models used by 2+ modules
+│ └── common_models.py
+├── /services # Data fetching and processing
+│ ├── /analytics
+│ │ └── analytics_service.py
+│ ├── /dashboard
+│ │ └── dashboard_service.py
+│ ├── /portfolio
+│ │ └── portfolio_service.py
+│ ├── /watchlist
+│ │ └── watchlist_service.py
+│ └── /shared # Services used by 2+ modules
+│ └── api_service.py
+├── /presenters # Business logic and coordination
+│ ├── /analytics
+│ │ └── analytics_presenter.py
+│ ├── /dashboard
+│ │ └── dashboard_presenter.py
+│ ├── /portfolio
+│ │ └── portfolio_presenter.py
+│ ├── /watchlist
+│ │ └── watchlist_presenter.py
+│ └── /shared # Inter-module communication
+│ └── event_bus.py
+├── /views # User interface components
+│ ├── /analytics
+│ │ └── analytics_view.py
+│ ├── /dashboard
+│ │ └── dashboard_view.py
+│ ├── /portfolio
+│ │ └── portfolio_view.py
+│ ├── /watchlist
+│ │ └── watchlist_view.py
+│ └── /shared # Reusable UI components
+│ ├── chart_components.py
+│ └── common_widgets.py
+├── /utils # Global utilities (logging, validation, etc.)
+│ ├── logging.py
+│ ├── validators.py
+│ └── formatters.py
+└── /core # Framework core and base classes
+ ├── base_tab.py
+ ├── base_service.py
+ └── app_config.py
+```
- - Create and maintain comprehensive documentation for Fincept Terminal.
- - Cover installation, API usage, troubleshooting, and developer guides.
- - Keep the documentation up-to-date with new features.
+## Architecture Layers
----
+### 1. Models Layer (`/models`)
+**Purpose**: Define data structures, entities, and business objects
-## 🛠 How to Get Started
+**What goes here**:
+- Data classes and dataclasses
+- Entity definitions (Stock, Portfolio, News, etc.)
+- Configuration objects
+- Enums and constants
-1️⃣ **Fork** this repo & clone it:
- ```bash
- git clone https://github.com/your-username/FinceptTerminal.git
- ```
+**Example**:
+```python
+# models/dashboard/stock_data.py
+@dataclass
+class StockData:
+ symbol: str
+ price: float
+ change_pct: float
+ volume: int
+```
-2️⃣ **Create a new branch** for your feature:
- ```bash
- git checkout -b feature-awesome-feature
- ```
+**Contribution Guidelines**:
+- Use dataclasses for simple data containers
+- Include validation methods
+- Add type hints to all fields
+- Document all fields with docstrings
-3️⃣ **Code like a rockstar 🎸**, follow [PEP8](https://www.python.org/dev/peps/pep-0008/), and document your changes.
+### 2. Services Layer (`/services`)
+**Purpose**: Handle data fetching, API calls, and data processing
-4️⃣ **Push your changes** and open a **pull request**:
- ```bash
- git push origin feature-awesome-feature
- ```
+**What goes here**:
+- External API integrations
+- Data fetching logic
+- Data transformation and processing
+- Caching mechanisms
+- Error handling for data operations
-5️⃣ **Submit a PR** and boom 💥, you're contributing!
+**Example**:
+```python
+# services/dashboard/market_data_service.py
+class MarketDataService:
+ def fetch_stock_data(self, symbols: List[str]) -> Dict[str, StockData]:
+ # API calls and data processing
+```
----
+**Contribution Guidelines**:
+- Handle all errors gracefully with fallback data
+- Use concurrent programming for multiple API calls
+- Include comprehensive logging
+- Write data validation logic
+- Create mock/fallback data for testing
-## 📝 Guidelines
+### 3. Presenters Layer (`/presenters`)
+**Purpose**: Business logic, state management, and coordination between views and services
-✔ **Bug Reports:** [File an issue](https://github.com/Fincept-Corporation/FinceptTerminal/issues/new).
-✔ **Feature Requests:** Let’s talk! Open a [GitHub Discussion](https://github.com/Fincept-Corporation/FinceptTerminal/discussions).
-✔ **Code Contributions:** Keep it clean & simple. Well-documented code = ❤️.
+**What goes here**:
+- Business rules and logic
+- State management
+- Event handling
+- Data transformation for UI
+- Inter-module communication
-🚀 **Join the movement!** Let’s build the future of finance together. Have questions? Ping us at [[email protected]](mailto:[email protected]).
+**Example**:
+```python
+# presenters/dashboard/dashboard_presenter.py
+class DashboardPresenter:
+ def __init__(self, view, service):
+ self.view = view
+ self.service = service
+
+ def refresh_data(self):
+ data = self.service.fetch_all_data()
+ self.view.update_display(data)
+```
-👾 Happy coding! 🎉
+**Contribution Guidelines**:
+- Keep business logic here, not in views
+- Manage application state
+- Handle user interactions
+- Coordinate between multiple services if needed
+
+### 4. Views Layer (`/views`)
+**Purpose**: User interface and presentation logic only
+
+**What goes here**:
+- DearPyGui UI components
+- Chart creation and rendering
+- Event callbacks (but not logic)
+- UI updates and animations
+
+**Example**:
+```python
+# views/dashboard/dashboard_view.py
+class DashboardView(BaseTab):
+ def create_content(self):
+ # DearPyGui UI creation only
+ dpg.add_table(...)
+
+ def update_stock_table(self, stocks):
+ # Update UI with new data
+```
+
+**Contribution Guidelines**:
+- Only DearPyGui code goes here
+- No business logic in views
+- Event handlers should call presenter methods
+- Focus on user experience and visual design
+
+## How to Contribute
+
+### Adding a New Feature
+
+1. **Choose Your Layer**: Decide which layer your contribution affects
+2. **Create Module Folders**: Add folders in relevant layers
+3. **Follow Naming Conventions**: Use clear, descriptive names
+
+**Example: Adding a "News Analysis" feature**
+```
+/app
+├── /models/news_analysis/
+│ ├── news_models.py
+│ └── sentiment_models.py
+├── /services/news_analysis/
+│ ├── news_service.py
+│ └── sentiment_service.py
+├── /presenters/news_analysis/
+│ └── news_presenter.py
+└── /views/news_analysis/
+ └── news_view.py
+```
+
+### Partial Contributions Welcome
+
+You don't need to implement all layers! Contributions can be:
+
+**UI Only**: Work in `/views` folder
+- Design new charts or interfaces
+- Improve existing UI components
+- Add new visualization types
+
+**Data Only**: Work in `/services` folder
+- Add new data sources (crypto exchanges, news APIs)
+- Improve data processing algorithms
+- Add new market indicators
+
+**Business Logic Only**: Work in `/presenters` folder
+- Add new analysis algorithms
+- Implement trading strategies
+- Create data aggregation logic
+
+**Models Only**: Work in `/models` folder
+- Define new data structures
+- Add validation logic
+- Create configuration objects
+
+### Inter-Module Communication
+
+When features need to communicate:
+
+1. **Add to `/shared` folders**: Common code goes in shared directories
+2. **Use Presenter Layer**: Inter-module communication happens in presenters
+3. **Avoid Direct Dependencies**: Modules should not directly import each other
+
+### File Naming Conventions
+
+- **Models**: `*_models.py` (e.g., `stock_models.py`)
+- **Services**: `*_service.py` (e.g., `market_data_service.py`)
+- **Presenters**: `*_presenter.py` (e.g., `dashboard_presenter.py`)
+- **Views**: `*_view.py` (e.g., `analytics_view.py`)
+
+### Code Quality Standards
+
+1. **Type Hints**: Use type hints for all function parameters and returns
+2. **Docstrings**: Document all classes and public methods
+3. **Error Handling**: Include comprehensive error handling
+4. **Logging**: Use the shared logging system for debugging
+5. **Testing**: Write unit tests for your contributions
+
+### Getting Started
+
+1. **Fork the Repository**
+2. **Choose a Feature**: Pick something you want to work on
+3. **Create Module Structure**: Add necessary folders
+4. **Start Small**: Begin with models or a simple service
+5. **Submit PR**: Submit your contribution for review
+
+### Examples for New Contributors
+
+**Easy Contributions**:
+- Add a new stock exchange data source
+- Create a new chart type for existing data
+- Add a new economic indicator
+- Improve error messages
+
+**Medium Contributions**:
+- Add crypto portfolio tracking
+- Implement technical analysis indicators
+- Create news sentiment analysis
+- Add export/import functionality
+
+**Advanced Contributions**:
+- Add real-time streaming data
+- Implement machine learning features
+- Create plugin system for external modules
+- Add advanced backtesting capabilities
+
+## Questions?
+
+- Read existing code in `/app` to understand patterns
+- Check `/utils` for shared utilities you can use
+- Look at `/core` for base classes to inherit from
+- Submit an issue if you need clarification
diff --git a/treeview.py b/treeview.py
new file mode 100644
index 000000000..f343522d2
--- /dev/null
+++ b/treeview.py
@@ -0,0 +1,38 @@
+import os
+
+
+def create_tree(directory, prefix="", only_python=True):
+ """Create a tree view of directory structure"""
+ items = []
+
+ try:
+ all_items = sorted(os.listdir(directory))
+
+ # Filter for directories and Python files
+ for item in all_items:
+ item_path = os.path.join(directory, item)
+ if os.path.isdir(item_path):
+ items.append((item, True)) # (name, is_directory)
+ elif only_python and item.endswith('.py'):
+ items.append((item, False))
+ except PermissionError:
+ return
+
+ for i, (item, is_dir) in enumerate(items):
+ is_last = i == len(items) - 1
+ current_prefix = "└── " if is_last else "├── "
+ print(f"{prefix}{current_prefix}{item}")
+
+ if is_dir:
+ extension = " " if is_last else "│ "
+ create_tree(os.path.join(directory, item), prefix + extension, only_python)
+
+
+def show_project_tree(root_path="."):
+ """Display project tree structure"""
+ print(f"Project Structure: {os.path.basename(os.path.abspath(root_path))}")
+ create_tree(root_path)
+
+
+if __name__ == "__main__":
+ show_project_tree()
\ No newline at end of file