[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"tool-Lumiwealth--lumibot":3,"similar-Lumiwealth--lumibot":195},{"id":4,"github_repo":5,"name":6,"description_en":7,"description_zh":8,"ai_summary_zh":8,"readme_en":9,"readme_zh":10,"quickstart_zh":11,"use_case_zh":12,"hero_image_url":13,"owner_login":14,"owner_name":14,"owner_avatar_url":15,"owner_bio":16,"owner_company":16,"owner_location":16,"owner_email":16,"owner_twitter":16,"owner_website":16,"owner_url":17,"languages":18,"stars":23,"forks":24,"last_commit_at":25,"license":26,"difficulty_score":27,"env_os":28,"env_gpu":29,"env_ram":29,"env_deps":30,"category_tags":36,"github_topics":39,"view_count":27,"oss_zip_url":16,"oss_zip_packed_at":16,"status":60,"created_at":61,"updated_at":62,"faqs":63,"releases":94},7048,"Lumiwealth\u002Flumibot","lumibot","Backtesting and Trading Bots Made Easy for Crypto, Stocks, Options, Futures, FOREX and more. Lumibot also makes it very easy to run and backtest agentic AI trading strategies in a safer way.","Lumibot 是一款专为加密货币、股票、期权、期货及外汇市场设计的开源回测与交易库。它致力于解决量化交易中策略开发与实盘部署脱节的痛点，允许用户使用同一套代码无缝切换历史回测与实时交易，大幅降低了从理论验证到实际盈利的门槛。\n\n这款工具非常适合具备一定编程基础的量化开发者、金融研究人员以及希望构建自动化交易系统的技术爱好者。对于不想编写代码的用户，其生态中的 BotSpot 平台还支持通过自然语言描述来生成并部署 AI 交易策略。\n\nLumibot 的核心亮点在于其高度的灵活性与执行效率。它不仅支持用户自定义复杂的交易策略和技术指标，还针对速度进行了深度优化，确保回测过程快速高效。此外，Lumibot 率先引入了原生的 AI 智能体（Agentic）运行时环境，让用户能够以更安全、便捷的方式开发和回测基于人工智能的交易策略。配合对 ThetaData 等专业数据源的推荐集成，Lumibot 为构建稳健的自动化交易系统提供了坚实的技术底座。","[![CI Status](https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Factions\u002Fworkflows\u002Fcicd.yaml\u002Fbadge.svg?branch=dev)](https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Factions\u002Fworkflows\u002Fcicd.yaml)\n[![Coverage](https:\u002F\u002Fraw.githubusercontent.com\u002FLumiwealth\u002Flumibot\u002Fbadge\u002Fcoverage.svg)](https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Factions\u002Fworkflows\u002Fcicd.yaml)\n\n# Lumibot - A Backtesting and Trading Library for Stocks, Options, Crypto, Futures, FOREX and More!\n\nLumibot is a backtesting and trading library for stocks, options, crypto, futures and more. It is made so that the same code you use for backtesting can be used for live trading, making it easy to transition from backtesting to live trading. Lumibot is a highly flexible library that allows you to create your own strategies and indicators, and backtest them on historical data. It is also highly optimized for speed, so you can backtest your strategies quickly and efficiently.\n\n**IMPORTANT: This library requires data for backtesting. Our recommended data source is [ThetaData](https:\u002F\u002Fwww.thetadata.net\u002F) because they provide the deepest historical coverage we’ve found and directly support BotSpot. Use the promo code `BotSpot10` at checkout for 10% off the first order (the code also tells ThetaData you were referred by us).**\n\n> **Contributor note:** Read `AGENTS.md` before running anything Theta-related. That file spells out the hard rules—never launch ThetaTerminal or the shared downloader locally, always point LumiBot at the AWS-hosted downloader, and wrap all long\n> commands with `\u002FUsers\u002Frobertgrzesik\u002Fbin\u002Fsafe-timeout`. Breaking these rules kills the only licensed Theta session.\n\n## Introducing BotSpot: No-Code AI Trading Bots\n\n**[BotSpot](https:\u002F\u002Fbotspot.trade\u002F?utm_source=lumibot+docs&utm_medium=documentation&utm_campaign=GitHub+Readme)** is our platform built on top of Lumibot that lets you build, backtest, and deploy trading strategies without writing any code. Just describe what you want in plain English and BotSpot's AI handles the rest.\n\n- **Build** strategies using natural language -- the AI writes production-ready Lumibot code for you\n- **Backtest** against years of historical data with a single click\n- **Deploy** to live trading with real brokers (Alpaca, Interactive Brokers, and more)\n- **Browse** a marketplace of proven, community-built strategies you can run immediately\n\n\u003Ca href=\"https:\u002F\u002Fbotspot.trade\u002F?utm_source=github&utm_medium=readme_badge&utm_campaign=lumibot\">\n  \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002F%F0%9F%9A%80_Try_BotSpot_Free-Build_AI_Trading_Bots_Without_Code-brightgreen?style=for-the-badge&labelColor=2e3440\" alt=\"Try BotSpot Free\" height=\"40\">\n\u003C\u002Fa>\n\n## Architecture Documentation\n\n- `docs\u002FBACKTESTING_ARCHITECTURE.md` - Detailed documentation of the backtesting data flow (Yahoo, ThetaData, Polygon data sources, caching, and data flow diagrams)\n- `docs\u002FACCEPTANCE_BACKTESTS.md` - Manual end-to-end acceptance backtest suite + performance gate (ThetaData)\n- `docsrc\u002Fenvironment_variables.rst` - Public documentation page for environment variables (update when env vars change)\n- `CHANGELOG.md` - Deployment\u002Frelease notes (keep this updated)\n- `CLAUDE.md` - AI assistant instructions for working with the codebase\n- `AGENTS.md` - Critical rules for ThetaData and production safety\n\n## Releases \u002F Deployments (internal)\n\nFor production deployments (BotSpot \u002F BotManager), keep releases traceable:\n\n- Update `CHANGELOG.md` for every deploy (include the deploy commit hash)\n- Tag the deploy commit as `vX.Y.Z` and push the tag\n- Create a GitHub Release from that tag using the `CHANGELOG.md` entry\n\n## Documentation - 👇 Start Here 👇\n\nTo get started with Lumibot, you can check out our documentation below.\n\n**Check out the documentation for the project here: 👉 \u003Chttp:\u002F\u002Flumibot.lumiwealth.com\u002F> 👈**\n\n## AI Trading Agents and Agentic Backtesting\n\nLumibot now includes a built-in AI trading agent runtime for strategies. You can create an agent with `self.agents.create(...)`, run it from `initialize()`, `on_trading_iteration()`, `on_filled_order()`, or any other lifecycle method, and reuse the same strategy in both backtests and live trading.\n\n- Build an **AI trading agent** directly inside a LumiBot strategy\n- Use **DuckDB** as the query surface for time-series analysis instead of dumping raw bars into prompts\n- Replay identical agent decisions in **backtests** without paying for another model call\n- Mount external **MCP servers** for news, macro, filings, or any other domain-specific tools\n- Use LumiBot's internal runtime prompt plus your own system prompt, with structured traces and default per-run summaries for debugging\n- Keep the strategy in charge of timing, risk rules, and execution\n\nStart here:\n\n- Sphinx docs: \u003Chttps:\u002F\u002Flumibot.lumiwealth.com\u002Fagents.html>\n- Backtesting docs: \u003Chttps:\u002F\u002Flumibot.lumiwealth.com\u002Fbacktesting.html>\n- Stock example: [lumibot\u002Fexample_strategies\u002Fagent_stock_backtest.py](https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fblob\u002Fdev\u002Flumibot\u002Fexample_strategies\u002Fagent_stock_backtest.py)\n- Option example: [lumibot\u002Fexample_strategies\u002Fagent_option_backtest.py](https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fblob\u002Fdev\u002Flumibot\u002Fexample_strategies\u002Fagent_option_backtest.py)\n- Repo guide: [docs\u002FAI_TRADING_AGENTS.md](https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fblob\u002Fdev\u002Fdocs\u002FAI_TRADING_AGENTS.md)\n\n## More About BotSpot\n\nBotSpot is a platform built on Lumibot that lets anyone build, backtest, and deploy trading strategies using AI. **Visit [BotSpot.trade](https:\u002F\u002Fbotspot.trade\u002F?utm_source=lumibot+docs&utm_medium=documentation&utm_campaign=GitHub+Readme) to get started.**\n\n## Learn More\n\nCheck out example strategies and tutorials on our blog, or use our AI agent to build strategies for you:\n\n**Blog:** https:\u002F\u002Flumiwealth.com\u002Fblog\u002F\n**AI Strategy Builder:** https:\u002F\u002Fwww.botspot.trade\u002F?utm_source=github&utm_medium=referral&utm_campaign=lumibot_readme\n\n## Run a backtest\n\nTo run a backtest, you can use the following code snippet:\n\n```bash\npython -m lumibot.example_strategies.stock_buy_and_hold\n```\n\n## Backtesting data sources (env override)\n\nYou can select a backtesting data source via the `BACKTESTING_DATA_SOURCE` environment variable (this overrides any explicit `datasource_class` in code). When your environment already chooses the provider, call `Strategy.backtest(...)` or `Strategy.run_backtest(...)` with `datasource_class=None`:\n\n```python\nMyStrategy.backtest(\n    datasource_class=None,\n    backtesting_start=None,\n    backtesting_end=None,\n)\n```\n\nEnvironment-driven routing still works the same way:\n\n```bash\n# Single-provider backtesting (examples)\nexport BACKTESTING_DATA_SOURCE=thetadata\nexport BACKTESTING_DATA_SOURCE=ibkr\n```\n\nMulti-provider routing (by asset type) is supported by setting a JSON mapping:\n\n```bash\n# Example: ThetaData for stocks\u002Foptions\u002Findexes, IBKR for futures\u002Fcrypto\nexport BACKTESTING_DATA_SOURCE='{\"default\":\"thetadata\",\"stock\":\"thetadata\",\"option\":\"thetadata\",\"index\":\"thetadata\",\"future\":\"ibkr\",\"crypto\":\"ibkr\"}'\n\n# Example: route crypto to CCXT via a specific exchange id (if desired)\nexport BACKTESTING_DATA_SOURCE='{\"default\":\"thetadata\",\"crypto\":\"coinbase\"}'\n```\n\n## Run an Example Strategy\n\nWe made a small example strategy to show you how to use Lumibot in this GitHub repository: [Example Algorithm GitHub](https:\u002F\u002Fgithub.com\u002FLumiwealth-Strategies\u002Fstock_example_algo)\n\nTo run this example strategy, click on the `Deploy to Render` button below to deploy the strategy to Render (our recommendation). You can also run the strategy on Repl.it by clicking on the `Run on Repl.it` button below.\n\n[![Deploy to Render](https:\u002F\u002Frender.com\u002Fimages\u002Fdeploy-to-render-button.svg)](https:\u002F\u002Frender.com\u002Fdeploy?repo=https:\u002F\u002Fgithub.com\u002FLumiwealth-Strategies\u002Fstock_example_algo)\n\n[![Run on Repl.it](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FLumiwealth_lumibot_readme_26e23a0dcf49.png)](https:\u002F\u002Freplit.com\u002Fnew\u002Fgithub\u002FLumiwealth-Strategies\u002Fstock_example_algo)\n\n**For more information on this example strategy, you can check out the README in the example strategy repository here: [Example Algorithm](https:\u002F\u002Fgithub.com\u002FLumiwealth-Strategies\u002Fstock_example_algo)**\n\n## Contributors\n\nIf you want to contribute to Lumibot, you can check how to get started below. We are always looking for contributors to help us out!\n\nHere's a video to help you get started with contributing to Lumibot: [Watch The Video](https:\u002F\u002Fyoutu.be\u002FHuz6VxqafZs)\n\n**Steps to contribute:**\n\n0. Watch the video: [Watch The Video](https:\u002F\u002Fyoutu.be\u002FHuz6VxqafZs)\n1. Clone the repository to your local machine\n2. Create a new branch for your feature\n3. Run `pip install -r requirements_dev.txt` to install the developer dependencies\n4. Install all the requirements from setup.py: `pip install -e .`\n5. Make your changes\n6. Run `pytest` to make sure all the tests pass\n7. Create a pull request to merge your branch into master\n\n## Running Tests\n\nWe use pytest for our testing framework. Some tests require API keys to be in a `.env` file in the root directory. To run the tests, you can run the following command:\n\n```bash\npytest\n```\n\nTo run an individual test file, you can run the following command:\n\n```bash\npytest tests\u002Ftest_asset.py\n```\n\n## Remote Cache Configuration\n\nLumibot can mirror its local parquet caches to AWS S3 when you enable the new\nbacktest cache manager. The feature is optional and defaults to local storage.\nTo configure the environment variables, understand the key naming convention,\nand follow the manual validation checklist, review `docs\u002Fremote_cache.md`.\n\n### Showing Code Coverage\n\nTo show code coverage, you can run the following command:\n\n```bash\ncoverage run; coverage report; coverage html\n```\n\n#### Adding an Alias on Linux or MacOS\n\nThis will show you the code coverage in the terminal and also create a folder called \"htmlcov\" which will have a file called \"index.html\". You can open this file in your browser to see the code coverage in a more readable format.\n\nIf you don't want to keep typing out the command, you can add it as an alias in bash. To do this, you can run the following command:\n\n```bash\nalias cover='coverage run; coverage report; coverage html'\n```\n\nThis will now allow you to run the command by just typing \"cover\" in the terminal.\n\n```bash\ncover\n```\n\nIf you want to also add it to your .bashrc file. You can do this by running the following command:\n\n```bash\necho \"alias cover='coverage run; coverage report; coverage html'\" >> ~\u002F.bashrc\n```\n\n#### Adding an Alias on Windows\n\nIf you are on Windows, you can add an alias by running the following command:\n\nAdd to your PowerShell Profile: (profile.ps1)\n\n```powershell\nfunction cover { \n coverage run\n coverage report\n coverage html\n}\n```\n\n### Setting Up PyTest in VS Code\n\nTo set up in VS Code for debugging, you can add the following to your launch.json file under \"configurations\". This will allow you to go into \"Run and Debug\" and run the tests from there, with breakpoints and everything.\n\nNOTE: You may need to change args to the path of your tests folder.\n\n```json\n{\n    \"name\": \"Python: Pytest\",\n    \"type\": \"python\",\n    \"request\": \"launch\",\n    \"module\": \"pytest\",\n    \"args\": [\n        \"lumibot\u002Ftests\"\n    ],\n    \"console\": \"integratedTerminal\",\n}\n```\n\nHere's an example of an actual launch.json file:\n\n```json\n{\n    \"version\": \"0.2.0\",\n    \"configurations\": [\n        {\n            \"name\": \"Python: Pytest\",\n            \"type\": \"python\",\n            \"request\": \"launch\",\n            \"module\": \"pytest\",\n            \"args\": [\n                \"lumibot\u002Ftests\"\n            ],\n            \"console\": \"integratedTerminal\",\n        }\n    ]\n}\n```\n\n## Notes on data sources\n\nThis table points out some of the differences between the data sources we use in Lumibot. These refer to the data \nreturned in a Bars entity that is returned from calls to get_historical_prices. \n\n| data_source | type  | OHLCV | split adjusted | dividends | returns | dividend adjusted returns |\n|-------------|-------|-------|----------------|-----------|---------|---------------------------|\n| yahoo       | stock | Yes   | Yes            | Yes       | Yes     | Yes                       |\n| alpaca      | stock | Yes   | Yes            | No        | Yes     | No                        |\n| polygon     | stock | Yes   | Yes            | No        | Yes     | No                        |\n| Tradier     | stock | Yes   | Yes            | No        | Yes     | No                        |\n| Pandas*     | stock | Yes   | Yes            | Yes       | Yes     | Yes                       |\n\n*Pandas is not a data source per se, but it can load csv files in the same format as Yahoo dataframes,\nwhich can contain dividends.\n\n## An assortment of git commands our contributors may find useful\n\nMaking a new branch and pulling from main:\n```shell\ngit checkout -b my-feature\ngit fetch origin\ngit merge origin\u002Fdev\n```\nCommitting work to you feature branch:\n```shell\ngit add .\ngit commit -m \"my changes\"\ngit push -u origin my-feature\n```\n\nIf work on main progressed while you were in another branch, this is how you rebase it into your branch. Note that\nsince you've rebased your local branch, you'll need to force push your changes to update the remote branch. \nThe --force-with-lease option is a safer alternative to --force as it will abort the push if there are any new \ncommits on the remote that you haven't incorporated into your local branch\n```shell\ngit checkout dev\ngit fetch origin\ngit merge origin\u002Fdev\ngit checkout my-feature\ngit rebase dev\ngit checkout my-feature\ngit push --force-with-lease origin my-feature\n```\n\nWhen ready to merge the branch into main, go into github, create a pull request, and await review. When your PR is approved it will automatically be merged into the dev branch remotely. Now, you can delete your local branch and the remote branch.\n```shell\ngit checkout dev\ngit fetch origin\ngit merge origin\u002Fdev\ngit branch -D my-feature\ngit push origin --delete my-feature\n```\n\n## Community\n\nIf you want to learn more about Lumibot or Algorithmic Trading then you will love out communities! You can join us on Discord.\n\n**Join us on Discord: \u003Chttps:\u002F\u002Fdiscord.gg\u002FTmMsJCKY3T>**\n\n**Build AI-powered trading bots on [BotSpot.trade](https:\u002F\u002Fbotspot.trade\u002F)** - Our platform for creating, testing, and deploying trading strategies with AI assistance!\n\n## AI Bootcamp\n\nNeed hands-on help building your trading bots? Join our **AI Bootcamp** where you'll learn to build, backtest, and deploy trading strategies using AI—no coding required.\n\n**What you'll learn:**\n- Build stock, crypto, options, and futures bots using plain English prompts\n- Master professional tools like VS Code with Copilot and Cursor\n- Backtest and deploy your strategies to live brokers\n- Join 2,400+ traders in our community\n\n**[Learn more about the AI Bootcamp](https:\u002F\u002Fwww.botspot.trade\u002Fai-bot-builder-bootcamp?utm_source=github&utm_medium=referral&utm_campaign=lumibot_readme)**\n\n---\n\n**Just want to try the AI?** [Start your free trial at BotSpot.trade](https:\u002F\u002Fwww.botspot.trade\u002F?utm_source=github&utm_medium=referral&utm_campaign=lumibot_readme) — build strategies in minutes, no coding required.\n\n## License\n\nThis library is covered by the MIT license for open sourced software which can be found here: \u003Chttps:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fblob\u002Fmaster\u002FLICENSE>\n","[![CI 状态](https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Factions\u002Fworkflows\u002Fcicd.yaml\u002Fbadge.svg?branch=dev)](https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Factions\u002Fworkflows\u002Fcicd.yaml)\n[![覆盖率](https:\u002F\u002Fraw.githubusercontent.com\u002FLumiwealth\u002Flumibot\u002Fbadge\u002Fcoverage.svg)](https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Factions\u002Fworkflows\u002Fcicd.yaml)\n\n# Lumibot - 用于股票、期权、加密货币、期货、外汇等的回测与交易库！\n\nLumibot 是一个用于股票、期权、加密货币、期货等的回测与交易库。它设计为使您在回测中使用的代码可以直接用于实盘交易，从而轻松实现从回测到实盘的过渡。Lumibot 是一个高度灵活的库，允许您创建自己的策略和指标，并在历史数据上进行回测。同时，它还针对速度进行了高度优化，因此您可以快速高效地回测您的策略。\n\n**重要提示：此库需要数据来进行回测。我们推荐的数据源是 [ThetaData](https:\u002F\u002Fwww.thetadata.net\u002F)，因为他们提供了我们所见过的最深度的历史数据覆盖，并且直接支持 BotSpot。在结账时使用促销码 `BotSpot10` 可享受首次订单九折优惠（该代码也会告知 ThetaData 您是由我们推荐而来）。**\n\n> **贡献者注意：** 在运行任何与 Theta 相关的内容之前，请先阅读 `AGENTS.md` 文件。该文件明确规定了严格的规则——切勿在本地启动 ThetaTerminal 或共享下载器，始终将 LumiBot 指向 AWS 托管的下载器，并用 `\u002FUsers\u002Frobertgrzesik\u002Fbin\u002Fsafe-timeout` 包裹所有长时间运行的命令。违反这些规则会导致唯一的授权 Theta 会话被终止。\n\n## 引入 BotSpot：无代码 AI 交易机器人\n\n**[BotSpot](https:\u002F\u002Fbotspot.trade\u002F?utm_source=lumibot+docs&utm_medium=documentation&utm_campaign=GitHub+Readme)** 是我们基于 Lumibot 构建的平台，让您无需编写任何代码即可构建、回测和部署交易策略。只需用简单的英语描述您的需求，BotSpot 的 AI 就会为您完成剩下的工作。\n\n- 使用自然语言 **构建** 策略——AI 会为您编写可直接投入生产的 Lumibot 代码\n- 仅需点击一下即可对多年的历史数据进行 **回测**\n- 部署至真实经纪商进行 **实盘交易**（Alpaca、Interactive Brokers 等）\n- 浏览由社区构建的成熟策略市场，立即运行这些策略\n\n\u003Ca href=\"https:\u002F\u002Fbotspot.trade\u002F?utm_source=github&utm_medium=readme_badge&utm_campaign=lumibot\">\n  \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002F%F0%9F%9A%80_试用_BotSpot_免费_无需代码即可构建_AI_交易机器人-brightgreen?style=for-the-badge&labelColor=2e3440\" alt=\"试用 BotSpot 免费\" height=\"40\">\n\u003C\u002Fa>\n\n## 架构文档\n\n- `docs\u002FBACKTESTING_ARCHITECTURE.md` - 回测数据流的详细文档（Yahoo、ThetaData、Polygon 数据源、缓存及数据流图）\n- `docs\u002FACCEPTANCE_BACKTESTS.md` - 手动端到端验收回测套件 + 性能门控（ThetaData）\n- `docsrc\u002Fenvironment_variables.rst` - 环境变量的公开文档页面（环境变量变更时更新）\n- `CHANGELOG.md` - 部署\u002F发布说明（请保持更新）\n- `CLAUDE.md` - 用于处理代码库的 AI 助手指令\n- `AGENTS.md` - 关于 ThetaData 和生产安全的关键规则\n\n## 发布\u002F部署（内部）\n\n对于生产部署（BotSpot \u002F BotManager），请确保每次发布都可追溯：\n\n- 每次部署都要更新 `CHANGELOG.md`（包含部署的提交哈希值）\n- 将部署的提交标记为 `vX.Y.Z` 并推送该标签\n- 使用 `CHANGELOG.md` 条目从该标签创建 GitHub Release\n\n## 文档 - 👇 从这里开始 👇\n\n要开始使用 Lumibot，您可以查看下面的文档。\n\n**请在此处查看项目文档：👉 \u003Chttp:\u002F\u002Flumibot.lumiwealth.com\u002F> 👈**\n\n## AI 交易代理与代理式回测\n\nLumibot 现在内置了用于策略的 AI 交易代理运行时。您可以通过 `self.agents.create(...)` 创建一个代理，在 `initialize()`、`on_trading_iteration()`、`on_filled_order()` 或其他生命周期方法中运行它，并在回测和实盘交易中重复使用同一策略。\n\n- 直接在 LumiBot 策略中构建 **AI 交易代理**\n- 使用 **DuckDB** 作为时间序列分析的查询接口，而不是将原始 K 线数据直接输入提示词\n- 在 **回测** 中重放相同的代理决策，而无需再次付费调用模型\n- 挂载外部 **MCP 服务器** 以获取新闻、宏观数据、公司公告或其他特定领域的工具\n- 使用 LumiBot 内置的运行时提示词加上您自己的系统提示词，结合结构化追踪和默认的每轮摘要，便于调试\n- 让策略负责时机选择、风险规则和执行\n\n从这里开始：\n\n- Sphinx 文档：[https:\u002F\u002Flumibot.lumiwealth.com\u002Fagents.html](https:\u002F\u002Flumibot.lumiwealth.com\u002Fagents.html)\n- 回测文档：[https:\u002F\u002Flumibot.lumiwealth.com\u002Fbacktesting.html](https:\u002F\u002Flumibot.lumiwealth.com\u002Fbacktesting.html)\n- 股票示例：[lumibot\u002Fexample_strategies\u002Fagent_stock_backtest.py](https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fblob\u002Fdev\u002Flumibot\u002Fexample_strategies\u002Fagent_stock_backtest.py)\n- 期权示例：[lumibot\u002Fexample_strategies\u002Fagent_option_backtest.py](https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fblob\u002Fdev\u002Flumibot\u002Fexample_strategies\u002Fagent_option_backtest.py)\n- 仓库指南：[docs\u002FAI_TRADING_AGENTS.md](https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fblob\u002Fdev\u002Fdocs\u002FAI_TRADING_AGENTS.md)\n\n## 关于 BotSpot 的更多信息\n\nBotSpot 是一个基于 Lumibot 构建的平台，任何人都可以使用 AI 构建、回测和部署交易策略。**请访问 [BotSpot.trade](https:\u002F\u002Fbotspot.trade\u002F?utm_source=lumibot+docs&utm_medium=documentation&utm_campaign=GitHub+Readme) 开始使用。**\n\n## 了解更多\n\n请查看我们的博客中的示例策略和教程，或者使用我们的 AI 代理为您构建策略：\n\n**博客：** https:\u002F\u002Flumiwealth.com\u002Fblog\u002F\n**AI 策略构建器：** https:\u002F\u002Fwww.botspot.trade\u002F?utm_source=github&utm_medium=referral&utm_campaign=lumibot_readme\n\n## 运行回测\n\n要运行回测，您可以使用以下代码片段：\n\n```bash\npython -m lumibot.example_strategies.stock_buy_and_hold\n```\n\n## 回测数据源（环境变量覆盖）\n\n您可以通过 `BACKTESTING_DATA_SOURCE` 环境变量选择回测数据源（这会覆盖代码中任何显式的 `datasource_class` 设置）。当您的环境已经指定了提供商时，请在调用 `Strategy.backtest(...)` 或 `Strategy.run_backtest(...)` 时将 `datasource_class` 设置为 `None`：\n\n```python\nMyStrategy.backtest(\n    datasource_class=None,\n    backtesting_start=None,\n    backtesting_end=None,\n)\n```\n\n环境驱动的路由仍然以相同的方式工作：\n\n```bash\n# 单一提供商回测（示例）\nexport BACKTESTING_DATA_SOURCE=thetadata\nexport BACKTESTING_DATA_SOURCE=ibkr\n```\n\n多提供商路由（按资产类型）则可通过设置 JSON 映射来实现：\n\n```bash\n# 示例：股票\u002F期权\u002F指数使用 ThetaData，期货\u002F加密货币使用 IBKR\nexport BACKTESTING_DATA_SOURCE='{\"default\":\"thetadata\",\"stock\":\"thetadata\",\"option\":\"thetadata\",\"index\":\"thetadata\",\"future\":\"ibkr\",\"crypto\":\"ibkr\"}'\n```\n\n# 示例：将加密货币数据通过特定的交易所 ID 路由到 CCXT（如果需要）\nexport BACKTESTING_DATA_SOURCE='{\"default\":\"thetadata\",\"crypto\":\"coinbase\"}'\n```\n\n## 运行一个示例策略\n\n我们在这个 GitHub 仓库中创建了一个小型示例策略，以展示如何使用 Lumibot：[示例算法 GitHub](https:\u002F\u002Fgithub.com\u002FLumiwealth-Strategies\u002Fstock_example_algo)\n\n要运行此示例策略，请点击下方的“Deploy to Render”按钮将其部署到 Render（我们的推荐）。你也可以点击下方的“Run on Repl.it”按钮在 Repl.it 上运行该策略。\n\n[![Deploy to Render](https:\u002F\u002Frender.com\u002Fimages\u002Fdeploy-to-render-button.svg)](https:\u002F\u002Frender.com\u002Fdeploy?repo=https:\u002F\u002Fgithub.com\u002FLumiwealth-Strategies\u002Fstock_example_algo)\n\n[![Run on Repl.it](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FLumiwealth_lumibot_readme_26e23a0dcf49.png)](https:\u002F\u002Freplit.com\u002Fnew\u002Fgithub\u002FLumiwealth-Strategies\u002Fstock_example_algo)\n\n**有关此示例策略的更多信息，请查看示例策略仓库中的 README：[示例算法](https:\u002F\u002Fgithub.com\u002FLumiwealth-Strategies\u002Fstock_example_algo)**\n\n## 贡献者\n\n如果你想为 Lumibot 做贡献，可以查看下面的入门指南。我们一直在寻找愿意帮助我们的贡献者！\n\n这里有一段视频可以帮助你开始为 Lumibot 做贡献：[观看视频](https:\u002F\u002Fyoutu.be\u002FHuz6VxqafZs)\n\n**贡献步骤：**\n\n0. 观看视频：[观看视频](https:\u002F\u002Fyoutu.be\u002FHuz6VxqafZs)\n1. 将仓库克隆到你的本地机器\n2. 为你的功能创建一个新的分支\n3. 运行 `pip install -r requirements_dev.txt` 来安装开发依赖项\n4. 安装 setup.py 中的所有依赖：`pip install -e .`\n5. 进行更改\n6. 运行 `pytest` 确保所有测试都通过\n7. 创建一个拉取请求，将你的分支合并到主分支\n\n## 运行测试\n\n我们使用 pytest 作为测试框架。某些测试需要在根目录下的 `.env` 文件中设置 API 密钥。要运行测试，可以执行以下命令：\n\n```bash\npytest\n```\n\n要运行单个测试文件，可以执行以下命令：\n\n```bash\npytest tests\u002Ftest_asset.py\n```\n\n## 远程缓存配置\n\n当启用新的回测缓存管理器时，Lumibot 可以将其本地 Parquet 缓存镜像到 AWS S3。此功能是可选的，默认使用本地存储。要配置环境变量、了解密钥命名规范并遵循手动验证清单，请参阅 `docs\u002Fremote_cache.md`。\n\n### 显示代码覆盖率\n\n要显示代码覆盖率，可以运行以下命令：\n\n```bash\ncoverage run; coverage report; coverage html\n```\n\n#### 在 Linux 或 macOS 上添加别名\n\n这会在终端中显示代码覆盖率，并创建一个名为 “htmlcov” 的文件夹，其中包含一个名为 “index.html” 的文件。你可以在浏览器中打开该文件，以更易读的方式查看代码覆盖率。\n\n如果你不想每次都输入完整的命令，可以在 bash 中为其添加一个别名。为此，可以运行以下命令：\n\n```bash\nalias cover='coverage run; coverage report; coverage html'\n```\n\n现在你只需在终端中输入 “cover” 即可运行该命令。\n\n```bash\ncover\n```\n\n如果你想将其添加到你的 .bashrc 文件中，可以运行以下命令：\n\n```bash\necho \"alias cover='coverage run; coverage report; coverage html'\" >> ~\u002F.bashrc\n```\n\n#### 在 Windows 上添加别名\n\n如果你使用的是 Windows，可以通过运行以下命令来添加别名：\n\n将以下内容添加到你的 PowerShell 配置文件 (profile.ps1)：\n\n```powershell\nfunction cover { \n coverage run\n coverage report\n coverage html\n}\n```\n\n### 在 VS Code 中设置 PyTest\n\n要在 VS Code 中进行调试设置，可以将以下内容添加到 launch.json 文件的 “configurations” 部分。这样你就可以进入 “Run and Debug” 并从那里运行测试，同时使用断点等功能。\n\n注意：你可能需要将 args 更改为你的测试文件夹路径。\n\n```json\n{\n    \"name\": \"Python: Pytest\",\n    \"type\": \"python\",\n    \"request\": \"launch\",\n    \"module\": \"pytest\",\n    \"args\": [\n        \"lumibot\u002Ftests\"\n    ],\n    \"console\": \"integratedTerminal\",\n}\n```\n\n以下是一个实际的 launch.json 文件示例：\n\n```json\n{\n    \"version\": \"0.2.0\",\n    \"configurations\": [\n        {\n            \"name\": \"Python: Pytest\",\n            \"type\": \"python\",\n            \"request\": \"launch\",\n            \"module\": \"pytest\",\n            \"args\": [\n                \"lumibot\u002Ftests\"\n            ],\n            \"console\": \"integratedTerminal\",\n        }\n    ]\n}\n```\n\n## 数据源说明\n\n下表指出了我们在 Lumibot 中使用的不同数据源之间的一些差异。这些差异指的是从 get_historical_prices 调用返回的 Bars 实体中所包含的数据。\n\n| data_source | 类型  | OHLCV | 是否已调整拆股 | 是否包含股息 | 是否计算收益 | 是否已调整股息收益 |\n|-------------|-------|-------|----------------|-----------|---------|---------------------------|\n| yahoo       | 股票 | 是   | 是            | 是       | 是     | 是                       |\n| alpaca      | 股票 | 是   | 是            | 否        | 是     | 否                        |\n| polygon     | 股票 | 是   | 是            | 否        | 是     | 否                        |\n| Tradier     | 股票 | 是   | 是            | 否        | 是     | 否                        |\n| Pandas*     | 股票 | 是   | 是            | 是       | 是     | 是                       |\n\n*Pandas 本身并不是一个数据源，但它可以加载与 Yahoo 数据框格式相同的 CSV 文件，这些文件可能包含股息信息。\n\n## 我们贡献者可能会用到的一些 Git 命令\n\n创建新分支并从 main 拉取最新代码：\n```shell\ngit checkout -b my-feature\ngit fetch origin\ngit merge origin\u002Fdev\n```\n\n将工作提交到你的功能分支：\n```shell\ngit add .\ngit commit -m \"my changes\"\ngit push -u origin my-feature\n```\n\n如果你在另一个分支上工作时，main 分支已经更新了内容，你可以通过变基操作将其合并到你的分支中。请注意，由于你已经对本地分支进行了变基，因此需要强制推送更改以更新远程分支。--force-with-lease 选项比 --force 更安全，因为它会在远程分支上有任何尚未合并到你本地分支的新提交时中止推送。\n```shell\ngit checkout dev\ngit fetch origin\ngit merge origin\u002Fdev\ngit checkout my-feature\ngit rebase dev\ngit checkout my-feature\ngit push --force-with-lease origin my-feature\n```\n\n当准备好将分支合并到 main 时，进入 GitHub 创建一个拉取请求并等待审核。一旦 PR 被批准，它就会自动合并到远程的 dev 分支。此时，你可以删除本地分支和远程分支。\n```shell\ngit checkout dev\ngit fetch origin\ngit merge origin\u002Fdev\ngit branch -D my-feature\ngit push origin --delete my-feature\n```\n\n## 社区\n\n如果你想深入了解 Lumibot 或算法交易，那么我们的社区一定会让你爱不释手！你可以通过 Discord 加入我们。\n\n**加入我们的 Discord：[https:\u002F\u002Fdiscord.gg\u002FTmMsJCKY3T](https:\u002F\u002Fdiscord.gg\u002FTmMsJCKY3T)**\n\n**在 [BotSpot.trade](https:\u002F\u002Fbotspot.trade\u002F) 上构建 AI 驱动的交易机器人** — 我们的平台支持使用 AI 辅助创建、测试和部署交易策略！\n\n## AI 训练营\n\n需要实战指导来构建你的交易机器人吗？加入我们的 **AI 训练营**，你将学习如何利用 AI 构建、回测并部署交易策略——无需编写任何代码。\n\n**你将学到：**\n- 使用简单的英文指令构建股票、加密货币、期权和期货交易机器人\n- 掌握专业工具，如带有 Copilot 和 Cursor 的 VS Code\n- 对你的策略进行回测，并将其部署到真实交易账户\n- 加入我们超过 2,400 名交易者的社区\n\n**[了解更多关于 AI 训练营的信息](https:\u002F\u002Fwww.botspot.trade\u002Fai-bot-builder-bootcamp?utm_source=github&utm_medium=referral&utm_campaign=lumibot_readme)**\n\n---\n\n**只想试用 AI 功能吗？** [立即在 BotSpot.trade 开始免费试用](https:\u002F\u002Fwww.botspot.trade\u002F?utm_source=github&utm_medium=referral&utm_campaign=lumibot_readme) — 几分钟内即可构建策略，无需任何编程。\n\n## 许可证\n\n本库采用 MIT 开源软件许可证，详情请见：[https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fblob\u002Fmaster\u002FLICENSE](https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fblob\u002Fmaster\u002FLICENSE)","# Lumibot 快速上手指南\n\nLumibot 是一个用于股票、期权、加密货币、期货和外汇的回测与实盘交易库。其核心优势在于**代码复用**：编写一次策略代码，即可同时用于历史回测和实盘交易。\n\n## 1. 环境准备\n\n在开始之前，请确保您的开发环境满足以下要求：\n\n*   **操作系统**：Linux, macOS 或 Windows\n*   **Python 版本**：建议 Python 3.8 及以上\n*   **前置依赖**：\n    *   `pip` (Python 包管理工具)\n    *   `git` (用于克隆代码库)\n*   **数据源准备**（重要）：\n    *   回测需要历史数据。官方推荐数据源为 [ThetaData](https:\u002F\u002Fwww.thetadata.net\u002F)（提供最深度的历史覆盖）。\n    *   如需使用 ThetaData，请在结账时使用优惠码 `BotSpot10` 获取首单九折优惠。\n    *   *注意：若涉及 ThetaData 相关操作，请务必阅读项目中的 `AGENTS.md` 文件以遵守安全规则。*\n\n## 2. 安装步骤\n\n### 方式一：通过 PyPI 安装（推荐用于开发策略）\n\n直接使用 pip 安装最新稳定版：\n\n```bash\npip install lumibot\n```\n\n### 方式二：从源码安装（推荐用于贡献代码或使用最新特性）\n\n如果您需要修改库本身或使用开发分支功能，请按以下步骤操作：\n\n1.  **克隆仓库**：\n    ```bash\n    git clone https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot.git\n    cd lumibot\n    ```\n\n2.  **安装开发依赖**：\n    ```bash\n    pip install -r requirements_dev.txt\n    ```\n\n3.  **以编辑模式安装**：\n    ```bash\n    pip install -e .\n    ```\n\n## 3. 基本使用\n\n### 运行内置示例策略\n\n安装完成后，您可以直接运行官方提供的“买入并持有”示例策略来验证环境是否正常：\n\n```bash\npython -m lumibot.example_strategies.stock_buy_and_hold\n```\n\n### 配置回测数据源\n\nLumibot 支持通过环境变量灵活切换数据源，无需修改代码。\n\n**设置单一数据源（例如 ThetaData）：**\n\n```bash\nexport BACKTESTING_DATA_SOURCE=thetadata\n```\n\n**设置多数据源路由（根据资产类型自动切换）：**\n\n```bash\n# 示例：股票\u002F期权使用 ThetaData，期货\u002F加密货币使用 IBKR\nexport BACKTESTING_DATA_SOURCE='{\"default\":\"thetadata\",\"stock\":\"thetadata\",\"option\":\"thetadata\",\"index\":\"thetadata\",\"future\":\"ibkr\",\"crypto\":\"ibkr\"}'\n```\n\n在代码中调用回测时，若已通过环境变量配置，请将 `datasource_class` 设为 `None`：\n\n```python\nMyStrategy.backtest(\n    datasource_class=None,\n    backtesting_start=None,\n    backtesting_end=None,\n)\n```\n\n### 进阶：AI 交易代理 (AI Trading Agents)\n\nLumibot 内置了 AI 代理运行时，允许您在策略中直接集成 AI 决策逻辑，并支持在回测中重放相同的 AI 决策以节省 Token 成本。\n\n*   **文档入口**：[AI 代理文档](https:\u002F\u002Flumibot.lumiwealth.com\u002Fagents.html)\n*   **股票示例代码**：[agent_stock_backtest.py](https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fblob\u002Fdev\u002Flumibot\u002Fexample_strategies\u002Fagent_stock_backtest.py)\n*   **期权示例代码**：[agent_option_backtest.py](https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fblob\u002Fdev\u002Flumibot\u002Fexample_strategies\u002Fagent_option_backtest.py)\n\n### 无代码替代方案：BotSpot\n\n如果您希望不编写代码即可构建策略，可以尝试基于 Lumibot 构建的 [BotSpot](https:\u002F\u002Fbotspot.trade\u002F) 平台。只需使用自然语言描述策略，AI 即可自动生成代码、回测并部署到实盘。\n\n---\n*更多详细教程和策略示例，请访问官方博客：https:\u002F\u002Flumiwealth.com\u002Fblog\u002F*","一位量化交易开发者希望将基于自然语言描述的 AI 交易策略快速转化为可实盘运行的代码，并验证其在加密货币和股票市场的历史表现。\n\n### 没有 lumibot 时\n- **开发门槛高**：开发者需手动编写大量底层代码连接不同交易所 API，且回测与实盘逻辑分离，导致代码复用率极低。\n- **数据获取困难**：寻找高质量、覆盖多年的历史数据（如期權或期货）耗时费力，缺乏统一的数据源接口，清洗数据占用 80% 的时间。\n- **AI 策略落地难**：即使有大模型辅助生成策略思路，也难以将其安全地转化为可执行的交易代理（Agent），缺乏标准的运行时环境。\n- **验证周期长**：每次调整策略参数都需要重新搭建测试环境，无法快速进行多轮迭代回测，错失市场时机。\n\n### 使用 lumibot 后\n- **一套代码通吃**：利用 lumibot“回测即实盘”的特性，同一套策略代码可直接从历史数据验证无缝切换至 Alpaca 或交互式经纪商进行真实交易。\n- **数据集成便捷**：直接集成 ThetaData 等深度数据源，一键获取涵盖股票、加密币及期货的高质量历史数据，大幅缩短数据准备时间。\n- **AI 代理原生支持**：通过内置的 AI 交易代理运行时，开发者可轻松创建并安全运行由自然语言生成的 agentic 策略，降低算法实现风险。\n- **高效迭代验证**：凭借高度优化的回测引擎，能在几分钟内完成多年数据的策略压力测试，快速筛选出高胜率模型。\n\nlumibot 通过统一回测与实盘架构并原生支持 AI 代理，让交易者能将精力从繁琐的基础设施搭建完全聚焦于策略逻辑本身。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FLumiwealth_lumibot_ef4b0cc1.png","Lumiwealth","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002FLumiwealth_9918fd6a.png",null,"https:\u002F\u002Fgithub.com\u002FLumiwealth",[19],{"name":20,"color":21,"percentage":22},"Python","#3572A5",100,1337,269,"2026-04-13T02:02:00","GPL-3.0",2,"Linux, macOS, Windows","未说明",{"notes":31,"python":29,"dependencies":32},"该工具主要用于股票、期权、加密货币等的回测和交易。回测需要外部数据源（推荐 ThetaData），需配置相应的环境变量（如 BACKTESTING_DATA_SOURCE）和 API 密钥。支持通过 AWS S3 配置远程缓存。开发贡献者需安装 requirements_dev.txt 中的依赖。文档提及了针对 ThetaData 连接的特定安全规则（如使用 AWS 托管的下载器）。",[33,34,35],"pytest","coverage","DuckDB",[37,38],"开发框架","Agent",[40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59],"strategy","trading","broker","alpaca","investing","trade","trading-strategies","trading-bot","finance","algorithmic-trading","trading-algorithms","backtesting","backtesting-trading-strategies","backtester","backtesting-engine","quantitative-finance","forex","cryptocurrency","crypto","crypto-bot","ready","2026-03-27T02:49:30.150509","2026-04-13T16:25:38.953873",[64,69,74,79,84,89],{"id":65,"question_zh":66,"answer_zh":67,"source_url":68},31726,"为什么日内动量示例中的数值长时间不变化？","如果数据源（如 Alpaca）没有返回新的 K 线数据，算法会使用相同的数据进行计算，导致动量值不变。这通常是因为数据流中断或无新交易发生。该问题已在版本 0.0.6 和提交记录 8c5c6c4 中修复。维护者计划系统地扫描返回的 DataFrame 并进行后处理以填充空缺数据。如果算法检测到自上次计算以来数据未发生变化，理论上应返回 0% 的动量，但旧版本未正确存储和使用时间戳来判断数据是否更新。","https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fissues\u002F26",{"id":70,"question_zh":71,"answer_zh":72,"source_url":73},31727,"运行策略时遇到 'Naive time - no tzinfo set' 错误怎么办？","该错误通常发生在从 Polygon 获取数据时，原因是时间对象缺少时区信息（tzinfo）。根据社区反馈，此问题在 Lumibot 的最新更新中已得到解决。如果仍然遇到此错误，请确保升级到最新版本。此外，有时该错误被其他错误（如请求的日期超出数据范围）掩盖，需检查日志中是否有类似 'The date you are looking for... is outside of the data's date range' 的提示，并确认订阅级别（如 Polygon 的 Starter 级选项）是否包含所需的数据类型（如期权交易数据）。","https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fissues\u002F399",{"id":75,"question_zh":76,"answer_zh":77,"source_url":78},31728,"Lumibot 支持哪些 Python 版本？运行时出现版本兼容异常如何解决？","早期版本在 Python 3.6、3.8 和 3.10 上运行时可能会抛出异常。维护者已更新项目以明确指定并强制要求的 Python 版本。如果遇到此类问题，请尝试升级 Lumibot 到最新版本，通常能解决版本不匹配导致的运行时错误。建议在安装前查看项目的 requirements 文件或 setup.cfg 以确认支持的 Python 版本范围。","https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fissues\u002F179",{"id":80,"question_zh":81,"answer_zh":82,"source_url":83},31729,"在使用 DuckDB 进行回测时遇到数据类型转换错误如何解决？","该错误通常是因为价格列使用了 float 类型导致计算失败（如 trade_cost 计算）。解决方案是将 DuckDB 建表语句中的价格列类型修改为 DECIMAL。具体代码修改如下：将创建 candles 表的语句更新为 `con.execute(\"\"\"CREATE TABLE IF NOT EXISTS candles (datetime DATETIME, open DECIMAL, high DECIMAL, low DECIMAL, close DECIMAL, volume DECIMAL, missing INTEGER)\"\"\")`。此修复已合并到主分支并将包含在后续发布版本中。","https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fissues\u002F414",{"id":85,"question_zh":86,"answer_zh":87,"source_url":88},31730,"如何在非交易时间（如盘后）进行股票交易？","可以通过在策略的 `initialize()` 方法中调用 `self.set_market(\"24\u002F7\")` 来启用全天候交易模式。启用后，您可以在 `on_trading_iteration` 方法中使用 `if` 语句结合 `self.get_datetime()` 来判断当前时间，从而控制在特定时间段内的交易逻辑。目前该功能主要用于加密货币交易，但对于支持延长交易时段的股票，也可以通过类似逻辑实现。","https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fissues\u002F32",{"id":90,"question_zh":91,"answer_zh":92,"source_url":93},31731,"在 Python 3.12 或 macOS M1 芯片上执行 'pip install lumibot' 失败怎么办？","在 Python 3.12.2 或 macOS Sonoma (M1 Pro) 环境下安装时，可能会因 Pandas 包编译问题报错：`ERROR: Unable to detect linker for compiler cc -Wl,--version`。这通常是由于缺少必要的构建工具或编译器配置不当。建议确保已安装 Xcode Command Line Tools (`xcode-select --install`)，并尝试升级 pip、setuptools 和 wheel 到最新版本。如果问题依旧，可能需要等待依赖包（如 Pandas）发布针对新 Python 版本或 ARM 架构的预编译二进制文件，或在虚拟环境中尝试使用较低版本的 Python（如 3.10 或 3.11）进行安装。","https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fissues\u002F383",[95,100,105,110,115,120,125,130,135,140,145,150,155,160,165,170,175,180,185,190],{"id":96,"version":97,"summary_zh":98,"released_at":99},238942,"v4.4.61","**完整更新日志**：https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fcompare\u002Fv4.4.59...v4.4.61","2026-04-01T19:44:35",{"id":101,"version":102,"summary_zh":103,"released_at":104},238943,"v4.4.58","## 变更内容\n* v4.4.58 — 代理工具源代码注入、规范示例、文档更新，由 @grzesir 在 https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fpull\u002F984 中完成\n\n\n**完整变更日志**: https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fcompare\u002Fv4.4.57...v4.4.58","2026-04-01T06:21:35",{"id":106,"version":107,"summary_zh":108,"released_at":109},238944,"v4.4.57","## 变更内容\n* 由 @brettelliot 在 https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fpull\u002F976 中实现 Tradier 平台的股票做空功能\n* 回测：修复控制台打印设置被覆盖的问题，由 @davidlatte 在 https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fpull\u002F981 中完成\n* v4.4.57 — AI 代理、Tradier 做空、日志记录器修复、现金事件，由 @grzesir 在 https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fpull\u002F983 中实现\n\n\n**完整变更日志**: https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fcompare\u002Fv4.4.56...v4.4.57","2026-03-31T02:24:42",{"id":111,"version":112,"summary_zh":113,"released_at":114},238945,"v4.4.56","## 变更内容\n* v4.4.56 - 由 @grzesir 在 https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fpull\u002F980 中发布的报表指标 JSON 协议\n\n\n**完整变更日志**: https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fcompare\u002Fv4.4.55...v4.4.56","2026-03-17T08:49:57",{"id":116,"version":117,"summary_zh":118,"released_at":119},238946,"v4.4.55","## 变更内容\n* Projectx 订单管理，由 @davidlatte 在 https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fpull\u002F970 中完成\n* v4.4.55 - IBKR 日线查询修复及交易报告指标钩子，由 @grzesir 在 https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fpull\u002F978 中完成\n\n\n**完整变更日志**: https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fcompare\u002Fv4.4.54...v4.4.55","2026-03-16T02:21:32",{"id":121,"version":122,"summary_zh":123,"released_at":124},238947,"v4.4.54","## 变更内容\n* v4.4.54 - 由 @grzesir 在 https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fpull\u002F973 中创建分支\n* v4.4.54 - 由 @grzesir 在 https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fpull\u002F974 中实现按合约计算交易手续费\n\n\n**完整变更日志**: https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fcompare\u002Fv4.4.53...v4.4.54","2026-03-09T03:42:29",{"id":126,"version":127,"summary_zh":128,"released_at":129},238948,"v4.4.53","## 变更内容\n* v4.4.53 - 优化了IBKR的每日调度周期，并由@grzesir在 https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fpull\u002F972 中修复了期权的盯市估值和Delta相关问题。\n\n\n**完整变更日志**: https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fcompare\u002Fv4.4.52...v4.4.53","2026-03-06T22:16:23",{"id":131,"version":132,"summary_zh":133,"released_at":134},238949,"v4.4.52","## 变更内容\n* v4.4.52 - IBKR 股票\u002F指数预热功能，以及由 @grzesir 在 https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fpull\u002F971 中修复的 Yahoo 行动一致性问题\n\n\n**完整变更日志**: https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fcompare\u002Fv4.4.51...v4.4.52","2026-03-03T06:49:30",{"id":136,"version":137,"summary_zh":138,"released_at":139},238950,"v4.4.51","## 变更内容\n* v4.4.51 - 期权生命周期结算 + ThetaData MTM 修复，由 @grzesir 在 https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fpull\u002F969 中完成\n\n\n**完整变更日志**: https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fcompare\u002Fv4.4.50...v4.4.51","2026-02-26T04:37:47",{"id":141,"version":142,"summary_zh":143,"released_at":144},238951,"v4.4.50","## 变更内容\n* v4.4.50 - 指标加固 + ThetaData 接受度稳定化，由 @grzesir 在 https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fpull\u002F967 中完成\n\n\n**完整变更日志**: https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fcompare\u002Fv4.4.49...v4.4.50","2026-02-19T09:41:37",{"id":146,"version":147,"summary_zh":148,"released_at":149},238952,"v4.4.49","## What's Changed\n* v4.4.49 - Parquet backtest artifacts + contract logs by @grzesir in https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fpull\u002F966\n\n\n**Full Changelog**: https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fcompare\u002Fv4.4.48...v4.4.49","2026-02-11T00:04:13",{"id":151,"version":152,"summary_zh":153,"released_at":154},238953,"v4.4.48","## What's Changed\n* v4.4.48: Emit Parquet backtest artifacts (BotSpot perf) by @grzesir in https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fpull\u002F965\n\n\n**Full Changelog**: https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fcompare\u002Fv4.4.47...v4.4.48","2026-02-10T07:25:54",{"id":156,"version":157,"summary_zh":158,"released_at":159},238954,"v4.4.47","## What's Changed\n* v4.4.47 - IBKR seconds timesteps + crypto futures expirations + backtest budget env + downloader queue rename by @grzesir in https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fpull\u002F964\n\n\n**Full Changelog**: https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fcompare\u002Fv4.4.46...v4.4.47","2026-02-07T20:17:59",{"id":161,"version":162,"summary_zh":163,"released_at":164},238955,"v4.4.46","## What's Changed\n* v4.4.43 - Hotfix: add_ohlc actually shipped by @grzesir in https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fpull\u002F958\n* fix get trading days by @brettelliot in https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fpull\u002F961\n* Version 4.4.46 by @grzesir in https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fpull\u002F963\n* v4.4.44 - Hotfix: ship add_ohlc in PyPI wheel by @grzesir in https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fpull\u002F959\n\n\n**Full Changelog**: https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fcompare\u002Fv4.4.43...v4.4.46","2026-02-06T02:51:57",{"id":166,"version":167,"summary_zh":168,"released_at":169},238956,"v4.4.45","**Full Changelog**: https:\u002F\u002Fgithub.com\u002FLumiwealth\u002Flumibot\u002Fcompare\u002Fv4.4.44...v4.4.45","2026-01-30T09:00:47",{"id":171,"version":172,"summary_zh":173,"released_at":174},238957,"v4.4.39","## Highlights\n- Router backtesting (IBKR futures\u002Fcont_future\u002Fcrypto): prefetch full backtest window once per series and slice from memory to avoid per-iteration history fetches (major warm-cache speedup).\n- Indicators: fix plot_indicators hovertext generation when detail_text is missing\u002FNaN\u002FNA.\n\n## Docs\n- Added router IBKR speed investigation ledger and backtesting docs updates.\n\nFull diff: PR #953.","2026-01-27T07:39:20",{"id":176,"version":177,"summary_zh":178,"released_at":179},238958,"v4.4.33","## 4.4.33 - 2026-01-12\n\n### Fixed\n- SMART_LIMIT (live): avoid scanning full tracked order history in the background loop by using the broker’s active-order fast path, preventing high RSS growth in accounts with large historical order lists.\n- Backtesting (router): make dataset lookup timestep-aware so minute requests don’t accidentally resolve to daily Data objects, and routed crypto assets passed as `(base, quote)` work reliably.\n- Backtesting (router): refactor multi-provider routing to a provider registry + adapters (no hard-coded branching), add `alpaca`\u002F`ccxt` support, and allow CCXT exchange-id aliases like `coinbase`\u002F`kraken` (case\u002Fsep-insensitive).\n- IBKR (crypto): normalize daily timestep handling (`day`\u002F`1d`\u002F`1day`) so crypto daily bars consistently use the derived-daily path.\n- ThetaData: prevent acceptance backtests from hitting the downloader queue by enforcing CI-only warm-cache guardrails consistently (local runs behave like GitHub CI).\n- ThetaData: treat **session close** as “complete coverage” for index minute OHLC to avoid perpetual STALE→REFRESH loops when backtest end dates are represented as midnight.\n- Backtest cache (S3): speed up warm-cache hydration by streaming small objects via `get_object` instead of `download_file` transfer manager overhead.\n","2026-01-12T20:05:06",{"id":181,"version":182,"summary_zh":183,"released_at":184},238959,"v4.4.31","## 4.4.31 - 2026-01-09\n\nDeploy marker: `d5c6b730` (\"deploy 4.4.31\")\n\n### Changed\n- Acceptance backtests now run in CI (no longer marked `apitest`) and CI caps were raised for the long full-year strategies to account for runner variability.\n- Backtests running under pytest no longer auto-open HTML artifacts (plots\u002Ftearsheets) in a browser.\n\n### Fixed\n- ThetaData: reduced option chain fanout (chain cache reuse under expiry hints; strike-list prefetch limited to head+tail expirations when unconstrained).\n- Backtesting progress: improved per-asset download progress tracking in `download_status` so UI diagnostics are clearer.\n\n### Removed\n- ⚠️ Removed ThetaData chain default-horizon env vars (`THETADATA_CHAIN_DEFAULT_MAX_DAYS_OUT*`). Chain default horizons are now fixed and covered by tests.\n","2026-01-09T21:09:25",{"id":186,"version":187,"summary_zh":188,"released_at":189},238960,"v4.4.29","Deploy marker: b8c6a839 (deploy 4.4.29)\\n\\nFixed\\n- Prevent production backtests from OOM-like hard exits (ERROR_CODE_CRASH) when refreshing multi-year intraday ThetaData caches by avoiding deep copies during cache load\u002Fwrite and trimming non-option intraday frames in-memory.","2026-01-06T06:36:20",{"id":191,"version":192,"summary_zh":193,"released_at":194},238961,"v4.4.25","Deployed: b7f83088 (\"Deploy 4.4.25\")\\n\\nAdded\\n- Public env var docs: docsrc\u002Fenvironment_variables.rst (plus engineering notes docs\u002FENV_VARS.md)\\n- Backtest audit telemetry preserved in *_trade_events.csv (LUMIBOT_BACKTEST_AUDIT)\\n- Investigation docs for ThetaData corporate actions and performance\\n\\nChanged\\n- ThetaData option chain defaults bounded to reduce cold-cache request fanout (THETADATA_CHAIN_DEFAULT_MAX_DAYS_OUT*)\\n\\nFixed\\n- OptionsHelper delta-to-strike fast path to prevent per-strike quote storms (SPX Copy2\u002FCopy3 slowness)\\n- Prevent tear sheet generation crashes on degenerate\u002Fflat returns\\n- Reduce ThetaData corporate action request thrash via memoization\u002Fnegative caching\\n- Apply corporate actions to intraday frames during backtests to keep underlying prices aligned with split-normalized option chains\\n- Improve ThetaData snapshot quote selection near the session open","2026-01-05T03:23:08",[196,207,215,224,232,241],{"id":197,"name":198,"github_repo":199,"description_zh":200,"stars":201,"difficulty_score":202,"last_commit_at":203,"category_tags":204,"status":60},4358,"openclaw","openclaw\u002Fopenclaw","OpenClaw 是一款专为个人打造的本地化 AI 助手，旨在让你在自己的设备上拥有完全可控的智能伙伴。它打破了传统 AI 助手局限于特定网页或应用的束缚，能够直接接入你日常使用的各类通讯渠道，包括微信、WhatsApp、Telegram、Discord、iMessage 等数十种平台。无论你在哪个聊天软件中发送消息，OpenClaw 都能即时响应，甚至支持在 macOS、iOS 和 Android 设备上进行语音交互，并提供实时的画布渲染功能供你操控。\n\n这款工具主要解决了用户对数据隐私、响应速度以及“始终在线”体验的需求。通过将 AI 部署在本地，用户无需依赖云端服务即可享受快速、私密的智能辅助，真正实现了“你的数据，你做主”。其独特的技术亮点在于强大的网关架构，将控制平面与核心助手分离，确保跨平台通信的流畅性与扩展性。\n\nOpenClaw 非常适合希望构建个性化工作流的技术爱好者、开发者，以及注重隐私保护且不愿被单一生态绑定的普通用户。只要具备基础的终端操作能力（支持 macOS、Linux 及 Windows WSL2），即可通过简单的命令行引导完成部署。如果你渴望拥有一个懂你",349277,3,"2026-04-06T06:32:30",[38,37,205,206],"图像","数据工具",{"id":208,"name":209,"github_repo":210,"description_zh":211,"stars":212,"difficulty_score":202,"last_commit_at":213,"category_tags":214,"status":60},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,"2026-04-05T11:01:52",[37,205,38],{"id":216,"name":217,"github_repo":218,"description_zh":219,"stars":220,"difficulty_score":27,"last_commit_at":221,"category_tags":222,"status":60},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",152630,"2026-04-12T23:33:54",[37,38,223],"语言模型",{"id":225,"name":226,"github_repo":227,"description_zh":228,"stars":229,"difficulty_score":27,"last_commit_at":230,"category_tags":231,"status":60},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",108322,"2026-04-10T11:39:34",[37,205,38],{"id":233,"name":234,"github_repo":235,"description_zh":236,"stars":237,"difficulty_score":27,"last_commit_at":238,"category_tags":239,"status":60},6121,"gemini-cli","google-gemini\u002Fgemini-cli","gemini-cli 是一款由谷歌推出的开源 AI 命令行工具，它将强大的 Gemini 大模型能力直接集成到用户的终端环境中。对于习惯在命令行工作的开发者而言，它提供了一条从输入提示词到获取模型响应的最短路径，无需切换窗口即可享受智能辅助。\n\n这款工具主要解决了开发过程中频繁上下文切换的痛点，让用户能在熟悉的终端界面内直接完成代码理解、生成、调试以及自动化运维任务。无论是查询大型代码库、根据草图生成应用，还是执行复杂的 Git 操作，gemini-cli 都能通过自然语言指令高效处理。\n\n它特别适合广大软件工程师、DevOps 人员及技术研究人员使用。其核心亮点包括支持高达 100 万 token 的超长上下文窗口，具备出色的逻辑推理能力；内置 Google 搜索、文件操作及 Shell 命令执行等实用工具；更独特的是，它支持 MCP（模型上下文协议），允许用户灵活扩展自定义集成，连接如图像生成等外部能力。此外，个人谷歌账号即可享受免费的额度支持，且项目基于 Apache 2.0 协议完全开源，是提升终端工作效率的理想助手。",100752,"2026-04-10T01:20:03",[240,38,205,37],"插件",{"id":242,"name":243,"github_repo":244,"description_zh":245,"stars":246,"difficulty_score":27,"last_commit_at":247,"category_tags":248,"status":60},4721,"markitdown","microsoft\u002Fmarkitdown","MarkItDown 是一款由微软 AutoGen 团队打造的轻量级 Python 工具，专为将各类文件高效转换为 Markdown 格式而设计。它支持 PDF、Word、Excel、PPT、图片（含 OCR）、音频（含语音转录）、HTML 乃至 YouTube 链接等多种格式的解析，能够精准提取文档中的标题、列表、表格和链接等关键结构信息。\n\n在人工智能应用日益普及的今天，大语言模型（LLM）虽擅长处理文本，却难以直接读取复杂的二进制办公文档。MarkItDown 恰好解决了这一痛点，它将非结构化或半结构化的文件转化为模型“原生理解”且 Token 效率极高的 Markdown 格式，成为连接本地文件与 AI 分析 pipeline 的理想桥梁。此外，它还提供了 MCP（模型上下文协议）服务器，可无缝集成到 Claude Desktop 等 LLM 应用中。\n\n这款工具特别适合开发者、数据科学家及 AI 研究人员使用，尤其是那些需要构建文档检索增强生成（RAG）系统、进行批量文本分析或希望让 AI 助手直接“阅读”本地文件的用户。虽然生成的内容也具备一定可读性，但其核心优势在于为机器",93400,"2026-04-06T19:52:38",[240,37]]