Where to Find Financial Rigor Analysis Tool Files in AI-Berkshire
The financial rigor analysis tool files are located in the tools/ directory at the root of the xbtlin/ai-berkshire repository, with the core logic implemented in tools/financial_rigor.py.
The xbtlin/ai-berkshire repository provides a comprehensive toolkit for rigorous financial analysis and valuation verification. All utility scripts for implementing financial rigor analysis are centralized in the tools/ directory, making them easily discoverable and importable across the project's skill workflows and report generation pipelines.
Location of Financial Rigor Analysis Tools
Primary Module: financial_rigor.py
The core implementation for financial rigor analysis is located at tools/financial_rigor.py in the repository root. This module contains functions for cross-source valuation verification, exact-arithmetic calculations, and consistency enforcement. According to the source code structure, this file sits alongside other specialized utilities in the tools/ folder, following a clear separation of concerns that keeps validation logic modular and reusable.
Supporting Audit and Data Utilities
Several companion files in the same tools/ directory extend the financial rigor capabilities:
tools/report_audit.py– Provides generic audit utilities for generated research reports, including structure and citation validation.tools/morningstar_fair_value.py– Handles fetching and processing of fair-value data from Morningstar for valuation comparisons.tools/stock_screener.py– Contains stock-screening utilities used by various analysis pipelines throughout the project.tools/xueqiu_scraper.py– Implements scraping functionality for Xueqiu data used in valuation pipelines.tools/ashare_data.py– Manages specialized functions for handling Chinese A-share market data.
Key Functions and Capabilities
The financial_rigor.py module exposes several critical functions for ensuring data integrity throughout the analysis pipeline.
Cross-Source Valuation Verification
The compare_valuations() function enables rigorous comparison between multiple data sources, such as Morningstar and Xueqiu datasets. This function ensures market capitalization figures and other valuation metrics align across independent sources before final analysis.
Exact-Arithmetic Calculations
The module implements precise arithmetic utilities to avoid floating-point errors common in financial calculations. This ensures that valuation comparisons maintain mathematical rigor and consistency.
Report Validation
Through integration with tools/report_audit.py, the validate_market_caps() function checks generated reports for consistency with verified source data. This catches discrepancies between cited market values and calculated figures.
Implementation Examples
Cross-Source Valuation Comparison
Import the primary validation function to compare DataFrames from different financial data sources:
from tools.financial_rigor import compare_valuations
# Assume DataFrames from different sources with a ticker column
df_source_a = ... # e.g., scraped from Morningstar
df_source_b = ... # e.g., scraped from Xueqiu
# Perform rigorous cross-source comparison
discrepancies = compare_valuations(df_source_a, df_source_b, key="ticker")
print(discrepancies.head())
Comprehensive Report Auditing
Combine the audit and validation tools to verify generated reports:
from tools.report_audit import audit_report
from tools.financial_rigor import validate_market_caps
report_path = "reports/annual_brazilian_pe_analysis.md"
# Run the generic report audit for structure and citations
audit_issues = audit_report(report_path)
# Validate specific market-cap figures used in the report
validation_issues = validate_market_caps(report_path)
# Combine results for review
all_issues = audit_issues + validation_issues
for issue in all_issues:
print(issue)
Integration with Data Pipeline Tools
The financial rigor tools integrate seamlessly with data acquisition modules located in the same tools/ directory. The tools/morningstar_fair_value.py and tools/xueqiu_scraper.py files feed raw data into the validation functions, while tools/ashare_data.py provides specialized handling for Chinese equity markets. This architecture ensures that financial rigor analysis occurs at both the ingestion and reporting stages of the data pipeline, maintaining data integrity from source to final output.
Summary
- The primary financial rigor analysis tools are located in
tools/financial_rigor.pywithin thexbtlin/ai-berkshirerepository. - Key functions include
compare_valuations()for cross-source verification andvalidate_market_caps()for report auditing against source data. - Supporting utilities in
tools/report_audit.py,tools/morningstar_fair_value.py, andtools/xueqiu_scraper.pyprovide a complete validation ecosystem. - All tool files reside in the
tools/directory at the repository root, following a modular structure that enables easy import and reuse across different analysis skills.
Frequently Asked Questions
What is the main file for financial rigor analysis in AI-Berkshire?
The main file is tools/financial_rigor.py, which contains the core validation functions including compare_valuations() and validate_market_caps() for cross-source verification and exact-arithmetic calculations.
How do I import the financial rigor functions into my script?
You can import directly from the tools module using from tools.financial_rigor import compare_valuations, validate_market_caps. Ensure your script runs from the repository root or that the tools/ directory is in your Python path to resolve the imports correctly.
What other tool files support financial rigor analysis?
The ecosystem includes tools/report_audit.py for general report auditing, tools/morningstar_fair_value.py and tools/xueqiu_scraper.py for data acquisition, tools/stock_screener.py for filtering equities, and tools/ashare_data.py for Chinese market data handling. These files work together to provide comprehensive validation capabilities.
Where exactly are these tool files located in the repository structure?
All tool files are located in the tools/ directory at the root of the xbtlin/ai-berkshire repository, following the path pattern tools/<module_name>.py. The primary file for financial rigor can be accessed at tools/financial_rigor.py or via the raw URL at https://raw.githubusercontent.com/xbtlin/ai-berkshire/main/tools/financial_rigor.py.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →