How phamdinhkhanh/vnquant works
Main Components
• Data Module – This component is responsible for data acquisition and processing. Within the vnquant package, the “vnquant/data” subdirectory includes various modules like:
– DataLoader (for downloading price data from sources such as CAFE and VND)
– FinanceLoader (for loading financial, cashflow, and business index reports)
– Additional utility modules for handling data transformation.
• Plot Module – The “vnquant/plot” directory, which contains functions (e.g., vnquant_candle_stick) for rendering advanced stock charts. It interacts with the data objects to produce visual representations using advanced metrics.
• Config Module – The “vnquant/configs” part holds configuration settings that may inform default options, parameters, or constants.
• Logging Module – Found in “vnquant/log”, this component is used to record events and errors, ensuring observability of operations.
• Utility Module – The “vnquant/utils” directory provides helper functions, custom exceptions, and validation logic (such as checking data formats like OHLC/OHLCV).
Relationships and Interactions
• The Client/Application Layer: Users (or integrating applications) interact with the vnquant package by importing its modules, configuring DataLoader/FinanceLoader objects, and then calling visualization functions.
• The Data Module interfaces with external financial data sources (CAFE, VND) to download stock data. It outputs structured data (typically as pandas DataFrames) that are then consumed by the Plot Module.
• The Plot Module receives either raw data (DataFrames or symbol strings) and uses the configuration (provided by the Config Module) and logging (via the Log Module) during the visualization process.
• The Utility Module supports both Data and Plot modules by providing common validation and error management functionality.
• The package’s setup and installation process (setup.py, requirements.txt) facilitates integration and dependency management.
Architectural Patterns and Design Principles
• Modular Design: Each core functionality (data loading, plotting, configuration, and logging) has its own subcomponent, which promotes separation of concerns.
• Layered Architecture: The system is structured so that lower-level modules (data fetching and processing) are decoupled from higher-level functionality (visualization and user interfacing).
• Extensibility: The existence of different “loader” modules (in vnquant/data/loader) hints at a plug-in style design for accommodating multiple data sources.
• Reusability: Common utilities are abstracted into the “utils” package for use across the system.
Relevant Technologies, Frameworks, or Libraries
• Python (core language) with its packaging conventions (setup.py, requirements.txt)
• Pandas (implied by the use of DataFrames for OHLC data)
• Matplotlib (or similar plotting libraries) – although not directly mentioned, it’s likely used within the Plot module.
• Git for version control (as indicated by .gitignore and the provided installation via git clone).