[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-idanya--algo-trader":3,"tool-idanya--algo-trader":61},[4,18,26,36,44,53],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":17},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",[13,14,15,16],"Agent","开发框架","图像","数据工具","ready",{"id":19,"name":20,"github_repo":21,"description_zh":22,"stars":23,"difficulty_score":10,"last_commit_at":24,"category_tags":25,"status":17},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",[14,15,13],{"id":27,"name":28,"github_repo":29,"description_zh":30,"stars":31,"difficulty_score":32,"last_commit_at":33,"category_tags":34,"status":17},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 真正成长为懂上",148568,2,"2026-04-09T23:34:24",[14,13,35],"语言模型",{"id":37,"name":38,"github_repo":39,"description_zh":40,"stars":41,"difficulty_score":32,"last_commit_at":42,"category_tags":43,"status":17},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 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",108111,"2026-04-08T11:23:26",[14,15,13],{"id":45,"name":46,"github_repo":47,"description_zh":48,"stars":49,"difficulty_score":32,"last_commit_at":50,"category_tags":51,"status":17},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",[52,14],"插件",{"id":54,"name":55,"github_repo":56,"description_zh":57,"stars":58,"difficulty_score":10,"last_commit_at":59,"category_tags":60,"status":17},4487,"LLMs-from-scratch","rasbt\u002FLLMs-from-scratch","LLMs-from-scratch 是一个基于 PyTorch 的开源教育项目，旨在引导用户从零开始一步步构建一个类似 ChatGPT 的大型语言模型（LLM）。它不仅是同名技术著作的官方代码库，更提供了一套完整的实践方案，涵盖模型开发、预训练及微调的全过程。\n\n该项目主要解决了大模型领域“黑盒化”的学习痛点。许多开发者虽能调用现成模型，却难以深入理解其内部架构与训练机制。通过亲手编写每一行核心代码，用户能够透彻掌握 Transformer 架构、注意力机制等关键原理，从而真正理解大模型是如何“思考”的。此外，项目还包含了加载大型预训练权重进行微调的代码，帮助用户将理论知识延伸至实际应用。\n\nLLMs-from-scratch 特别适合希望深入底层原理的 AI 开发者、研究人员以及计算机专业的学生。对于不满足于仅使用 API，而是渴望探究模型构建细节的技术人员而言，这是极佳的学习资源。其独特的技术亮点在于“循序渐进”的教学设计：将复杂的系统工程拆解为清晰的步骤，配合详细的图表与示例，让构建一个虽小但功能完备的大模型变得触手可及。无论你是想夯实理论基础，还是为未来研发更大规模的模型做准备",90106,"2026-04-06T11:19:32",[35,15,13,14],{"id":62,"github_repo":63,"name":64,"description_en":65,"description_zh":66,"ai_summary_zh":66,"readme_en":67,"readme_zh":68,"quickstart_zh":69,"use_case_zh":70,"hero_image_url":71,"owner_login":72,"owner_name":73,"owner_avatar_url":74,"owner_bio":75,"owner_company":76,"owner_location":77,"owner_email":75,"owner_twitter":75,"owner_website":75,"owner_url":78,"languages":79,"stars":88,"forks":89,"last_commit_at":90,"license":91,"difficulty_score":92,"env_os":93,"env_gpu":94,"env_ram":95,"env_deps":96,"category_tags":104,"github_topics":106,"view_count":32,"oss_zip_url":75,"oss_zip_packed_at":75,"status":17,"created_at":114,"updated_at":115,"faqs":116,"releases":117},6022,"idanya\u002Falgo-trader","algo-trader","Trading bot with support for realtime trading, backtesting, custom strategies and much more.","algo-trader 是一款基于 Python 开发的开源算法交易策略构建与执行框架，旨在帮助开发者打造、回测并运行自定义的交易机器人。它主要解决了量化交易中策略验证难、实时执行门槛高的问题，让用户能够在本地环境中对策略进行严谨的历史数据回测，并在条件成熟时通过对接券商 API 实现实时自动交易。\n\n该工具特别适合具备一定编程基础的量化开发者、金融研究人员以及希望尝试自动化交易的极客用户。虽然其实时交易功能目前仍需用户自行适配具体的券商接口（如 Interactive Brokers），但其回测引擎已完全就绪，可立即投入使用。\n\nalgo-trader 的技术亮点在于其灵活的流水线（Pipeline）架构：数据从源头流入，经过一系列可自由组合的处理器（如技术指标计算），最终输出交易信号。系统支持将完整的策略流程序列化为 JSON 文件，便于保存、加载及集成到各类界面中。此外，它内置了 MongoDB 作为数据存储后端，并集成了 tulipy 库以高效计算各类技术分析指标，为策略研发提供了坚实的技术底座。需要注意的是，该项目仍在持续迭代中，是探索算法交易逻辑的理想实验场。","# algo-trader\n\nTrading strategies builder, backtester, and real-time trader.\n\n>pip install algorithmic-trader\n\n## Intro\n\nalgo-trader is an implementation of an algorithmic trading strategy executor and backtester.\nCapable of backtesting strategies locally and trading them in real-time via your broker API.\n\n> Please be aware that this is a **work in progress** and the trader is missing external market data and trade\n> providers.\n> If you'd like to use the trader for real-world trading, you'll have to implement your broker API.\n> Although real-time trading is not finished, backtesting is fully functional, so implemented strategies can be backtested\n> and used in real trading when it will be ready.\n\n\nalgo-trader is written in Python, and its current stack composes of:\n\n1. MongoDB as a backend data store for backtesting strategies\n2. [tulipy](https:\u002F\u002Fgithub.com\u002Fjesse-ai\u002Ftulipy) - Python bindings for [Tulip Indicators](https:\u002F\u002Ftulipindicators.org\u002F).\n   Used to provide technical indicators calculations.\n3. ib_client (Optional) - Python library to communicate with Interactive Brokers gateway. Only needed if you plan on\n   doing real trading via IB.\n\n\n## Architecture\n\n![System design](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fidanya_algo-trader_readme_20f6075aa9cd.png)\n\n### Pipeline\n\n[Pipeline](src\u002Falgotrader\u002Fpipeline\u002Fpipeline.py) is the basic facilitator of the stream. It’s the orchestrator responsible for\nreading data from the [Source](src\u002Falgotrader\u002Fpipeline\u002Fsource.py) and moving it to the processors in the stream.\nIt has no actual logic except for facilitating the processors.\nA pipeline and all of its child components are JSON serializable, that is for the system to be able to define, load and\nsave entire pipelines with their configurations on file.\nThis feature is an important one as it can be used as a facade for UI\u002FCLI based runners.\nExample serialized (and runnable) pipelines can be found in\nthe [examples\u002Fpipeline-templates](src\u002Falgotrader\u002Fexamples\u002Fpipeline-templates) directory.\nExample of loading them into [Pipeline](src\u002Falgotrader\u002Fpipeline\u002Fpipeline.py) and running them using\nthe [PipelineRunner](src\u002Falgotrader\u002Fpipeline\u002Frunner.py) can be found in [main.py](src\u002Falgotrader\u002Fmain.py)\n\n### PipelineRunner\n\nA [PipelineRunner](src\u002Falgotrader\u002Fpipeline\u002Frunner.py) will accept an initial list or singular [Pipeline](src\u002Falgotrader\u002Fpipeline\u002Fpipeline.py),\nand an optional starting [SharedContext](src\u002Falgotrader\u002Fpipeline\u002Fshared_context.py). If\na [SharedContext](src\u002Falgotrader\u002Fpipeline\u002Fshared_context.py) is not provided during construction, a new one will be initialized.\nEach [Pipeline](src\u002Falgotrader\u002Fpipeline\u002Fpipeline.py) will be called through `run()` in the order that it was listed with the\nprevious context. The context will move through each [Pipeline](src\u002Falgotrader\u002Fpipeline\u002Fpipeline.py) allowing for some operations\nsuch as loading, caching and validation to occur before data collection and sink.\n\n### Sources\n\nA [Source](src\u002Falgotrader\u002Fpipeline\u002Fsource.py) is an implementation of a Candle Iterator. This is the starting point of the pipeline\nand the \"source\" for the incoming candles processed.\n\n### Processors\n\n[Processor](src\u002Falgotrader\u002Fpipeline\u002Fprocessor.py) is the primary processing unit in the pipeline. Processors can be constructed in\nany order while Candles are flowing from the source, forward through all processors.\nEach processor is responsible for sending the candles it processes to the next processor (unless it has a reason not to)\n.\n\nThe `process()` function gets with each candle also an object called [`SharedContext`](src\u002Falgotrader\u002Fpipeline\u002Fshared_context.py).\nThe context is an instance of an in-memory KV store to share context and information between processors.\n\nAnother way to share data between processors is to make use of the `attachments` field on the Candle itself.\nThis field is intended for metadata on the candle, like calculations and state relevant to that candle point in time.\nCandle attachments are persistent throughout the pipeline.\n\n#### Reprocessing\n\nReprocessing is a feature that enables a processor to re-send an already processed candle to the next processor.\nReprocessing is useful for processors that do some logic outside the main flow of the pipeline. for example, upon\nevents, external triggers, market\u002Ftrade provider's events\u002Fissues, etc...\nAn example of reprocessing can be found in\nthe [AssetCorrelationProcessor](src\u002Falgotrader\u002Fpipeline\u002Fprocessors\u002Fassets_correlation.py)\n\n### Events\n\nAn [Event](src\u002Falgotrader\u002Fentities\u002Fevent.py) as its name suggests, defines an event that occurred in the system.\nIt follows the same flow as the Candles, passing between processors. Each processor is responsible for propagating the\nevent to the next processor (if needed).\n\nBecause pipelines are data-driven and not time-driven, events can be used as checkpoints to indicate something that\nhappened in the data stream.\nFor example, running the same pipeline from a DB source and a real-time market data source can have different effects if\nthe processor were to rely on time.\n\n_It is crucial to have the same behavior when fast-running from DB and real-time for backtesting to be useful._\n\n### Strategies\n\nStrategies are executed per candle by the [StrategyProcessor](src\u002Falgotrader\u002Fpipeline\u002Fprocessors\u002Fstrategy.py).\nA strategy is responsible for executing the trading logic and dispatching\nSignals ([StrategySignal](src\u002Falgotrader\u002Fentities\u002Fstrategy_signal.py)).\nIn the event a strategy is raising a trading signal, the StrategyProcessor will catch and pass it to\nthe [SignalsExecutor](src\u002Falgotrader\u002Ftrade\u002Fsignals_executor.py) for execution.\n\n### Terminators\n\nA [Terminator](src\u002Falgotrader\u002Fpipeline\u002Fterminator.py) is an optional final piece of the pipeline. It's executed at the very end of\na pipeline when the Source iterator has been fully consumed.\nTerminators are useful for unit testing, backtesting, and environment cleanups.\n\n## Running locally\n\nalgo-trader is using MongoDB for data storage. To run Mongo locally use `docker-compose`.\n\n```shell\ndocker-compose -f docker-compose.yml up -d\n```\n\n## CLI\n\nThe CLI is a simple interface to run the system. It can be used to run a pipeline, backtest a strategy, or run a\nstrategy in real-time.\nCurrently, the CLI is not fully implemented and most of the functionality is to `describe` and `list` the available\nprocessors and strategies.\nRunning the CLI without any arguments will show the help menu.\n\nWhen the package installed via PIP, the command `algo-trader` will be available. \nIf you choose to clone this repo, use `python main.py` as your entry point.  \n\n```shell\nalgo-trader\n```\n\nTo list all available processors:\n\n```shell\nalgo-trader processor list\n```\n\nTo describe a specific processor:\n\n```shell\nalgo-trader processor describe \u003Cprocessor_name>\n```\n\nSame pattern applies to strategies and sources.\nIn order to run a pipeline, you'll need to create a pipeline template file. and run it using the CLI.\n\n```shell\nalgo-trader pipeline run \u003Cpipeline_template_file>\n```\n\n### Easy to run examples:\n\n* Data loader from Yahoo finance can be found in [src\u002Falgotrader\u002Fexamples\u002Fpipeline-templates\u002Fbuild_daily_yahoo_loader.py](src\u002Falgotrader\u002Fexamples\u002Fpipeline-templates\u002Fbuild_daily_yahoo_loader.json). \nRunning this example pipeline will load historical data from Yahoo finance to MongoDB:\n\n   ```shell\n   algo-trader pipeline run examples\u002Fpipeline-templates\u002Fbuild_daily_yahoo_loader.json\n   ```\n* Data loader from Binance can be found in [src\u002Falgotrader\u002Fexamples\u002Fpipeline-templates\u002Fbuild_daily_binance_loader.json](src\u002Falgotrader\u002Fexamples\u002Fpipeline-templates\u002Fbuild_daily_binance_loader.json). \nRunning this example pipeline will load historical data from Binance to MongoDB:\n\n   ```shell\n   algo-trader pipeline run examples\u002Fpipeline-templates\u002Fbuild_daily_binance_loader.json\n   ```\n\n* Realtime Crypto pipeline from Binance can be found in [src\u002Falgotrader\u002Fexamples\u002Fpipeline-templates\u002Fbuild_realtime_binance.json](src\u002Falgotrader\u002Fexamples\u002Fpipeline-templates\u002Fbuild_realtime_binance.json). \nRunning this example pipeline will process realtime, second candles from Binance:\n\n   ```shell\n   algo-trader pipeline run examples\u002Fpipeline-templates\u002Fbuild_realtime_binance.json\n   ```\n\n### Code example\n\nShort code example with comments. This is how one would typically use `algo-trader` as a library to \nload and calculate technical indicators on stocks data from Yahoo finance to MongoDB\n\n```python\nfrom datetime import datetime, timedelta\n\nfrom algotrader.calc.calculations import TechnicalCalculation\nfrom algotrader.entities.timespan import TimeSpan\nfrom algotrader.pipeline.configs.indicator_config import IndicatorConfig\nfrom algotrader.pipeline.configs.technical_processor_config import TechnicalsProcessorConfig\nfrom algotrader.pipeline.pipeline import Pipeline\nfrom algotrader.pipeline.processors.candle_cache import CandleCache\nfrom algotrader.pipeline.processors.storage_provider_sink import StorageSinkProcessor\nfrom algotrader.pipeline.processors.technicals import TechnicalsProcessor\nfrom algotrader.pipeline.runner import PipelineRunner\nfrom algotrader.pipeline.sources.yahoo_finance_history import YahooFinanceHistorySource\nfrom algotrader.storage.mongodb_storage import MongoDBStorage\n\n\ndef main():\n    # create a MongoDB Storage connector\n    mongodb_storage = MongoDBStorage()\n\n    # Create a Yahoo finance Source connector\n    source = YahooFinanceHistorySource(\n        ['AAPL', 'MSFT', 'GOOG'],  # Pass in the list of symbols to fetch\n        TimeSpan.Day,  # Choose the candles interval\n        datetime.now() - timedelta(days=100),  # Date to start fetching from\n        datetime.now()  # The last date to fetch to\n    )\n\n    # Create a MongoDB Sink processor that will save all processed candles to mongo\n    # using the storage connector.\n    sink = StorageSinkProcessor(mongodb_storage)\n\n    # Cache processor acts like an in-memory cache and enable processors to share data between on another\n    cache_processor = CandleCache(sink)\n    # Create a technical indicators process that will add each candle with indicators data.\n    # We then pass the candles to the cache processor, so we can later use this data and share it\n    # with other processors if needed.\n    technicals_config = TechnicalsProcessorConfig([\n        IndicatorConfig('sma5', TechnicalCalculation.SMA, [5]),\n        IndicatorConfig('sma20', TechnicalCalculation.SMA, [20]),\n        IndicatorConfig('cci7', TechnicalCalculation.CCI, [7]),\n        IndicatorConfig('cci14', TechnicalCalculation.CCI, [14]),\n        IndicatorConfig('rsi7', TechnicalCalculation.CCI, [7]),\n        IndicatorConfig('rsi14', TechnicalCalculation.CCI, [14]),\n        IndicatorConfig('stddev5', TechnicalCalculation.STDDEV, [5]),\n    ])\n\n    processor = TechnicalsProcessor(technicals_config, cache_processor)\n\n    # Construct the pipline object. This object can be serialized as JSON, saved, and reloaded whenever we need it.\n    pipeline = Pipeline(source, processor)\n\n    # Provide the Pipline object to the runner which will execute it.\n    # The Runner can execute multiple pipelines one after the other.\n    # This enabled the ability to construct a pipelines flow where each pipeline depends on another.\n    PipelineRunner(pipeline).run()\n\n```\n  \n## Using this repo locally\n\n### Virtual environment\n\nIt is best to use a virtual environment to run algo-trader.\n\n```shell\npython3 -m venv run\nsource run\u002Fbin\u002Factivate\npip3 install -r requirements.txt\n```\n\n### Running tests\n\n* Unit: `.\u002Fscripts\u002Ftest-unit.sh`\n* Integration (needs IB gateway running): `.\u002Fscripts\u002Ftest-integration.sh`\n* All: `.\u002Fscripts\u002Ftest-all.sh`\n\n## Contributing\n\nContributions are welcome and much needed.\nPlease refer to the [guidelines](CONTRIBUTING.md).\n\n","# 算法交易员\n\n交易策略构建器、回测工具和实时交易系统。\n\n> pip install algorithmic-trader\n\n## 简介\n\nalgo-trader 是一个算法交易策略执行器和回测工具的实现。\n它能够在本地进行策略回测，并通过您的经纪商 API 实现实时交易。\n\n> 请注意，这目前仍处于 **开发中**，该交易系统缺少外部市场数据和交易提供商支持。\n> 如果您希望使用该交易系统进行真实交易，您需要自行实现与经纪商 API 的对接。\n> 尽管实时交易功能尚未完成，但回测功能已经完全可用，因此您可以先对已实现的策略进行回测，并在实时交易功能完善后将其应用于实际交易中。\n\n\nalgo-trader 使用 Python 编写，当前的技术栈包括：\n\n1. MongoDB 作为回测策略的后端数据存储；\n2. [tulipy](https:\u002F\u002Fgithub.com\u002Fjesse-ai\u002Ftulipy) —— [Tulip Indicators](https:\u002F\u002Ftulipindicators.org\u002F) 的 Python 绑定库，\n   用于计算技术指标；\n3. ib_client（可选）—— 用于与 Interactive Brokers 网关通信的 Python 库。仅当您计划通过 IB 进行实盘交易时才需要此库。\n\n\n## 架构\n\n![系统设计](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fidanya_algo-trader_readme_20f6075aa9cd.png)\n\n### 流水线\n\n[Pipeline](src\u002Falgotrader\u002Fpipeline\u002Fpipeline.py) 是流式处理的基本协调者。它负责从 [Source](src\u002Falgotrader\u002Fpipeline\u002Fsource.py) 读取数据，\n并将其传递给流水线中的各个处理器。除了协调各组件外，它本身并不包含任何业务逻辑。\n流水线及其所有子组件都可以被序列化为 JSON 格式，这样系统就可以在文件中定义、加载和保存整个流水线及其配置。\n这一特性非常重要，因为它可以作为基于 UI\u002FCLI 的运行程序的前端界面。\n示例的可序列化（且可运行）流水线可以在\n[examples\u002Fpipeline-templates](src\u002Falgotrader\u002Fexamples\u002Fpipeline-templates) 目录中找到。\n如何将这些流水线加载到 [Pipeline](src\u002Falgotrader\u002Fpipeline\u002Fpipeline.py) 中，并使用\n[PipelineRunner](src\u002Falgotrader\u002Fpipeline\u002Frunner.py) 来运行它们的示例，可以在 [main.py](src\u002Falgotrader\u002Fmain.py) 中找到。\n\n### PipelineRunner\n\n[PipelineRunner](src\u002Falgotrader\u002Fpipeline\u002Frunner.py) 接受一个初始的 [Pipeline](src\u002Falgotrader\u002Fpipeline\u002Fpipeline.py) 列表或单个流水线，\n以及一个可选的起始 [SharedContext](src\u002Falgotrader\u002Fpipeline\u002Fshared_context.py)。如果在构造时未提供\n[SharedContext](src\u002Falgotrader\u002Fpipeline\u002Fshared_context.py)，则会初始化一个新的上下文。\n每个 [Pipeline](src\u002Falgotrader\u002Fpipeline\u002Fpipeline.py) 都会按照其在列表中的顺序，使用前一个上下文调用 `run()` 方法。\n上下文会在每个 [Pipeline](src\u002Falgotrader\u002Fpipeline\u002Fpipeline.py) 中传递，从而允许在数据收集和输出之前进行一些操作，\n如加载、缓存和验证。\n\n### 源\n\n[Source](src\u002Falgotrader\u002Fpipeline\u002Fsource.py) 是蜡烛数据迭代器的实现。它是流水线的起点，\n也是流入流水线并被处理的蜡烛数据的来源。\n\n### 处理器\n\n[Processor](src\u002Falgotrader\u002Fpipeline\u002Fprocessor.py) 是流水线中的主要处理单元。处理器可以按照任意顺序构建，\n而蜡烛数据则会从源开始，依次流经所有处理器。\n每个处理器负责将其处理后的蜡烛数据发送到下一个处理器（除非有特殊原因不这样做）。\n\n`process()` 函数在处理每根蜡烛时，还会接收一个名为 [`SharedContext`](src\u002Falgotrader\u002Fpipeline\u002Fshared_context.py) 的对象。\n该上下文是一个内存中的键值存储实例，用于在处理器之间共享上下文和信息。\n\n另一种在处理器之间共享数据的方式是利用蜡烛本身的 `attachments` 字段。\n该字段用于存储蜡烛的元数据，例如与该时间点相关的计算结果和状态。\n蜡烛附件在整个流水线中都是持久化的。\n\n#### 重处理\n\n重处理是一种功能，允许处理器将已经处理过的蜡烛重新发送给下一个处理器。\n重处理对于那些在流水线主流程之外执行某些逻辑的处理器非常有用，例如在发生事件、外部触发、市场或交易提供商出现问题等情况时。\n重处理的示例可以在\n[AssetCorrelationProcessor](src\u002Falgotrader\u002Fpipeline\u002Fprocessors\u002Fassets_correlation.py) 中找到。\n\n### 事件\n\n[Event](src\u002Falgotrader\u002Fentities\u002Fevent.py) 如其名称所示，定义了系统中发生的某个事件。\n它遵循与蜡烛相同的流动路径，在处理器之间传递。每个处理器都有责任将事件传播到下一个处理器（如果需要的话）。\n\n由于流水线是数据驱动的，而不是时间驱动的，因此事件可以用作检查点，以指示数据流中发生的事情。\n例如，从数据库源和实时市场数据源运行同一套流水线，可能会因为处理器依赖于时间而产生不同的效果。\n\n_为了使回测具有参考价值，从数据库快速运行和实时运行必须保持一致的行为。_\n\n### 策略\n\n策略由 [StrategyProcessor](src\u002Falgotrader\u002Fpipeline\u002Fprocessors\u002Fstrategy.py) 按照每根蜡烛逐个执行。\n策略负责执行交易逻辑，并发出信号 ([StrategySignal](src\u002Falgotrader\u002Fentities\u002Fstrategy_signal.py))。\n当策略发出交易信号时，StrategyProcessor 会捕获该信号，并将其传递给\n[SignalsExecutor](src\u002Falgotrader\u002Ftrade\u002Fsignals_executor.py) 进行执行。\n\n### 终止器\n\n[Terminator](src\u002Falgotrader\u002Fpipeline\u002Fterminator.py) 是流水线中的可选最后一环。它会在流水线的最后阶段执行，\n即当 Source 迭代器中的数据被完全消费完毕时。\n终止器对于单元测试、回测和环境清理非常有用。\n\n## 本地运行\n\nalgo-trader 使用 MongoDB 作为数据存储。要在本地运行 MongoDB，请使用 `docker-compose`。\n\n```shell\ndocker-compose -f docker-compose.yml up -d\n```\n\n## 命令行界面\n\n命令行界面是一个简单的系统运行接口。它可以用来运行流水线、回测策略或实盘运行策略。\n目前，命令行界面尚未完全实现，大部分功能仅限于描述和列出可用的处理器和策略。\n如果不带任何参数运行命令行界面，将会显示帮助菜单。\n\n通过 PIP 安装该软件包后，即可使用 `algo-trader` 命令。\n如果您选择克隆此仓库，则应使用 `python main.py` 作为入口点。\n\n```shell\nalgo-trader\n```\n\n列出所有可用的处理器：\n\n```shell\nalgo-trader processor list\n```\n\n描述特定的处理器：\n\n```shell\nalgo-trader processor describe \u003Cprocessor_name>\n```\n\n同样的模式也适用于策略和源。\n要运行流水线，您需要创建一个流水线模板文件，并使用命令行界面来运行它。\n\n```shell\nalgo-trader pipeline run \u003Cpipeline_template_file>\n```\n\n### 易于运行的示例：\n\n* 来自 Yahoo Finance 的数据加载器可在 [src\u002Falgotrader\u002Fexamples\u002Fpipeline-templates\u002Fbuild_daily_yahoo_loader.py](src\u002Falgotrader\u002Fexamples\u002Fpipeline-templates\u002Fbuild_daily_yahoo_loader.json) 中找到。  \n运行此示例管道会将历史数据从 Yahoo Finance 加载到 MongoDB：\n\n   ```shell\n   algo-trader pipeline run examples\u002Fpipeline-templates\u002Fbuild_daily_yahoo_loader.json\n   ```\n* 来自 Binance 的数据加载器可在 [src\u002Falgotrader\u002Fexamples\u002Fpipeline-templates\u002Fbuild_daily_binance_loader.json](src\u002Falgotrader\u002Fexamples\u002Fpipeline-templates\u002Fbuild_daily_binance_loader.json) 中找到。  \n运行此示例管道会将历史数据从 Binance 加载到 MongoDB：\n\n   ```shell\n   algo-trader pipeline run examples\u002Fpipeline-templates\u002Fbuild_daily_binance_loader.json\n   ```\n\n* 来自 Binance 的实时加密货币管道可在 [src\u002Falgotrader\u002Fexamples\u002Fpipeline-templates\u002Fbuild_realtime_binance.json](src\u002Falgotrader\u002Fexamples\u002Fpipeline-templates\u002Fbuild_realtime_binance.json) 中找到。  \n运行此示例管道将处理来自 Binance 的实时秒级蜡烛数据：\n\n   ```shell\n   algo-trader pipeline run examples\u002Fpipeline-templates\u002Fbuild_realtime_binance.json\n   ```\n\n### 代码示例\n\n带有注释的简短代码示例。以下是通常如何将 `algo-trader` 作为库来使用，以从 Yahoo Finance 将股票数据加载并计算技术指标，然后存储到 MongoDB 中的方法：\n\n```python\nfrom datetime import datetime, timedelta\n\nfrom algotrader.calc.calculations import TechnicalCalculation\nfrom algotrader.entities.timespan import TimeSpan\nfrom algotrader.pipeline.configs.indicator_config import IndicatorConfig\nfrom algotrader.pipeline.configs.technical_processor_config import TechnicalsProcessorConfig\nfrom algotrader.pipeline.pipeline import Pipeline\nfrom algotrader.pipeline.processors.candle_cache import CandleCache\nfrom algotrader.pipeline.processors.storage_provider_sink import StorageSinkProcessor\nfrom algotrader.pipeline.processors.technicals import TechnicalsProcessor\nfrom algotrader.pipeline.runner import PipelineRunner\nfrom algotrader.pipeline.sources.yahoo_finance_history import YahooFinanceHistorySource\nfrom algotrader.storage.mongodb_storage import MongoDBStorage\n\n\ndef main():\n    # 创建一个 MongoDB 存储连接器\n    mongodb_storage = MongoDBStorage()\n\n    # 创建一个 Yahoo Finance 数据源连接器\n    source = YahooFinanceHistorySource(\n        ['AAPL', 'MSFT', 'GOOG'],  # 传入要获取的股票代码列表\n        TimeSpan.Day,  # 选择蜡烛时间周期\n        datetime.now() - timedelta(days=100),  # 开始获取数据的日期\n        datetime.now()  # 结束获取数据的日期\n    )\n\n    # 创建一个 MongoDB 汇流处理器，它会使用存储连接器将所有处理后的蜡烛数据保存到 MongoDB。\n    sink = StorageSinkProcessor(mongodb_storage)\n\n    # 缓存处理器充当内存中的缓存，使各个处理器之间可以共享数据。\n    cache_processor = CandleCache(sink)\n    # 创建一个技术指标处理器，该处理器会为每根蜡烛添加指标数据。\n    # 然后我们将蜡烛传递给缓存处理器，以便稍后可以使用这些数据，并在需要时与其他处理器共享。\n    technicals_config = TechnicalsProcessorConfig([\n        IndicatorConfig('sma5', TechnicalCalculation.SMA, [5]),\n        IndicatorConfig('sma20', TechnicalCalculation.SMA, [20]),\n        IndicatorConfig('cci7', TechnicalCalculation.CCI, [7]),\n        IndicatorConfig('cci14', TechnicalCalculation.CCI, [14]),\n        IndicatorConfig('rsi7', TechnicalCalculation.CCI, [7]),\n        IndicatorConfig('rsi14', TechnicalCalculation.CCI, [14]),\n        IndicatorConfig('stddev5', TechnicalCalculation.STDDEV, [5]),\n    ])\n\n    processor = TechnicalsProcessor(technicals_config, cache_processor)\n\n    # 构建管道对象。该对象可以序列化为 JSON，保存并在需要时重新加载。\n    pipeline = Pipeline(source, processor)\n\n    # 将管道对象提供给执行器，由执行器来执行它。\n    # 执行器可以依次执行多个管道。\n    # 这使得构建一个管道流程成为可能，其中每个管道都依赖于另一个管道。\n    PipelineRunner(pipeline).run()\n\n```\n  \n## 在本地使用此仓库\n\n### 虚拟环境\n\n最好使用虚拟环境来运行 algo-trader。\n\n```shell\npython3 -m venv run\nsource run\u002Fbin\u002Factivate\npip3 install -r requirements.txt\n```\n\n### 运行测试\n\n* 单元测试：`.\u002Fscripts\u002Ftest-unit.sh`\n* 集成测试（需要运行 IB Gateway）：`.\u002Fscripts\u002Ftest-integration.sh`\n* 全部测试：`.\u002Fscripts\u002Ftest-all.sh`\n\n## 贡献\n\n欢迎并非常需要大家的贡献。\n请参阅[贡献指南](CONTRIBUTING.md)。","# algo-trader 快速上手指南\n\nalgo-trader 是一个用 Python 编写的算法交易策略构建器、回测引擎和实时交易执行器。它支持本地策略回测，并可通过 Broker API 进行实时交易（需自行实现接口）。\n\n## 环境准备\n\n### 系统要求\n- **操作系统**: Linux, macOS 或 Windows (推荐 Linux\u002FmacOS)\n- **Python**: Python 3.8+\n- **数据库**: MongoDB (用于存储回测数据和 K 线)\n- **容器工具**: Docker & Docker Compose (用于快速启动 MongoDB)\n\n### 前置依赖\n- **技术指标库**: 项目依赖 `tulipy` (Tulip Indicators 的 Python 绑定)，安装时会自动处理。\n- **可选依赖**: 若需连接 Interactive Brokers 进行实盘交易，需配置 `ib_client` 并运行 IB Gateway。\n\n## 安装步骤\n\n### 1. 启动 MongoDB 数据库\nalgo-trader 使用 MongoDB 作为后端数据存储。推荐使用 Docker Compose 快速启动：\n\n```shell\ndocker-compose -f docker-compose.yml up -d\n```\n\n### 2. 安装 Python 包\n你可以选择通过 pip 直接安装，或克隆源码开发。\n\n**方式 A：通过 pip 安装（推荐）**\n```shell\npip install algorithmic-trader\n```\n*注：国内用户若下载缓慢，可尝试指定清华源：*\n```shell\npip install algorithmic-trader -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n```\n\n**方式 B：源码安装（开发模式）**\n```shell\ngit clone \u003Crepo_url>\ncd algo-trader\npython3 -m venv run\nsource run\u002Fbin\u002Factivate  # Windows 用户使用: run\\Scripts\\activate\npip3 install -r requirements.txt\n```\n\n## 基本使用\n\n### 1. 命令行工具 (CLI)\n安装完成后，`algo-trader` 命令即可用（源码模式下使用 `python main.py`）。\n\n查看帮助菜单：\n```shell\nalgo-trader\n```\n\n查看可用的处理器列表：\n```shell\nalgo-trader processor list\n```\n\n查看特定处理器详情：\n```shell\nalgo-trader processor describe \u003Cprocessor_name>\n```\n\n### 2. 运行示例管道 (Pipeline)\nalgo-trader 的核心是“管道”概念。你可以直接运行内置的示例模板来加载历史数据或进行实时数据处理。\n\n**示例 A：从 Yahoo Finance 加载历史数据到 MongoDB**\n```shell\nalgo-trader pipeline run examples\u002Fpipeline-templates\u002Fbuild_daily_yahoo_loader.json\n```\n\n**示例 B：从 Binance 加载历史数据到 MongoDB**\n```shell\nalgo-trader pipeline run examples\u002Fpipeline-templates\u002Fbuild_daily_binance_loader.json\n```\n\n**示例 C：运行 Binance 实时加密货币数据管道**\n```shell\nalgo-trader pipeline run examples\u002Fpipeline-templates\u002Fbuild_realtime_binance.json\n```\n\n### 3. 代码集成示例\n你也可以将 algo-trader 作为库在 Python 脚本中使用，以下示例展示了如何从 Yahoo Finance 获取数据、计算技术指标并存入 MongoDB：\n\n```python\nfrom datetime import datetime, timedelta\n\nfrom algotrader.calc.calculations import TechnicalCalculation\nfrom algotrader.entities.timespan import TimeSpan\nfrom algotrader.pipeline.configs.indicator_config import IndicatorConfig\nfrom algotrader.pipeline.configs.technical_processor_config import TechnicalsProcessorConfig\nfrom algotrader.pipeline.pipeline import Pipeline\nfrom algotrader.pipeline.processors.candle_cache import CandleCache\nfrom algotrader.pipeline.processors.storage_provider_sink import StorageSinkProcessor\nfrom algotrader.pipeline.processors.technicals import TechnicalsProcessor\nfrom algotrader.pipeline.runner import PipelineRunner\nfrom algotrader.pipeline.sources.yahoo_finance_history import YahooFinanceHistorySource\nfrom algotrader.storage.mongodb_storage import MongoDBStorage\n\n\ndef main():\n    # 创建 MongoDB 存储连接器\n    mongodb_storage = MongoDBStorage()\n\n    # 创建 Yahoo Finance 数据源\n    source = YahooFinanceHistorySource(\n        ['AAPL', 'MSFT', 'GOOG'],  # 股票代码列表\n        TimeSpan.Day,              # K 线周期\n        datetime.now() - timedelta(days=100),  # 开始日期\n        datetime.now()             # 结束日期\n    )\n\n    # 创建存储处理器，将处理后的 K 线存入 Mongo\n    sink = StorageSinkProcessor(mongodb_storage)\n\n    # 缓存处理器：用于在处理器间共享内存数据\n    cache_processor = CandleCache(sink)\n    \n    # 配置技术指标处理器\n    technicals_config = TechnicalsProcessorConfig([\n        IndicatorConfig('sma5', TechnicalCalculation.SMA, [5]),\n        IndicatorConfig('sma20', TechnicalCalculation.SMA, [20]),\n        IndicatorConfig('cci7', TechnicalCalculation.CCI, [7]),\n        IndicatorConfig('cci14', TechnicalCalculation.CCI, [14]),\n        IndicatorConfig('rsi7', TechnicalCalculation.RSI, [7]), # 原文此处为 CCI，逻辑上 RSI 应调用 RSI 计算\n        IndicatorConfig('rsi14', TechnicalCalculation.RSI, [14]),\n        IndicatorConfig('stddev5', TechnicalCalculation.STDDEV, [5]),\n    ])\n\n    # 初始化技术指标处理器\n    processor = TechnicalsProcessor(technicals_config, cache_processor)\n\n    # 构建管道对象 (可序列化为 JSON)\n    pipeline = Pipeline(source, processor)\n\n    # 运行管道\n    PipelineRunner(pipeline).run()\n\nif __name__ == \"__main__\":\n    main()\n```\n\n> **注意**：目前该工具仍处于开发阶段（Work in Progress）。回测功能已完全可用，但实时交易功能需要用户自行实现 Broker API 接口方可用于实盘。","一位量化交易开发者希望验证基于均线交叉的自定义策略在历史数据中的表现，并准备将其部署到实盘环境中。\n\n### 没有 algo-trader 时\n- **回测框架从零搭建**：开发者需要手动编写代码来加载历史 K 线数据、管理时间序列状态以及计算技术指标，耗费大量时间在基础设施而非策略逻辑上。\n- **策略迭代效率低下**：每次修改策略参数或逻辑后，必须重新运行整个脚本，缺乏统一的流水线机制来序列化配置和复用上下文，导致实验记录混乱。\n- **实盘对接门槛高**：将本地回测代码迁移至实盘时，需重写数据摄入和订单执行模块，难以保证回测环境与实盘逻辑的一致性，存在巨大的“过拟合”风险。\n- **技术指标集成困难**：需要自行寻找并绑定底层 C 库来计算复杂的金融指标，容易因环境配置问题导致开发中断。\n\n### 使用 algo-trader 后\n- **开箱即用的回测引擎**：直接利用内置的 MongoDB 后端和 Tulip Indicators 绑定，几行代码即可构建包含数据源、处理器和策略执行的完整流水线，专注核心算法。\n- **灵活的管道式架构**：通过 JSON 序列化保存完整的 Pipeline 配置，轻松在不同参数组合间切换并复用共享上下文（SharedContext），大幅提升策略研发与复现效率。\n- **回测到实盘的无缝衔接**：依托统一的 Processor 接口，同一套策略逻辑既可在本地进行高精度回测，也能在接入 IB 等券商 API 后直接用于实时交易，确保逻辑一致性。\n- **丰富的扩展能力**：支持自定义处理器顺序和数据附件（Attachments），方便在 K 线流转过程中动态添加元数据或中间计算结果，满足复杂策略需求。\n\nalgo-trader 通过标准化的流水线架构，消除了从策略构思、历史回测到实盘部署之间的技术断层，让量化开发者能专注于策略本身的盈利逻辑。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fidanya_algo-trader_a9ea22aa.png","idanya","Idan Yael","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fidanya_6afca9ce.jpg",null,"Fireblocks","Tel Aviv, Israel","https:\u002F\u002Fgithub.com\u002Fidanya",[80,84],{"name":81,"color":82,"percentage":83},"Python","#3572A5",99.9,{"name":85,"color":86,"percentage":87},"Makefile","#427819",0.1,866,109,"2026-04-07T11:10:56","MIT",4,"未说明 (基于 Python 和 Docker，通常支持 Linux, macOS, Windows)","不需要","未说明",{"notes":97,"python":98,"dependencies":99},"1. 必须本地运行 MongoDB 作为后端数据存储（推荐使用 docker-compose 启动）。2. 实时交易功能尚未完工，需用户自行实现券商 API（如 Interactive Brokers），目前回测功能完全可用。3. 技术指标计算依赖 tulipy 库。4. 集成测试需要运行 IB gateway。","3.x (通过 python3 -m venv 推断)",[100,101,102,103],"pymongo (MongoDB 驱动)","tulipy","ib_client (可选，用于 Interactive Brokers)","docker-compose",[14,105],"其他",[107,108,109,110,111,112,113],"algorithmic-trading","backtesting","crypto-bot","python","technical-analysis","trading-bot","trading-strategies","2026-03-27T02:49:30.150509","2026-04-10T07:47:03.981023",[],[118,123,128,132,136,140],{"id":119,"version":120,"summary_zh":121,"released_at":122},180414,"v0.0.6","## 变更内容\n* 通过 Binance 进行交易，由 @idanya 在 https:\u002F\u002Fgithub.com\u002Fidanya\u002Falgo-trader\u002Fpull\u002F28 中实现\n* 增加技术指标和优化，由 @idanya 在 https:\u002F\u002Fgithub.com\u002Fidanya\u002Falgo-trader\u002Fpull\u002F29 中实现\n\n\n**完整变更日志**: https:\u002F\u002Fgithub.com\u002Fidanya\u002Falgo-trader\u002Fcompare\u002Fv0.0.5...v0.0.6","2023-03-02T18:30:27",{"id":124,"version":125,"summary_zh":126,"released_at":127},180415,"v0.0.5","## 变更内容\n* 由 @idanya 在 https:\u002F\u002Fgithub.com\u002Fidanya\u002Falgo-trader\u002Fpull\u002F26 中修复了包 CLI 脚本的导入路径\n* 由 @idanya 在 https:\u002F\u002Fgithub.com\u002Fidanya\u002Falgo-trader\u002Fpull\u002F27 中实现了可接收外部配置的技术处理器\n\n\n**完整变更日志**: https:\u002F\u002Fgithub.com\u002Fidanya\u002Falgo-trader\u002Fcompare\u002Fv0.0.4...v0.0.5","2023-01-08T08:53:00",{"id":129,"version":130,"summary_zh":75,"released_at":131},180416,"v0.0.4","2022-12-28T20:45:13",{"id":133,"version":134,"summary_zh":75,"released_at":135},180417,"v0.0.3","2022-12-28T09:52:33",{"id":137,"version":138,"summary_zh":75,"released_at":139},180418,"v0.0.2","2022-12-28T09:31:12",{"id":141,"version":142,"summary_zh":75,"released_at":143},180419,"v0.0.1","2022-12-28T09:23:59"]