跳至正文
返回文库全部文档

用 AI 研究和做空审查精选股票

代码 Lumibot

总结

该策略通过三智能体工作流,从固定的大型公司股票名单中构建集中型投资组合。研究智能体会根据经营可预测性、现金创造能力和价格吸引力对最多五个候选对象排序。独立的做空方智能体会从债务、管理层、竞争和估值角度质疑这些观点;随后,交易智能体持有通过审查的三至五个标的,对更有说服力的候选对象给予更高权重,并卖出不再通过审查的股票。

该文档提供的是实现概要,而非表现证据。流程每日运行一次,并提供使用 Yahoo 数据进行回测的入口,但没有报告测试结果、投资组合收益或风险指标。提示词没有明确若干重要选择,包括智能体如何评估公司基本面、确定权重、处理换手和控制投资组合风险。因此,所述方法是一套定性选股框架,并不能证明智能体的判断可靠,也不能证明投资组合表现优于其他组合。

核心观点

  • 研究智能体根据业务简单性、可预测性、现金创造能力和价格为公司排序。
  • 每个候选对象进入投资组合前,都会经过独立做空方的审查和质疑。
  • 交易智能体持有三至五只通过审查的股票,并为最看好的标的分配更多资金。
  • 代码描述了每日工作流,但没有提供表现结果或详细的风险控制措施。

标签

全文
# ai_trading_team_bill_ackman_concentrated.py


```py
"""Bill Ackman Portfolio AI Trading Bot.

Invests the way Bill Ackman describes his style: own just a few simple,
high-quality companies and put real money behind them. A research agent finds
the best ideas. A short seller agent attacks each one. A trading agent holds the
3 to 5 that survive, with the most money in the best ideas.
Not affiliated with or endorsed by Bill Ackman or Pershing Square.
"""

from lumibot.strategies import Strategy


class AITradingTeamBillAckmanConcentratedStrategy(Strategy):
    parameters = {"universe": ["GOOGL", "CMG", "HLT", "QSR", "UBER", "CP", "LOW", "MDLZ", "BKNG", "MSFT"]}

    def initialize(self):
        self.sleeptime = "1D"
        self.agents.create(
            name="researcher",
            allow_trading=False,
            system_prompt=(
                "Find the simple, predictable companies in the universe that make lots of cash and trade at a "
                "good price. Rank your top 5 ideas and say why. Do not trade."
            ),
        )
        self.agents.create(
            name="short_seller",
            allow_trading=False,
            system_prompt=(
                "You are a short seller. Attack each idea: too much debt, weak management, strong rivals, or "
                "a price that is too high. Say which ideas survive. Do not trade."
            ),
        )
        self.agents.create(
            name="trader",
            allow_trading=True,
            system_prompt=(
                "Hold the 3 to 5 ideas that survived, with more money in the best ones. Sell a stock when it "
                "no longer survives the attack."
            ),
        )

    def on_trading_iteration(self):
        facts = {"universe": self.parameters["universe"]}
        research = self.agents["researcher"].run(task_prompt="Rank your best ideas.", context=facts)
        attack = self.agents["short_seller"].run(
            task_prompt="Attack each idea.", context={**facts, "research": research.summary}
        )
        self.agents["trader"].run(task_prompt="Hold the survivors.", context={**facts, "short_seller": attack.summary})


if __name__ == "__main__":
    from lumibot.credentials import IS_BACKTESTING

    if IS_BACKTESTING:
        from lumibot.backtesting import YahooDataBacktesting

        AITradingTeamBillAckmanConcentratedStrategy.backtest(YahooDataBacktesting)
    else:
        AITradingTeamBillAckmanConcentratedStrategy().run_live()

```

在遵守原作品许可的前提下,附作者信息全文展示。 许可协议: GPL-3.0

此摘要由 Stratmill 研究智能体根据原文撰写,并非原文副本。