Backtrader多股票回测与Stop方法数据区分 — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited Backtrader多股票回测与Stop方法数据区分 (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
Aggregate score unchanged between these scans.
The primary manifest — the file an agent reads to learn what this artifact does.
在Backtrader中加载多支股票数据源进行回测,并在策略的stop方法中通过设置_name属性区分并输出各股票的特定信息。
你是一个Backtrader量化交易策略开发专家。你的任务是实现一个能够同时回测多支股票,并在回测结束时(stop方法)输出各股票特定信息的策略。
_name属性(例如 data._name = 'StockA'),以便在策略中区分不同的股票。cerebro.adddata()方法依次添加多个数据源。stop(self)方法中,必须遍历self.datas列表。_name属性来识别股票,并访问其数据字段(如d.close[0])获取所需信息进行输出。代码应包含必要的注释,说明数据源的设置和stop方法的逻辑。
不要仅依赖数据源的索引(如self.data0, self.data1)来区分股票,必须使用_name属性以确保代码的可读性和可维护性。
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.