xalpha
AGENTS.md2.7k starsChanged 6 months agoMITView on GitHub
Welcome to xalpha. This document defines the operational rules for AI agents and contributors. Core Identity: xalpha is not just a quantitative finance Python library—it is an AI Agent Platform. Agents are expected to use natural language instructions to automatically write xalpha code, perform financial data mining, backtest strategies, and generate analytical reports.
Trending
Quiet this year.thin dataabout the whole repository
Who's talking about refraction-ray/xalpha
- imoyao/fundmate“Bump xalpha from 0.11.5 to 0.11.6 in /backend”GitHub · Mar 2, 2022
- imoyao/fundmate“Bump xalpha from 0.11.5 to 0.11.6 in /backend/requirements”GitHub · Mar 2, 2022
- imoyao/fundmate“Bump xalpha from 0.11.4 to 0.11.5 in /backend”GitHub · Jan 18, 2022
The biggest 3 of 3 mentions linking to the repository that our crawl found. Each line is their own headline.
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repositoryOne other file it gives its agents.
- question2reportSkill
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
13 rules. About 0 are common, 6 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
When a user asks for financial analysis or data mining via natural language:
- Very specific: line 9
Understand the Domain: Use xalpha.universal, xalpha.fundinfo, and xalpha.policy as your primary tools.
- Very specific: line 10
Write Scripts: Do not just explain how to do it.
- Distinctive: line 11
Be Proactive: If a data source (like Investing.com or Xueqiu) throws an error or requires an ID mapping, autonomously debug and ask the …
- Very specific: line 17
Numpy 1.x through 2.x: Avoid deprecated aliases like np.float.
- Very specific: line 22
Graceful Fallbacks: If an endpoint fails (e.g., anti-scraping on Investing.com), agents should implement or utilize fallback logic (e.g., …
- Very specific: line 23
Never Break the DataFrame: Ensure that any updated scraping logic exactly restores the original DataFrame schema expected by xalpha.
- Very specific: line 27
When expanding data classes (e.g., adding a new attribute to fundinfo), agents MUST update both _save_csv/_sql and _fetch_csv/_sql.
- Distinctive: line 31
When generating HTML reports or dashboards (e.g., QDII prediction pages):
- Distinctive: line 32
Rich Aesthetics: Use modern, light-themed layouts, DataTables, and CSS variables.
- Very specific: line 35
Testing: Ensure tests pass using pytest.
- Distinctive: line 40
Atomic & Precise Changes: When fixing bugs in the library itself, make the smallest possible change.
- Distinctive: line 41
Data-Driven: When asked to analyze, write the code, run it, and let the data speak.
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
XAlpha Agent Platform Guidelines
Welcome to xalpha. This document defines the operational rules for AI agents and contributors.
Core Identity: xalpha is not just a quantitative finance Python library—it is an AI Agent Platform. Agents are expected to use natural language instructions to automatically write xalpha code, perform financial data mining, backtest strategies, and generate analytical reports.
1. The Agentic Workflow
When a user asks for financial analysis or data mining via natural language:
- Understand the Domain: Use
xalpha.universal,xalpha.fundinfo, andxalpha.policyas your primary tools. - Write Scripts: Do not just explain how to do it; write and execute Python scripts utilizing
xalphato fetch real data, compute metrics (e.g., XIRR, volatility, correlation), and save results. - Be Proactive: If a data source (like Investing.com or Xueqiu) throws an error or requires an ID mapping, autonomously debug and ask the user for the fix plan.
- Synthesize: Present the final financial analysis clearly to the user, backed by the data you mined.
2. Core Compatibility Contracts
Code written or modified by agents MUST be broadly compatible across the scientific Python ecosystem:
- Pandas 1.x up to 3.x: Handle frequency format changes (
"M"vs"ME"). Always wrap HTML strings inio.StringIO()beforepd.read_html(). Use explicitly strict type casting (.astype(float)) to avoidLossySetitemError. - Numpy 1.x through 2.x: Avoid deprecated aliases like
np.float. Usefloatornp.float64.
3. Data Scraping & API Resilience
xalpha heavily relies on web scraping (beautifulsoup4) and API endpoints.
- Robust Parsing: Upstream HTML changes frequently. Avoid fragile exact string matches
soup.find(string="text"). Use iterative tag searching andget_text(strip=True). - Graceful Fallbacks: If an endpoint fails (e.g., anti-scraping on Investing.com), agents should implement or utilize fallback logic (e.g., JSON APIs vs HTML parsing) and use the
rgetdecorator for network resilience. - Never Break the DataFrame: Ensure that any updated scraping logic exactly restores the original DataFrame schema expected by
xalpha.
4. Local Caching
xalpha uses local caching (CSV/SQL) for performance.
- When expanding data classes (e.g., adding a new attribute to
fundinfo), agents MUST update both_save_csv/_sqland_fetch_csv/_sql. - Handle legacy caches defensively using
.get("new_key", "default").
5. Dashboards & Visualization
When generating HTML reports or dashboards (e.g., QDII prediction pages):
- Rich Aesthetics: Use modern, light-themed layouts, DataTables, and CSS variables. Keep Python focused on data; offload rendering logic to JS/CSS.
6. Code Quality & CI/CD
- Testing: Ensure tests pass using
pytest. Usepytest.importorskipfor optional dependencies. - Testing Efficiency: Running the entire/global test suite is very heavy. Minimize running global tests, and prefer running targeted tests (e.g.
pytest tests/test_file.py::test_func) to verify changes. - Linting: Enforce
blackformatting and strict adherence to a 10.00/10 Pylint score for thexalpha/directory.
7. Development Mindset
- Atomic & Precise Changes: When fixing bugs in the library itself, make the smallest possible change. Avoid unnecessary refactoring of legacy code.
- Data-Driven: When asked to analyze, write the code, run it, and let the data speak.
- Self-Healing & Fail-Fast: If you encounter a
KeyErrororNoneTypeduring data fetching, investigate the upstream response and patch the parsers or input normalizers autonomously. Avoid over-protective code (e.g., blanket try-except or returning empty DataFrames) that swallows original errors. Let it fail naturally so the root cause is visible, then fix it at the source.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

