devfinwiz / Fin-Maestro-Kin

Seamless Finance: Docker-Deployed APIs for Smart Investments. [WORK IN PROGRESS]
https://fin-maestro-kin.apidog.io/
MIT License
69 stars 10 forks source link

Restructure Project Modules and Refactor Codebase for Improved Maintainability #31

Closed devfinwiz closed 6 months ago

devfinwiz commented 6 months ago

This PR represents a comprehensive restructuring of the project's module organization and a significant refactoring of existing code to enhance maintainability, readability, and scalability.

Changes Made:

  1. Module Reorganization:

    • Previously, the data_toolkit module contained multiple files for distinct functionalities, resulting in scattered codebase management.
    • Restructured the module to have separate submodules for different aspects of data processing, namely nse and screener.
    • Each submodule now hosts a single file encapsulating all related functionality.
  2. Refactoring NSE Operations:

    • Consolidated the functionalities of nse_equities.py and nse_indices.py into a unified module named nse_operations.py.
    • Introduced classes NSEEquities and NSEIndices within nse_operations.py to encapsulate equities and indices related operations, respectively.
    • Transferred shared helper methods to a common Helper class within nse_operations.py, promoting code reusability and reducing redundancy.
  3. Screener Equities Module:

    • Combined the functionalities of screener_equities.py into a single class named ScreenerEquities.
    • Incorporated shared helper methods into a common Helper class within screener_equities.py, streamlining code organization and maintenance.
  4. Sentiment Module:

    • Refactored the SentimentAnalyzer module to utilize a class-based approach, encapsulating PCR analysis functionalities within the SentimentAnalyzer and PCR class.
  5. Trend Detector Module:

    • Refactored the Trend Detector module to utilize a class-based approach, encapsulating trend analysis functionalities within the TrendDetector class.
    • All trend analysis methods, including signals_generator and generate_plot, are now part of the TrendDetector class, promoting better encapsulation and code organization.

Objective:

The primary objective of this PR is to streamline the project's codebase by reorganizing modules and adopting a class-based approach for better encapsulation and cohesion. By consolidating related functionalities and eliminating redundant code, the changes introduced aim to enhance code readability, simplify maintenance, and facilitate future scalability. This restructuring lays a robust foundation for future development efforts and fosters a more structured and maintainable codebase.

Automation results:

image