What Programming Languages Are Used in AI Berkshire?
AI Berkshire is built almost entirely in Python, with every analytical tool, data scraper, and automation script implemented as .py modules.
The xbtlin/ai-berkshire repository is a Python-centric financial research platform. Every executable component—from quantitative validation engines to asynchronous web scrapers—is written in Python, reflecting the language’s dominance in data-driven investment workflows.
Python as the Foundation
The repository contains no compiled languages or JavaScript frontends; instead, it relies exclusively on Python 3 for its runtime. According to the repository structure, the tools/ and scripts/ directories house the primary logic, with file extensions confirming the language choice: .py files dominate the codebase.
Core Python Modules by Function
Financial Validation in tools/financial_rigor.py
The tools/financial_rigor.py module contains deterministic functions for auditing financial statements. It implements market-cap verification, valuation checks, and Benford’s Law analysis using pure Python with standard math operations.
def verify_market_cap(price, shares, reported_cap, currency=""):
"""Validate that the market‑cap computed from price × shares
matches the reported market‑cap within a tolerance."""
computed = price * shares
diff_pct = abs(computed - reported_cap) / reported_cap * 100
return diff_pct < 2.0 # passes if within 2 %
Asynchronous Data Scraping in tools/xueqiu_scraper.py
Web data ingestion utilizes async/await patterns in tools/xueqiu_scraper.py. This module leverages Playwright for browser automation, demonstrating Python’s concurrency capabilities for I/O-bound financial data collection.
async def browser_fetch_json(page, url, timeout_s=15):
await page.goto(url, timeout=timeout_s * 1000)
content = await page.content()
return json.loads(content)
Quantitative Screening in tools/stock_screener.py
The tools/stock_screener.py file implements momentum and value-factor calculations. This module grades equities based on historical price series and fundamental metrics.
def check_momentum(prices):
"""Calculate a simple momentum signal from historic price series."""
if len(prices) < 20:
return None
recent = prices[-1]
past = prices[-20]
return (recent - past) / past
Workflow Automation in scripts/sync-codex-skills.py
Supporting infrastructure in scripts/sync-codex-skills.py generates Codex-compatible skill packages. This script parses Markdown definitions and emits JSON configurations, illustrating Python’s utility as a glue language for DevOps-style automation within the research pipeline.
Documentation and Configuration
While Python executes the logic, the repository uses Markdown (.md) for human-readable skill definitions in the skills/ directory. These files describe investment workflows but are not executable code; they are processed by the Python scripts to generate machine-readable prompts.
Summary
- Python is the sole programming language used for executable logic in AI Berkshire.
- Core analytical engines reside in
tools/financial_rigor.py,tools/stock_screener.py, andtools/xueqiu_scraper.py. - Async/await patterns handle I/O-bound scraping operations efficiently.
- Automation scripts like
scripts/sync-codex-skills.pyintegrate the workflow using Python’s standard library. - Markdown files provide configuration, but all runtime processing is Python-driven.
Frequently Asked Questions
Is AI Berkshire built entirely in Python?
Yes. Every script, scraper, and analytical tool in the repository is implemented as a Python module. The codebase contains no JavaScript, TypeScript, or compiled language components for its core functionality.
What Python libraries does AI Berkshire rely on?
The repository utilizes standard data-science libraries including pandas, numpy, and requests, along with playwright for asynchronous browser automation in the scraping modules. The exact dependencies are listed in the project’s requirements or installation documentation.
Are there any other programming languages present in the repository?
No executable code appears in other languages. While Markdown files document workflows and JSON files may store configuration, the README.md confirms that Python 3 is the required runtime for all tools.
Why was Python chosen for this financial analysis platform?
Python was selected for its rich ecosystem in quantitative finance—specifically libraries for data manipulation, statistical analysis, and web scraping. Its concise syntax enables rapid iteration on financial models, while async support handles the concurrent data fetching required for real-time market research.
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 →