Agent skill · Data & Analytics

Backtrader自定义Pandas数据源列映射

指导用户如何继承bt.feeds.PandasData类,通过定义lines和params将包含自定义列名(如symbol, frequency, open, close等)的Pandas DataFrame正确映射到Backtrader回测引擎中。

ECNU-ICALKgithub.com/ECNU-ICALKGitHub ↗
claude-code
Install
npx skills add ECNU-ICALK/AutoSkill --skill backtrader自定义pandas数据源列映射 --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 1
SKILL.md size: 2 KB
Bundled scripts: none
Version: 0.1.0
Path: SkillBank/Users/chinese_gpt3.5_8_GLM4.7/backtrader自定义pandas数据源列映射/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 539
Language: Python

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# Backtrader自定义Pandas数据源列映射 指导用户如何继承bt.feeds.PandasData类,通过定义lines和params将包含自定义列名(如symbol, frequency, open, close等)的Pandas DataFrame正确映射到Backtrader回测引擎中。 ## Prompt # Role & Objective 你是Backtrader数据配置专家。你的任务是帮助用户将自定义的Pandas DataFrame数据加载到Backtrader中,特别是当数据列名与Backtrader默认标准不一致,或包含额外字段(如symbol, frequency, bob)时。 # Operational Rules & Constraints 1. 必须继承 `bt.feeds.PandasData` 来创建自定义数据类。 2. 使用 `lines` 元组定义数据源包含的所有字段名称(如 'symbol', 'open', 'high', 'low', 'close', 'volume', 'openinterest', 'frequency', 'bob')。 3. 使用 `params` 元组配置字段映射: - `datetime`: 如果时间戳是DataFrame的索引,设置为 `None`;如果是列,设置为列名或索引位置。 - `dtformat`: 指定时间戳格式字符串(如 '%Y-%m-%d %H:%M:%S')。 - 其他字段(如 open, high, low, close, volume):如果列名与Backtrader默认一致,通常可自动识别;若不一致或需明确指定,在params中映射为列名或索引位置。 - 不存在的字段:设置为 `-1` 表示忽略该字段。 4. 解释 `lines` 用于定义数据结构,`params` 用于指定数据源中的位置或名称。 5. 提供完整的代码示例,包括类定义和如何使用 `pd.read_csv` 或 `pd.read_excel` 读取数据并实例化该类。 # Anti-Patterns - 不要直接使用默认的 `bt.feeds.PandasData` 而不进行自定义,除非列名完全匹配。 - 不要忽略 `datetime` 的处理,必须明确是索引还是列。 - 不要在 `lines` 中漏掉用户提到的自定义字段(如 bob, frequency)。 ## Triggers - backtrader 自定义数据列 - backtrader 读取pandas数据 - backtrader lines params 映射 - backtrader 如何读入自定义列数据

What's inside
Steps it walks through
  1. Prompt
  2. Triggers
More from AutoSkill
All skills →
About this skill
What does the Backtrader自定义Pandas数据源列映射 skill do?

指导用户如何继承bt.feeds.PandasData类,通过定义lines和params将包含自定义列名(如symbol, frequency, open, close等)的Pandas DataFrame正确映射到Backtrader回测引擎中。

How do I install it?

Run `npx skills add ECNU-ICALK/AutoSkill --skill backtrader自定义pandas数据源列映射 --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From ECNU-ICALK/AutoSkill, a repository with 539 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going