[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-ivopetiz--algotrading":3,"tool-ivopetiz--algotrading":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 真正成长为懂上",152630,2,"2026-04-12T23:33:54",[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 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",108322,"2026-04-10T11:39:34",[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},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",[52,13,15,14],"插件",{"id":54,"name":55,"github_repo":56,"description_zh":57,"stars":58,"difficulty_score":32,"last_commit_at":59,"category_tags":60,"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":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":77,"owner_twitter":77,"owner_website":78,"owner_url":79,"languages":80,"stars":85,"forks":86,"last_commit_at":87,"license":88,"difficulty_score":89,"env_os":90,"env_gpu":91,"env_ram":91,"env_deps":92,"category_tags":102,"github_topics":104,"view_count":32,"oss_zip_url":77,"oss_zip_packed_at":77,"status":17,"created_at":124,"updated_at":125,"faqs":126,"releases":161},7049,"ivopetiz\u002Falgotrading","algotrading","Algorithmic trading framework for cryptocurrencies.","algotrading 是一个专为加密货币市场打造的 Python 算法交易框架，旨在帮助开发者轻松构建、测试和运行自动化交易机器人。它解决了从零搭建交易系统时面临的数据对接复杂、策略回测困难以及实时执行不稳定等痛点，让用户能专注于策略逻辑本身而非底层架构。\n\n该工具非常适合具备一定编程基础的量化交易者、加密货币研究者以及希望尝试自动化交易的开发者使用。无论是想验证历史策略的有效性，还是部署实时盯盘助手，algotrading 都能提供强力支持。其核心亮点在于灵活的三种运行模式：支持连接交易所 API 进行“实时交易”（含实盘与模拟），利用本地数据逐笔回放以精细调试策略的\"Tick-by-Tick\"模式，以及基于历史数据进行高效验证的“回测”模式。\n\n此外，algotrading 内置了丰富的数据处理能力，可直接对接 InfluxDB 数据库或 CSV 文件，并集成了移动平均线交叉等经典进出场函数示例，配合可视化图表功能，让交易信号与结果一目了然。如果你希望用代码掌控加密资产的投资节奏，这是一个值得探索的开源起点。","# Crypto AlgoTrading Framework\n\n[![Codacy Badge](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fivopetiz_algotrading_readme_549cb1d41474.png)](https:\u002F\u002Fwww.codacy.com\u002Fgh\u002Fivopetiz\u002Falgotrading\u002Fdashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=ivopetiz\u002Falgotrading&amp;utm_campaign=Badge_Grade)\n[![Codacy Security Scan](https:\u002F\u002Fgithub.com\u002Fivopetiz\u002Falgotrading\u002Factions\u002Fworkflows\u002Fcodacy.yml\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Fivopetiz\u002Falgotrading\u002Factions\u002Fworkflows\u002Fcodacy.yml)\n[![Build Status](https:\u002F\u002Ftravis-ci.com\u002Fivopetiz\u002Falgotrading.svg?branch=master)](https:\u002F\u002Ftravis-ci.com\u002Fivopetiz\u002Falgotrading)\n[![Coverage Status](https:\u002F\u002Fcoveralls.io\u002Frepos\u002Fgithub\u002Fivopetiz\u002Falgotrading\u002Fbadge.svg?branch=master)](https:\u002F\u002Fcoveralls.io\u002Fgithub\u002Fivopetiz\u002Falgotrading?branch=master)\n\n## Algorithmic trading framework for cryptocurrencies in Python\n\nAlgotrading Framework is a repository with tools to build and run working trading bots, backtest strategies, assist on trading, define simple stop losses and trailing stop losses, etc. This framework work with data directly from Crypto exchanges API, from a DB or CSV files. Can be used for data-driven and event-driven systems. Made exclusively for crypto markets for now and written in Python.\n\n---\n\n## Follow this [Quickstart Guide](quickstart_guide.md) if you want to start right away\n\n---\n\n[A Medium story dedicated to this project](https:\u002F\u002Fivopetiz.medium.com\u002Fmy-algorithmic-trading-project-f5d2eb2dbb5a)\n\n---\n\n## Index\n\n* [Operating modes](#operating-modes)\n  * [Realtime](#realtime)\n  * [Tick-by-tick](#tick-by-tick)\n  * [Backtest](#backtest)\n\n* [How to start](#how-to-start)\n  * [Pre Requesites](#pre-requesites)\n\n  * [Collecting data](#collecting-data)\n    * [Database](#batabase)\n    * [Script](#script)\n\n* [Entry functions](#entry-functions)\n  * [cross SMA](#cross-sma)\n\n* [Exit functions](#exit-functions)\n  * [cross SMA](#cross-sma)\n\n* [Plot data](#plot-data)\n\n* [Logs](#logs)\n\n* [Examples](#examples)\n  * [Realtime alert for volume increasing](#realtime-alert-for-volume-increasing)\n  * [Backtest a strategy on BTC-DGB pair using SMA](#backtest-a-strategy-on-BTC-DGB-pair-using-sma)\n\n* [Pypy](#pypy)\n\n* [TODO](#todo)\n\n* [Additional info](#additional-info)\n\n---\n\n## Operating modes\n\nFramework has three operating modes:\n\n* Realtime -- Trades with real data in real time, with real money or in simulation mode.\n* Tick-by-tick -- Testing strategies in real time frames, so user can follow its entries and exits strategies.\n* Backtest -- Backtesting strategies and presenting the results.\n\n### Realtime\n\nIn realtime, Trading Bot operates in real-time, with live data from exchanges APIs. It doesn't need pre-stored data or DB to work. In this mode, a bot can trade real money, simulate or alert the user when its time to buy or sell, based on entry and exit strategies defined by the user. Can also simulate users strategies and present the results in real-time.\n\n### Tick-by-tick\n\nTick-by-tick mode allows users to check strategies in a visible timeframe, to better check entries and exit points or to detect strategies faults or new entry and exit points. Use data from CSV files or DB.\n\n### Backtest\n\nAllows users to backtest strategies, with previously stored data. Can also plot trading data showing entry and exit points for implemented strategies.\n\n## How to start\n\n### Pre requisites\n\nTo get algotrading fully working is necessary to install some packages and Python libs, as IPython, Pandas, Matplotlib, Numpy, Python-Influxdb and Python-tk. \nOn Linux machines these packages could be installed with:\n\n```bash\npip install -r requirements.txt\n```\n\n### Collecting data\n\nThe first step is to collect data. To get markets data is necessary to run a DB, to get and manage all data or save the data to CSV files. \nThere are two options:\n\n* Install and configure a database.\n* Run a script to collect data and save it to CSV files.\n\n#### Database\n\nTrading Bot is ready to operate with InfluxDB, but can work with other databases, with some small changes.\n\nTo install, configure and use a InfluxDB database, you can clone this repository:\nhttps:\u002F\u002Fgithub.com\u002Fivopetiz\u002Fcrypto-database\n\n#### Script\n\nIf you don't want to install and manage any databases and simply want to get data to CSV files you can use the script in this Gist:\nhttps:\u002F\u002Fgist.github.com\u002Fivopetiz\u002F051eb8dcef769e655254df21a093831a\n\n*Using a database is the best option, once you can analyse and plot data using DB tools, as Chronograf, and can always extract data to CSV if needed.*\n\n## Entry functions\n\nEntry functions aggregate all strategies to enter in a specific market. Once data fill all the requisites to enter a specific market, an action is taken. \nUsers can use one or several functions in the same call, to fill the requisites and enter market\u002Fmarkets. \nFunctions should return *True*, if the available data represent an entry point for the user. If not, the return needs to be *False*.\n\u003Centry.py> should aggregate all users entry functions.\n\n### Example\n\n#### cross SMA\n\nFunction \u003Ccross_smas> will return *True* if first SMA cross the second one. If not will return *False*.\n\n```python\ndef cross_smas(data, smas=[5, 10]):\n    '''\n    Checks if it's an entry point based on crossed smas.\n    '''\n    if data.Last.rolling(smas[0]).mean().iloc[-1] > \\\n       data.Last.rolling(smas[1]).mean().iloc[-1] and \\\n       data.Last.rolling(smas[0]).mean().iloc[-2] \u003C \\\n       data.Last.rolling(smas[1]).mean().iloc[-2]:\n        return True\n\n    return False\n```\n\n## Exit functions\n\nExit functions have all functions responsible for exit strategies. When a user is in the market, and data met exit criteria, the bot will exit the market. \nExit functions can be used with other exit functions, to cover more situations, as used in entry functions. \nStop loss and trailing stop loss are also implemented, to exit markets in case of an unexpected price drop. Functions should return *True*, if the available data represent an exit point for the user. If not, the return needs to be *False*.\n\u003Cexit.py> should aggregate all users' exit functions.\n\nExample\n---\n\n### cross SMA\n\nFunction \u003Ccross_smas> will return *True* if first SMA cross the second one. If not will return *False*.\n\n```python\ndef cross_smas(data, smas=[10, 20]):\n    '''\n    Checks if it's an exit point based on crossed smas.\n    '''\n    if data.Last.rolling(smas[0]).mean().iloc[-1] \u003C \\\n       data.Last.rolling(smas[1]).mean().iloc[-1] and \\\n       data.Last.rolling(smas[0]).mean().iloc[-2] > \\\n       data.Last.rolling(smas[1]).mean().iloc[-2]:\n        return True\n\n    return False\n```\n\n## Plot data\n\nIt's possible to plot entry and exit points, among market data, using Matplotlib lib for Python with the option *plot=True* on function call.\n\n## Log\n\nCan log entry and exit points in order to evaluate strategies, presenting P&L for specific markets and total.\n\n## Examples\n\nHere are some examples of how to use this framework.\n\n### Realtime alert for volume increasing\n\nTo get an alert when a market doubles its volume:\n\n```python\nfrom cryptoalgotrading.cryptoalgotrading import realtime\n\ndef alert_volume_x2(data):\n    if pd.vol.iloc[-1] > pd.vol.iloc[-2]*2:\n        return True\n    return False\n\nrealtime([], alert_volume_x2, interval='10m')\n```\n\n*alert_volume_x2* checks the value of actual market volume and compare it with the last time frame volume value, alerting user when actual market volume is bigger than last time frame volume value multiplied by 2. Can add functions live on IPython for example of add them to entry and exit python files.\n\n### Backtest a strategy on BTC-DGB pair using SMA\n\nTo backtest a cross simple moving average strategy in a specific market and plot the entry points:\n\n```python\nfrom cryptoalgotrading.cryptoalgotrading import backtest\nimport cryptoalgotrading.entry as entry\n\nbacktest([\"BTC-XRP\"], entry.cross_smas, smas=[15,40], interval='10m', from_file=True, plot=True)\n```\n\nBased on market data available for BTC_XRP pair, code above can present an output like this:\n\n![testing strategy on BTC-XRP pair data.](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fivopetiz_algotrading_readme_1d03f7088a72.png)\n\nThe figure has three charts. The chart on top presents on top BTC-XRP data from a certain period, with its Bollinger bands and 3 SMA lines. Green points represent the entry points for the defined strategy. In the middle is a chart representing volume data and at the bottom is represented the number of selling orders among time. All these fields and charts are configurable on *plot* function.\n\nCan also add exit points by adding an exit function or functions to backtest function. \nIt is possible to enter multiple entries and exit functions to backtest, to define different entry and exit positions.\n\nBoth functions are available on entry.py and exit.py as example.\n\nIn finance.py are some functions which could be useful to implement some strategies.\n\n## Pypy\n\nThis Crypto AlgoTrading Framework can be used with Pypy, but the results will not be great, during the use of Pandas and Numpy libs.\n\n## TODO\n\n* [x] Python 3 implementation\n* [ ] Cython version\n* [ ] Pure Python for Pypy (without Pandas and Numpy dependency)\n\n## Additional Info\n\nAPI Key is just needed in case of buy\u002Fsell operations. For backtest, tick-by-tick and realtime alert implementations API Key can be left empty.\n\nBuy and sell options are commented and should only be used if you know what you are doing.\n\nIf you are interested in using this bot and don't have an account on Binance Exchange yet, please help me, creating  an account through my referral code here: https:\u002F\u002Faccounts.binance.com\u002Fen\u002Fregister?ref=17181609 \n\n---\n\n\u003Cp align=\"center\">USE THIS AT YOUR OWN RISK.\u003C\u002Fp>\n","# 加密货币算法交易框架\n\n[![Codacy Badge](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fivopetiz_algotrading_readme_549cb1d41474.png)](https:\u002F\u002Fwww.codacy.com\u002Fgh\u002Fivopetiz\u002Falgotrading\u002Fdashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=ivopetiz\u002Falgotrading&amp;utm_campaign=Badge_Grade)\n[![Codacy Security Scan](https:\u002F\u002Fgithub.com\u002Fivopetiz\u002Falgotrading\u002Factions\u002Fworkflows\u002Fcodacy.yml\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Fivopetiz\u002Falgotrading\u002Factions\u002Fworkflows\u002Fcodacy.yml)\n[![Build Status](https:\u002F\u002Ftravis-ci.com\u002Fivopetiz\u002Falgotrading.svg?branch=master)](https:\u002F\u002Ftravis-ci.com\u002Fivopetiz\u002Falgotrading)\n[![Coverage Status](https:\u002F\u002Fcoveralls.io\u002Frepos\u002Fgithub\u002Fivopetiz\u002Falgotrading\u002Fbadge.svg?branch=master)](https:\u002F\u002Fcoveralls.io\u002Fgithub\u002Fivopetiz\u002Falgotrading?branch=master)\n\n## 用于加密货币的 Python 算法交易框架\n\nAlgotrading Framework 是一个包含工具的仓库，可用于构建和运行有效的交易机器人、回测策略、辅助交易、定义简单的止损和追踪止损等。该框架可以直接从加密货币交易所的 API、数据库或 CSV 文件中获取数据。它可以用于数据驱动和事件驱动系统。目前专为加密货币市场设计，并使用 Python 编写。\n\n---\n\n## 如果您想立即开始，请按照此 [快速入门指南](quickstart_guide.md)\n\n---\n\n[一篇专门介绍该项目的 Medium 文章](https:\u002F\u002Fivopetiz.medium.com\u002Fmy-algorithmic-trading-project-f5d2eb2dbb5a)\n\n---\n\n## 目录\n\n* [运行模式](#operating-modes)\n  * [实时模式](#realtime)\n  * [逐笔模式](#tick-by-tick)\n  * [回测模式](#backtest)\n\n* [如何开始](#how-to-start)\n  * [先决条件](#pre-requesites)\n\n  * [收集数据](#collecting-data)\n    * [数据库](#batabase)\n    * [脚本](#script)\n\n* [入场函数](#entry-functions)\n  * [SMA 交叉](#cross-sma)\n\n* [出场函数](#exit-functions)\n  * [SMA 交叉](#cross-sma)\n\n* [绘制数据](#plot-data)\n\n* [日志](#logs)\n\n* [示例](#examples)\n  * [实时成交量增加警报](#realtime-alert-for-volume-increasing)\n  * [使用 SMA 对 BTC-DGB 币对进行策略回测](#backtest-a-strategy-on-BTC-DGB-pair-using-sma)\n\n* [Pypy](#pypy)\n\n* [待办事项](#todo)\n\n* [附加信息](#additional-info)\n\n---\n\n## 运行模式\n\n该框架有三种运行模式：\n\n* 实时模式 -- 使用实时数据进行交易，可以是真实资金交易或模拟模式。\n* 逐笔模式 -- 在实际时间框架内测试策略，以便用户可以跟踪其入场和出场点。\n* 回测模式 -- 回测策略并展示结果。\n\n### 实时模式\n\n在实时模式下，交易机器人使用来自交易所 API 的实时数据进行操作。它不需要预先存储的数据或数据库即可工作。在此模式下，机器人可以进行真实资金交易、模拟交易，或者根据用户定义的入场和出场策略，在需要买入或卖出时向用户发出警报。此外，它还可以模拟用户的策略，并实时展示结果。\n\n### 逐笔模式\n\n逐笔模式允许用户在一个可见的时间范围内检查策略，以更好地查看入场和出场点，或检测策略中的错误以及新的入场和出场点。该模式使用来自 CSV 文件或数据库的数据。\n\n### 回测模式\n\n允许用户使用先前存储的数据回测策略。还可以绘制交易数据，显示已实施策略的入场和出场点。\n\n## 如何开始\n\n### 先决条件\n\n要使算法交易完全运行，需要安装一些软件包和 Python 库，如 IPython、Pandas、Matplotlib、Numpy、Python-Influxdb 和 Python-tk。在 Linux 系统上，可以通过以下命令安装这些软件包：\n\n```bash\npip install -r requirements.txt\n```\n\n### 收集数据\n\n第一步是收集数据。为了获取市场数据，需要运行一个数据库来存储和管理所有数据，或者将数据保存到 CSV 文件中。有两种选择：\n\n* 安装并配置一个数据库。\n* 运行一个脚本将数据收集并保存到 CSV 文件中。\n\n#### 数据库\n\n交易机器人已经准备好与 InfluxDB 配合使用，但稍作修改后也可以与其他数据库配合使用。\n\n要安装、配置并使用 InfluxDB 数据库，您可以克隆此仓库：\nhttps:\u002F\u002Fgithub.com\u002Fivopetiz\u002Fcrypto-database\n\n#### 脚本\n\n如果您不想安装和管理任何数据库，而只是想将数据保存到 CSV 文件中，可以使用此 Gist 中的脚本：\nhttps:\u002F\u002Fgist.github.com\u002Fivopetiz\u002F051eb8dcef769e655254df21a093831a\n\n*使用数据库是最佳选择，因为您可以使用数据库工具（如 Chronograf）分析和绘制数据，并且在需要时始终可以将数据导出为 CSV 文件。*\n\n## 入场函数\n\n入场函数汇总了进入特定市场的所有策略。一旦数据满足进入特定市场的所有条件，就会采取相应行动。用户可以在同一调用中使用一个或多个函数，以满足条件并进入市场。函数应在可用数据代表用户入场点时返回 *True*，否则应返回 *False*。\n\u003Centry.py> 应汇总所有用户的入场函数。\n\n### 示例\n\n#### SMA 交叉\n\n函数 \u003Ccross_smas> 将在第一个 SMA 跨过第二个 SMA 时返回 *True*，否则返回 *False*。\n\n```python\ndef cross_smas(data, smas=[5, 10]):\n    '''\n    根据 SMA 交叉情况检查是否为入场点。\n    '''\n    if data.Last.rolling(smas[0]).mean().iloc[-1] > \\\n       data.Last.rolling(smas[1]).mean().iloc[-1] and \\\n       data.Last.rolling(smas[0]).mean().iloc[-2] \u003C \\\n       data.Last.rolling(smas[1]).mean().iloc[-2]:\n        return True\n\n    return False\n```\n\n## 出场函数\n\n出场函数包含了所有负责出场策略的函数。当用户处于市场中，且数据满足出场条件时，机器人将退出市场。出场函数可以与其他出场函数结合使用，以覆盖更多情况，正如入场函数中所做的那样。还实现了止损和追踪止损功能，以便在价格意外下跌时退出市场。函数应在可用数据代表用户出场点时返回 *True*，否则应返回 *False*。\n\u003Cexit.py> 应汇总所有用户的出场函数。\n\n示例\n---\n\n### SMA 交叉\n\n函数 \u003Ccross_smas> 将在第一个 SMA 跨过第二个 SMA 时返回 *True*，否则返回 *False*。\n\n```python\ndef cross_smas(data, smas=[10, 20]):\n    '''\n    根据 SMA 交叉情况检查是否为出场点。\n    '''\n    if data.Last.rolling(smas[0]).mean().iloc[-1] \u003C \\\n       data.Last.rolling(smas[1]).mean().iloc[-1] and \\\n       data.Last.rolling(smas[0]).mean().iloc[-2] > \\\n       data.Last.rolling(smas[1]).mean().iloc[-2]:\n        return True\n\n    return False\n```\n\n## 绘制数据\n\n可以使用 Python 的 Matplotlib 库，在函数调用中设置 *plot=True* 选项，将入场和出场点绘制在市场数据之上。\n\n## 日志\n\n可以记录入场和出场点，以便评估策略，展示特定市场的盈亏情况以及总盈亏。\n\n## 示例\n\n以下是一些使用此框架的示例。\n\n### 实时成交量倍增预警\n\n当某个市场的成交量翻倍时触发预警：\n\n```python\nfrom cryptoalgotrading.cryptoalgotrading import realtime\n\ndef alert_volume_x2(data):\n    if pd.vol.iloc[-1] > pd.vol.iloc[-2]*2:\n        return True\n    return False\n\nrealtime([], alert_volume_x2, interval='10m')\n```\n\n*alert_volume_x2* 会检查当前市场成交量，并将其与前一个时间周期的成交量进行比较。当当前成交量超过前一周期成交量的两倍时，便会向用户发出警报。你还可以在 IPython 中实时添加这些函数，例如将它们集成到入场和出场的 Python 文件中。\n\n### 使用 SMA 策略对 BTC-DGB 币对进行回测\n\n要在特定市场中回测交叉简单移动平均线策略，并绘制入场点：\n\n```python\nfrom cryptoalgotrading.cryptoalgotrading import backtest\nimport cryptoalgotrading.entry as entry\n\nbacktest([\"BTC-XRP\"], entry.cross_smas, smas=[15,40], interval='10m', from_file=True, plot=True)\n```\n\n基于 BTC_XRP 市场可用的数据，上述代码可以生成如下输出：\n\n![在 BTC-XRP 币对数据上测试策略。](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fivopetiz_algotrading_readme_1d03f7088a72.png)\n\n该图包含三个图表：顶部的图表展示了某一时间段内 BTC-XRP 的价格数据，以及布林带和三条 SMA 线；绿色点表示根据所定义策略的入场点。中间的图表显示了成交量数据，底部则展示了随时间变化的卖单数量。所有这些字段和图表都可以通过 *plot* 函数进行配置。\n\n此外，还可以通过向 `backtest` 函数中添加出场函数来标记出场点。你可以为回测过程传入多个入场和出场函数，以定义不同的入场和出场条件。\n\n这两个函数均已在 `entry.py` 和 `exit.py` 中作为示例提供。\n\n在 `finance.py` 中还包含一些可能对实施某些策略有用的函数。\n\n## PyPy\n\n本 Crypto AlgoTrading 框架可以与 PyPy 配合使用，但在使用 Pandas 和 Numpy 库时，性能表现并不理想。\n\n## 待办事项\n\n* [x] Python 3 实现\n* [ ] Cython 版本\n* [ ] 针对 PyPy 的纯 Python 实现（无需依赖 Pandas 和 Numpy）\n\n## 补充信息\n\nAPI 密钥仅在执行买入\u002F卖出操作时需要。对于回测、逐笔数据处理以及实时预警功能，API 密钥可以留空。\n\n买入和卖出选项已被注释掉，建议仅在完全了解其风险的情况下使用。\n\n如果你有兴趣使用此机器人但尚未在币安交易所注册账户，请通过我的推荐链接创建账户：https:\u002F\u002Faccounts.binance.com\u002Fen\u002Fregister?ref=17181609\n\n---\n\n\u003Cp align=\"center\">请自行承担使用风险。\u003C\u002Fp>","# Algotrading 快速上手指南\n\nAlgotrading 是一个专为加密货币市场设计的 Python 算法交易框架，支持实时交易、逐笔回测和策略历史回测。它可以直接对接交易所 API，或使用数据库\u002FCSV 文件数据进行驱动。\n\n## 环境准备\n\n### 系统要求\n- **操作系统**：推荐 Linux（Windows 和 macOS 也可运行）\n- **Python 版本**：Python 3.x\n- **注意**：虽然支持 PyPy，但由于 Pandas 和 Numpy 的限制，建议使用标准 CPython 以获得最佳性能。\n\n### 前置依赖\n框架依赖以下核心 Python 库：\n- `IPython`\n- `Pandas`\n- `Matplotlib`\n- `Numpy`\n- `Python-Influxdb` (如需使用 InfluxDB)\n- `Python-tk` (用于绘图界面)\n\n> **国内加速建议**：在安装依赖时，推荐使用清华或阿里镜像源以提升下载速度。\n\n## 安装步骤\n\n1. **克隆项目代码**\n   ```bash\n   git clone https:\u002F\u002Fgithub.com\u002Fivopetiz\u002Falgotrading.git\n   cd algotrading\n   ```\n\n2. **安装依赖包**\n   \n   **方式 A：使用官方源**\n   ```bash\n   pip install -r requirements.txt\n   ```\n\n   **方式 B：使用国内镜像源（推荐）**\n   ```bash\n   pip install -r requirements.txt -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n   ```\n\n3. **数据准备（二选一）**\n   \n   框架运行需要市场数据，你可以选择以下任一方式：\n   \n   *   **方案一：使用 InfluxDB 数据库（推荐）**\n       适合长期运行和复杂分析。需单独部署数据库，参考项目：\n       ```bash\n       git clone https:\u002F\u002Fgithub.com\u002Fivopetiz\u002Fcrypto-database\n       ```\n       \n   *   **方案二：使用 CSV 文件**\n       适合快速测试。运行脚本收集数据并保存为 CSV（脚本参考 Gist）：\n       https:\u002F\u002Fgist.github.com\u002Fivopetiz\u002F051eb8dcef769e655254df21a093831a\n\n## 基本使用\n\n框架主要提供三种模式：**Realtime** (实时)、**Tick-by-tick** (逐笔) 和 **Backtest** (回测)。\n\n### 1. 实时音量监控示例\n当某个交易对的成交量翻倍时发出警报。此模式不需要预存数据，直接连接交易所 API。\n\n```python\nfrom cryptoalgotrading.cryptoalgotrading import realtime\nimport pandas as pd\n\ndef alert_volume_x2(data):\n    # 检查当前成交量是否大于前一个时间周期成交量的 2 倍\n    if data.vol.iloc[-1] > data.vol.iloc[-2]*2:\n        return True\n    return False\n\n# 启动实时监控，时间间隔设为 10 分钟\nrealtime([], alert_volume_x2, interval='10m')\n```\n\n### 2. 策略回测示例\n对 BTC-XRP 交易对进行双均线交叉策略（SMA）回测，并绘制进出场点位。\n\n*前提：确保已定义好 `entry.cross_smas` 函数（位于 `entry.py` 中）。*\n\n```python\nfrom cryptoalgotrading.cryptoalgotrading import backtest\nimport cryptoalgotrading.entry as entry\n\n# 执行回测\n# 参数说明：\n# [\"BTC-XRP\"]: 交易对\n# entry.cross_smas: 入场策略函数\n# smas=[15,40]: 均线周期参数\n# interval='10m': K 线时间间隔\n# from_file=True: 从本地文件\u002F数据库读取数据\n# plot=True: 绘制结果图表\nbacktest([\"BTC-XRP\"], entry.cross_smas, smas=[15,40], interval='10m', from_file=True, plot=True)\n```\n\n**输出说明**：\n运行后将生成包含三个子图的图表：\n1.  **顶部**：价格走势、布林带及 SMA 均线，绿色点标记入场位置。\n2.  **中部**：成交量数据。\n3.  **底部**：卖出订单数量随时间的变化。\n\n> **安全提示**：默认的买卖操作代码已被注释。若需实盘交易，请确保你完全理解相关风险，并正确配置交易所 API Key。本工具仅供学习和研究使用，风险自担。","一位独立量化开发者希望构建针对比特币与狗狗币（BTC-DGB）交易对的自动化策略，以捕捉短期均线交叉带来的波动收益。\n\n### 没有 algotrading 时\n- 开发者需手动编写繁琐的代码来对接交易所 API 获取实时行情，数据清洗和存储格式不统一，极易出错。\n- 回测策略时必须重新搭建数据管道，无法复用实盘逻辑，导致“回测表现完美，实盘亏损严重”的偏差。\n- 缺乏内置的移动止盈（Trailing Stop）和止损模块，每次调整风控规则都要修改核心代码，维护成本极高。\n- 难以直观验证策略进出场点，只能依靠打印枯燥的日志数据，无法快速发现策略在特定时间帧下的逻辑漏洞。\n\n### 使用 algotrading 后\n- 直接利用框架内置的数据采集模块，无缝连接交易所 API 或读取 CSV\u002F数据库，统一了实盘与回测的数据源格式。\n- 通过切换“回测模式”即可用历史数据验证 SMA 交叉策略，确保实盘运行的逻辑与回测完全一致，大幅降低试错成本。\n- 调用框架预定义的退出函数，轻松配置移动止盈和简单止损，无需重复造轮子即可实现专业的风控管理。\n- 启用\"Tick-by-tick\"模式可视化复盘，直接在图表上查看策略的买卖标记，迅速定位并修复了原本隐藏的入场延迟问题。\n\nalgotrading 将碎片化的交易基建整合为标准化流程，让开发者能从繁琐的代码工程中解放出来，专注于策略逻辑本身的迭代与优化。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fivopetiz_algotrading_1d03f708.png","ivopetiz","Ivo Petiz","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fivopetiz_f8630e79.jpg","Sports Quant Dev","Amelco",null,"https:\u002F\u002Fwww.linkedin.com\u002Fin\u002Fivopetiz\u002F","https:\u002F\u002Fgithub.com\u002Fivopetiz",[81],{"name":82,"color":83,"percentage":84},"Python","#3572A5",100,1534,195,"2026-04-13T02:14:31","MIT",4,"Linux","未说明",{"notes":93,"python":94,"dependencies":95},"该框架专为加密货币市场设计，支持实时交易、逐笔回测和策略回测模式。数据存储推荐使用 InfluxDB 数据库，也可使用 CSV 文件。虽然提到了 PyPy 支持，但明确指出在使用 Pandas 和 Numpy 时效果不佳。买卖操作需要配置交易所 API Key，而回测和警报功能则不需要。代码中包含真实的买卖选项但默认注释，需谨慎使用。","3+",[96,97,98,99,100,101],"IPython","Pandas","Matplotlib","Numpy","Python-Influxdb","Python-tk",[35,52,14,103],"其他",[105,106,107,108,109,64,110,111,112,113,114,115,116,117,118,119,120,121,122,123],"crypto","cryptocurrency","cryptocurrencies","cryptocurrency-exchanges","algorithmic-trading","framework","hft","hft-trading","bot","backtest","backtesting-trading-strategies","realtime","trading","trading-bot","trading-algorithms","trading-simulator","trading-api","high-frequency-trading","crypto-algotrading","2026-03-27T02:49:30.150509","2026-04-13T16:18:07.426230",[127,132,137,142,147,151,156],{"id":128,"question_zh":129,"answer_zh":130,"source_url":131},31732,"这个项目的核心用途是什么？它是用来构建完整的交易所系统吗？","不是。该项目的核心思想是通过你编写的算法来自动化交易策略，并运行回测来测试这些算法。它不适合直接用于构建包含会员、存取款系统的完整交易所（如 Binance 那样的现货交易系统）。对于执行实际交易订单，直接使用交易所官方 API 会比适配这个项目更容易。","https:\u002F\u002Fgithub.com\u002Fivopetiz\u002Falgotrading\u002Fissues\u002F30",{"id":133,"question_zh":134,"answer_zh":135,"source_url":136},31733,"为什么运行 cryptoalgotrading.py 时会报错 'No module named cryptoalgotrading' 或 'is not a package'？","你不应该直接将 cryptoalgotrading.py 作为一个独立程序运行。cryptoalgotrading 是一个库（library），本身不会执行任何操作。你需要在你的程序中导入它来使用。建议参考 README.md 中的示例，在 Python3、IPython 或 Jupyter Notebook 中通过导入模块的方式来使用它。","https:\u002F\u002Fgithub.com\u002Fivopetiz\u002Falgotrading\u002Fissues\u002F10",{"id":138,"question_zh":139,"answer_zh":140,"source_url":141},31734,"安装依赖时遇到 pandas 或 matplotlib 版本不满足要求的问题，该如何解决？","这通常是因为 Python 版本过旧或不兼容。建议使用 Python 3.8.7 或更高版本。维护者已更新了 requirements.txt 文件中的 Tables 和 Matplotlib 版本，请拉取最新代码后重新运行 `pip install -r requirements.txt` 进行安装。","https:\u002F\u002Fgithub.com\u002Fivopetiz\u002Falgotrading\u002Fissues\u002F23",{"id":143,"question_zh":144,"answer_zh":145,"source_url":146},31735,"安装过程中出现 'Could not find a local HDF5 installation' 错误怎么办？","这是因为缺少 HDF5 库导致的。维护者已经更新了 requirements.txt 中的相关依赖版本以解决此兼容性问题。请确保使用最新的代码库，并尝试重新安装依赖。如果问题依旧，可能需要显式指定 HDF5 的头文件和库路径，或者使用 Conda 环境来管理依赖。","https:\u002F\u002Fgithub.com\u002Fivopetiz\u002Falgotrading\u002Fissues\u002F15",{"id":148,"question_zh":149,"answer_zh":150,"source_url":141},31736,"Chronograf 不再免费或无法使用，有什么推荐的替代方案吗？","可以使用 Grafana 作为替代方案。维护者确认 Grafana 工作良好，甚至在视觉效果上优于 Chronograf。之前使用 Chronograf 主要是因为当时配置较简单，但对于大多数需求，Grafana 是一个很好的选择。",{"id":152,"question_zh":153,"answer_zh":154,"source_url":155},31737,"如何正确开始使用这个项目？","不要直接运行主脚本文件。请先阅读 README.md 中的教程和“如何开始”（How to start）部分。该项目现已包含快速入门指南，允许用户立即开始使用 Algotrading 功能。主要通过导入库并在自己的脚本或 Notebook 中调用示例代码来运行。","https:\u002F\u002Fgithub.com\u002Fivopetiz\u002Falgotrading\u002Fissues\u002F31",{"id":157,"question_zh":158,"answer_zh":159,"source_url":160},31738,"README 文档中关于入场函数（Entry functions）的描述是否有误？","是的，文档中曾存在笔误。入场函数用于聚合所有策略以进入特定市场。当数据满足进入市场的条件时采取行动。如果可用数据代表用户的**入场点（entry point）**，函数应返回 True；否则返回 False。原文档错误地写成了“退出点（exit point）”，该错误已被修正。","https:\u002F\u002Fgithub.com\u002Fivopetiz\u002Falgotrading\u002Fissues\u002F11",[]]