xalpha AGENTS.md

A set of project instructions for xalpha, a Python platform for financial data analysis, strategy backtesting, and report generation.

In plain words
What is it for?
Use it for financial analysis, data mining, investment-strategy backtesting, and analytical reports built with xalpha.
Why use it?
It tells an agent how to handle financial requests, fetch data, calculate measures, deal with unreliable data sources, and present evidence-backed results.

Instructions file for CodexOpenCode

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/refraction-ray/xalpha/agents-md
Clone the repo
git clone --depth 1 https://github.com/refraction-ray/xalpha

Made for: Codex, OpenCode.

Per session 917 This file is loaded in full into every session.
When invoked 917 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00917 $0.00917
Opus 5 $0.00458 $0.00458
Sonnet 5 $0.00183 $0.00183
Haiku 4.5 $0.00092 $0.00092

Measured 2d ago against content hash 11ed3f699684, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

xalpha AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

AGENTS.md · 43 lines

How it starts

The opening of the file, as written. The whole thing — 43 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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.

Read the full file on GitHub · 43 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 43 lines · 917 tokens per session scan A 11ed3f699684

Subscribe to this mod's changes

xalpha AGENTS.md is an instructions file published in the GitHub repository refraction-ray/xalpha (2,688 stars, last pushed 1mo ago), licensed MIT. It adds 917 tokens to every session, about $0.0046 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other instructions, from other repositories

machine-learning-for-trading copilot-instructions.md

Instructions for stefan-jansen/machine-learning-for-trading, covering repository conventions for code review, prose and comment style, notebooks, data schema and results and dataframes.

stefan-jansen/machine-learning-for-trading · 592 tokens

DeepTraderX AGENTS.md

Instructions for armandcismaru/DeepTraderX, covering agents.md — guidance for ai agents working on deeptraderx, 1. what this project is, 2. how to run & verify, from repo root and expect occasional flaky trials.

armandcismaru/DeepTraderX · 3,147 tokens

DeepTraderX CLAUDE.md

Instructions for armandcismaru/DeepTraderX, covering claude.md, quick reference and things to remember (high-signal).

armandcismaru/DeepTraderX · 620 tokens

metatrader-mcp-server CLAUDE.md

Instructions for ariadng/metatrader-mcp-server, covering claude development guide - metatrader mcp server, project overview, architecture (3 packages), 1. metatraderclient - core mt5 library and 2. metatradermcp - mcp server.

ariadng/metatrader-mcp-server · 1,867 tokens

nhplug-sdk AGENTS.md

Instructions for PLUG-OpenAPI/nhplug-sdk, covering agents.md — nh투자증권 open api 개발 규칙 (ai 에이전트용), 설치 — pip install nhplug (패키지명 nhplug, 저장소명 nhplug-sdk), 저장소 개요, 🗺️ 파일 지도 — 무엇을 알고 싶을 때 어디를 여는가 and 문서 (source of truth) — 도메인이 정본(ssot).

PLUG-OpenAPI/nhplug-sdk · 4,633 tokens

thai-personal-finance-planner CLAUDE.md

Claude Code instructions for satasuk03/thai-personal-finance-planner, covering claude.md, quick orientation for claude, before you start editing, where you'll be tempted to do the wrong thing and "i'll just add this section to skill.md".

satasuk03/thai-personal-finance-planner · 1,354 tokens