agentleFS
refraction-rayrefraction-ray/xalpha/AGENTS.md

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

Dec 2025: 0 mentionsJan 2026: 0 mentionsFeb 2026: 0 mentionsMar 2026: 0 mentionsApr 2026: 0 mentionsMay 2026: 0 mentionsJun 2026: 0 mentionsJul 2026: 0 mentionsAug 2026: 0 mentionsSep 2026: 0 mentionsOct 2026: 0 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the refraction-ray/xalpha repository that our weekly crawl found: only 3 in all, so this is a hint, not a trend. There is no adoption data for this file yet.
  • 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.

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
  1. Distinctive:

    When a user asks for financial analysis or data mining via natural language:

    line 8
  2. Very specific:

    Understand the Domain: Use xalpha.universal, xalpha.fundinfo, and xalpha.policy as your primary tools.

    line 9
  3. Very specific:

    Write Scripts: Do not just explain how to do it.

    line 10
  4. Distinctive:

    Be Proactive: If a data source (like Investing.com or Xueqiu) throws an error or requires an ID mapping, autonomously debug and ask the …

    line 11
  5. Very specific:

    Numpy 1.x through 2.x: Avoid deprecated aliases like np.float.

    line 17
  6. Very specific:

    Graceful Fallbacks: If an endpoint fails (e.g., anti-scraping on Investing.com), agents should implement or utilize fallback logic (e.g., …

    line 22
  7. Very specific:

    Never Break the DataFrame: Ensure that any updated scraping logic exactly restores the original DataFrame schema expected by xalpha.

    line 23
  8. Very specific:

    When expanding data classes (e.g., adding a new attribute to fundinfo), agents MUST update both _save_csv/_sql and _fetch_csv/_sql.

    line 27
  9. Distinctive:

    When generating HTML reports or dashboards (e.g., QDII prediction pages):

    line 31
  10. Distinctive:

    Rich Aesthetics: Use modern, light-themed layouts, DataTables, and CSS variables.

    line 32
  11. Very specific:

    Testing: Ensure tests pass using pytest.

    line 35
  12. Distinctive:

    Atomic & Precise Changes: When fixing bugs in the library itself, make the smallest possible change.

    line 40
  13. Distinctive:

    Data-Driven: When asked to analyze, write the code, run it, and let the data speak.

    line 41

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

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, and xalpha.policy as your primary tools.
  • Write Scripts: Do not just explain how to do it; write and execute Python scripts utilizing xalpha to 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 in io.StringIO() before pd.read_html(). Use explicitly strict type casting (.astype(float)) to avoid LossySetitemError.
  • Numpy 1.x through 2.x: Avoid deprecated aliases like np.float. Use float or np.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 and get_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 rget decorator 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/_sql and _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. Use pytest.importorskip for 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 black formatting and strict adherence to a 10.00/10 Pylint score for the xalpha/ directory.

7. Development Mindset

  1. Atomic & Precise Changes: When fixing bugs in the library itself, make the smallest possible change. Avoid unnecessary refactoring of legacy code.
  2. Data-Driven: When asked to analyze, write the code, run it, and let the data speak.
  3. Self-Healing & Fail-Fast: If you encounter a KeyError or NoneType during 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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.