aicoin-freqtrade
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAiCoin Freqtrade
AiCoin Freqtrade
Freqtrade strategy creation, backtesting, and deployment powered by AiCoin Open API.
Version: 1.0.0
由AiCoin Open API提供支持的Freqtrade策略创建、回测与部署工具。
版本: 1.0.0
STRATEGY CREATION — USE create_strategy
策略创建 — 请使用create_strategy
You MUST use to generate strategy files. NEVER write Python strategy code by hand.
create_strategybash
undefined你必须使用生成策略文件,绝对不要手动编写Python策略代码。
create_strategybash
undefinedGenerate a strategy with AiCoin data
Generate a strategy with AiCoin data
node scripts/ft-deploy.mjs create_strategy '{"name":"MyStrategy","timeframe":"15m","aicoin_data":["funding_rate","ls_ratio"],"description":"资金费率极端做反向"}'
node scripts/ft-deploy.mjs create_strategy '{"name":"MyStrategy","timeframe":"15m","aicoin_data":["funding_rate","ls_ratio"],"description":"资金费率极端做反向"}'
Generate a pure technical strategy (no AiCoin data)
Generate a pure technical strategy (no AiCoin data)
node scripts/ft-deploy.mjs create_strategy '{"name":"SimpleRSI","timeframe":"1h"}'
**`aicoin_data` options** (combine any):
| Data source | What it does | AiCoin tier |
|-------------|-------------|-------------|
| `funding_rate` | Extreme funding = over-leveraged, trade against | Basic ($29/mo) |
| `ls_ratio` | Contrarian signal from retail long/short ratio | Basic ($29/mo) |
| `big_orders` | Whale buy/sell pressure from institutional orders | Standard ($79/mo) |
| `open_interest` | Detect OI spikes = fragile market | Professional ($699/mo) |
| `liquidation_map` | Liquidation cascade direction bias | Advanced ($299/mo) |node scripts/ft-deploy.mjs create_strategy '{"name":"SimpleRSI","timeframe":"1h"}'
**`aicoin_data`可选参数**(可任意组合):
| 数据源 | 功能说明 | AiCoin套餐等级 |
|-------------|-------------|-------------|
| `funding_rate` | 极端资金费率 = 过度杠杆,可反向交易 | 基础版($29/月) |
| `ls_ratio` | 散户多空比衍生的反向信号 | 基础版($29/月) |
| `big_orders` | 机构订单带来的巨鲸买卖压力 | 标准版($79/月) |
| `open_interest` | 识别未平仓合约激增 = 市场脆弱 | 专业版($699/月) |
| `liquidation_map` | 清算瀑布的方向偏向 | 高级版($299/月) |Strategy Generation Rules for Agent
Agent 策略生成规则
All options require a paid API key. Based on the user's strategy description:
aicoin_data- If strategy needs AiCoin data (,
funding_rate,ls_ratio,big_orders,open_interest):liquidation_map- Do NOT silently include it. First inform the user that this data requires a paid API key.
- Tell them which tier is needed (see table above).
- Guide them: get API key at https://www.aicoin.com/opendata → add &
AICOIN_ACCESS_KEY_IDtoAICOIN_ACCESS_SECRET..env - Only include the paid data after user confirms they have the key configured.
- If strategy does NOT need AiCoin data: Generate a pure technical indicator strategy (RSI, EMA, Bollinger, etc.) — works for everyone out of the box.
After generating, backtest immediately:
bash
node scripts/ft-deploy.mjs backtest '{"strategy":"MyStrategy","timeframe":"15m","timerange":"20250101-20260301"}'所有参数都需要付费API密钥。根据用户的策略描述:
aicoin_data- 如果策略需要AiCoin数据(、
funding_rate、ls_ratio、big_orders、open_interest):liquidation_map- 不要静默添加该参数。 首先告知用户该数据需要付费API密钥。
- 告知用户所需的套餐等级(见上表)。
- 引导用户操作:前往https://www.aicoin.com/opendata获取API密钥 → 将和
AICOIN_ACCESS_KEY_ID添加到AICOIN_ACCESS_SECRET文件中。.env - 仅在用户确认已配置好密钥后再添加付费数据参数。
- 如果策略不需要AiCoin数据:生成纯技术指标策略(RSI、EMA、布林带等)——所有用户开箱即可使用。
生成策略后立即进行回测:
bash
node scripts/ft-deploy.mjs backtest '{"strategy":"MyStrategy","timeframe":"15m","timerange":"20250101-20260301"}'Critical Rules
核心规则
- ALWAYS use to write strategies. NEVER hand-write Python strategy files.
create_strategy - ALWAYS use for backtesting. NEVER write custom Python backtest scripts.
ft-deploy.mjs backtest - ALWAYS use for deployment. NEVER use Docker. NEVER manually run
ft-deploy.mjs deploycommands.freqtrade - NEVER manually edit Freqtrade config files. Use actions.
ft-deploy.mjs - NEVER manually run ,
freqtrade trade, orsource .venv/bin/activate.pip install freqtrade
- **必须使用**编写策略,绝对不要手动编写Python策略文件。
create_strategy - **必须使用**进行回测,绝对不要编写自定义Python回测脚本。
ft-deploy.mjs backtest - **必须使用**进行部署,绝对不要使用Docker,绝对不要手动运行
ft-deploy.mjs deploy命令。freqtrade - 绝对不要手动编辑Freqtrade配置文件,请使用提供的操作。
ft-deploy.mjs - 绝对不要手动运行、
freqtrade trade或source .venv/bin/activate命令。pip install freqtrade
Quick Reference
快速参考
| Task | Command |
|---|---|
| Create strategy | |
| Backtest | |
| Deploy (dry-run) | |
| Deploy (live) | |
| Hyperopt | |
| Strategy list | |
| Bot status | |
| Bot logs | |
| Check profit | |
| Open trades | |
| 任务 | 命令 |
|---|---|
| 创建策略 | |
| 回测 | |
| 部署(模拟盘) | |
| 部署(实盘) | |
| 超参数优化 | |
| 策略列表 | |
| 机器人状态 | |
| 机器人日志 | |
| 查看收益 | |
| 未平仓交易 | |
Setup
环境配置
Prerequisites: Python 3.11+ and git.
前置要求: Python 3.11+ 和 git。
Environment Variables
环境变量
.env- Current working directory
~/.openclaw/workspace/.env~/.openclaw/.env
Exchange keys (required for live/dry-run trading):
undefined.env- 当前工作目录
~/.openclaw/workspace/.env~/.openclaw/.env
交易所密钥(实盘/模拟盘交易必需):
undefinedSame format as aicoin-trading skill
和aicoin-trading skill格式一致
BINANCE_API_KEY=xxx
BINANCE_API_SECRET=xxx
BINANCE_API_KEY=xxx
BINANCE_API_SECRET=xxx
Or OKX, Bybit, etc. — see aicoin-trading skill for full list
也支持OKX、Bybit等 — 完整列表见aicoin-trading skill
**AiCoin API key** (required if strategy uses `aicoin_data`):AICOIN_ACCESS_KEY_ID=your-key-id
AICOIN_ACCESS_SECRET=your-secret
Get at https://www.aicoin.com/opendata. See [Paid Feature Guide](#paid-feature-guide) for tier details.
**安全说明:** AiCoin API Key 仅用于获取市场数据,无法进行任何交易操作。交易所 API Key 需单独到交易所申请。所有密钥仅保存在本地设备 `.env` 文件中,不会上传到任何服务器。
**AiCoin API密钥**(如果策略使用`aicoin_data`则必需):AICOIN_ACCESS_KEY_ID=your-key-id
AICOIN_ACCESS_SECRET=your-secret
前往https://www.aicoin.com/opendata获取。套餐详情见[付费功能指南](#paid-feature-guide)。
**安全说明:** AiCoin API Key 仅用于获取市场数据,无法进行任何交易操作。交易所 API Key 需单独到交易所申请。所有密钥仅保存在本地设备 `.env` 文件中,不会上传到任何服务器。Deploy
部署
Deploy is one command:
bash
node scripts/ft-deploy.mjs check # Check prerequisites
node scripts/ft-deploy.mjs deploy '{"pairs":["BTC/USDT:USDT","ETH/USDT:USDT"]}'This automatically: clones Freqtrade, runs , creates config from , starts background process, writes vars to .
setup.sh -i.envFREQTRADE_*.envDeploy defaults to dry-run (simulated trading). Pass for live.
{"dry_run":false}部署仅需一条命令:
bash
node scripts/ft-deploy.mjs check # 检查前置依赖
node scripts/ft-deploy.mjs deploy '{"pairs":["BTC/USDT:USDT","ETH/USDT:USDT"]}'该命令会自动完成:克隆Freqtrade仓库、运行、从生成配置、启动后台进程、将变量写入文件。
setup.sh -i.envFREQTRADE_*.env部署默认使用模拟盘(模拟交易)。 实盘交易请传入参数。
{"dry_run":false}Scripts
脚本说明
scripts/ft-deploy.mjs — Deployment & Strategy
scripts/ft-deploy.mjs — 部署与策略管理
| Action | Description | Params |
|---|---|---|
| Check prerequisites | None |
| Deploy Freqtrade | |
| Run backtest | |
| Parameter optimization | |
| Generate strategy file | |
| List strategies | None |
| Update Freqtrade | None |
| Process status | None |
| Start process | None |
| Stop process | None |
| View logs | |
| Remove process | None |
| 操作 | 描述 | 参数 |
|---|---|---|
| 检查前置依赖 | 无 |
| 部署Freqtrade | |
| 运行回测 | |
| 参数优化 | |
| 生成策略文件 | |
| 列出所有策略 | 无 |
| 更新Freqtrade | 无 |
| 进程状态 | 无 |
| 启动进程 | 无 |
| 停止进程 | 无 |
| 查看日志 | |
| 删除进程 | 无 |
scripts/ft.mjs — Bot Control (requires running process)
scripts/ft.mjs — 机器人控制(需要进程正在运行)
| Action | Description | Params |
|---|---|---|
| Health check | None |
| Start trading | None |
| Stop trading | None |
| Reload config | None |
| View config | None |
| Version info | None |
| System info | None |
| Health status | None |
| View logs | |
| Account balance | None |
| Open trades | None |
| Trade count | None |
| Trade by ID | |
| Trade history | |
| Manual entry | |
| Manual exit | |
| Cancel order | |
| Delete record | |
| Profit summary | None |
| Profit per pair | None |
| Daily report | |
| Weekly report | |
| Monthly report | |
| Statistics | None |
| 操作 | 描述 | 参数 |
|---|---|---|
| 健康检查 | 无 |
| 开始交易 | 无 |
| 停止交易 | 无 |
| 重载配置 | 无 |
| 查看配置 | 无 |
| 版本信息 | 无 |
| 系统信息 | 无 |
| 健康状态 | 无 |
| 查看日志 | |
| 账户余额 | 无 |
| 未平仓交易 | 无 |
| 交易数量 | 无 |
| 根据ID查询交易 | |
| 交易历史 | |
| 手动开仓 | |
| 手动平仓 | |
| 取消订单 | |
| 删除交易记录 | |
| 收益汇总 | 无 |
| 各交易对收益 | 无 |
| 日报 | |
| 周报 | |
| 月报 | |
| 统计数据 | 无 |
scripts/ft-dev.mjs — Dev Tools (requires running process)
scripts/ft-dev.mjs — 开发工具(需要进程正在运行)
| Action | Description | Params |
|---|---|---|
| Start backtest | |
| Backtest status | None |
| Abort backtest | None |
| Backtest history | None |
| History result | |
| Live candles | |
| Candles with indicators | |
| Available pairs | None |
| Whitelist | None |
| Blacklist | None |
| Add to blacklist | |
| Trade locks | None |
| Strategy list | None |
| Strategy detail | |
| 操作 | 描述 | 参数 |
|---|---|---|
| 启动回测 | |
| 回测状态 | 无 |
| 终止回测 | 无 |
| 回测历史 | 无 |
| 历史回测结果 | |
| 实时K线 | |
| 带指标的K线 | |
| 可用交易对 | 无 |
| 白名单 | 无 |
| 黑名单 | 无 |
| 添加到黑名单 | |
| 交易锁 | 无 |
| 策略列表 | 无 |
| 策略详情 | |
Built-in AiCoin Strategies
内置AiCoin策略
Auto-installed on deploy:
- FundingRateStrategy — Exploit extreme funding rates for mean reversion (Basic tier)
- WhaleFollowStrategy — Follow whale order flow + contrarian L/S ratio (Standard tier)
- LiquidationHunterStrategy — Profit from liquidation cascades (Advanced tier)
部署时自动安装:
- FundingRateStrategy — 利用极端资金费率进行均值回归(基础版套餐)
- WhaleFollowStrategy — 跟随巨鲸订单流+多空比反向交易(标准版套餐)
- LiquidationHunterStrategy — 从清算瀑布中获利(高级版套餐)
User Journey
用户使用流程示例
"帮我写一个资金费率策略"
→ node scripts/ft-deploy.mjs create_strategy '{"name":"FundingStrat","timeframe":"15m","aicoin_data":["funding_rate"]}'
"回测一下"
→ node scripts/ft-deploy.mjs backtest '{"strategy":"FundingStrat","timeframe":"15m","timerange":"20250101-20260301"}'
"不错,部署"
→ node scripts/ft-deploy.mjs deploy '{"pairs":["BTC/USDT:USDT"]}'
"上实盘"
→ node scripts/ft-deploy.mjs deploy '{"dry_run":false}'
"今天赚了多少?"
→ node scripts/ft.mjs profit"帮我写一个资金费率策略"
→ node scripts/ft-deploy.mjs create_strategy '{"name":"FundingStrat","timeframe":"15m","aicoin_data":["funding_rate"]}'
"回测一下"
→ node scripts/ft-deploy.mjs backtest '{"strategy":"FundingStrat","timeframe":"15m","timerange":"20250101-20260301"}'
"不错,部署"
→ node scripts/ft-deploy.mjs deploy '{"pairs":["BTC/USDT:USDT"]}'
"上实盘"
→ node scripts/ft-deploy.mjs deploy '{"dry_run":false}'
"今天赚了多少?"
→ node scripts/ft.mjs profitCross-Skill References
跨skill引用
| Need | Use |
|---|---|
| Prices, K-lines, market data | aicoin-market |
| Exchange trading (buy/sell) | aicoin-trading |
| Hyperliquid whale tracking | aicoin-hyperliquid |
| 需求 | 使用的skill |
|---|---|
| 价格、K线、市场数据 | aicoin-market |
| 交易所交易(买卖) | aicoin-trading |
| Hyperliquid巨鲸追踪 | aicoin-hyperliquid |
Common Errors
常见错误
- — Paid AiCoin feature. Do NOT retry. See Paid Feature Guide below.
errorCode 304 / HTTP 403 - — Need Python 3.11+.
Python not foundvalidates this.ft-deploy.mjs check - — Check
Strategy not found. File must be inft-deploy.mjs strategy_list.~/.freqtrade/user_data/strategies/ - — Use
Timerange format(e.g.,YYYYMMDD-YYYYMMDD).20250101-20260301 - — Freqtrade ops may take 5+ min. Use
Timeoutwhich handles timeouts.ft-deploy.mjs
- — AiCoin付费功能。不要重试。 见下方付费功能指南。
errorCode 304 / HTTP 403 - — 需要Python 3.11+版本。可运行
Python not found验证。ft-deploy.mjs check - — 请检查
Strategy not found输出,策略文件必须放在ft-deploy.mjs strategy_list目录下。~/.freqtrade/user_data/strategies/ - — 请使用
Timerange format格式(例如YYYYMMDD-YYYYMMDD)。20250101-20260301 - — Freqtrade操作可能需要5分钟以上,使用
Timeout可自动处理超时。ft-deploy.mjs
Paid Feature Guide
付费功能指南
When a script returns 304 or 403: Do NOT retry. Tell the user:
- What happened: This AiCoin data feature needs a paid API subscription.
- How to get a key: Visit https://www.aicoin.com/opendata to register and create an API key.
- Tier options (for in strategies):
aicoin_data
| Tier | Price | Strategy Data |
|---|---|---|
| Free | $0 | Pure technical indicators only (no |
| Basic | $29/mo | + |
| Standard | $79/mo | + |
| Advanced | $299/mo | + |
| Professional | $699/mo | + |
- How to configure: Add to file:
.env
AICOIN_ACCESS_KEY_ID=your-key-id
AICOIN_ACCESS_SECRET=your-secret- auto-loaded from: cwd →
.env→~/.openclaw/workspace/.env. After configuring, the same script command will work.~/.openclaw/.env - MUST tell the user: AiCoin API Key 仅用于获取市场数据,无法进行任何交易操作。如需在交易所下单,需要单独到交易所申请交易 API Key。所有密钥仅保存在你的本地设备 文件中,不会上传到任何服务器。
.env
当脚本返回304或403错误时:不要重试。 告知用户以下内容:
- 发生了什么:该AiCoin数据功能需要付费API订阅。
- 如何获取密钥:访问https://www.aicoin.com/opendata注册并创建API密钥。
- 套餐选项(策略中对应的套餐):
aicoin_data
| 套餐 | 价格 | 可用策略数据 |
|---|---|---|
| 免费版 | $0 | 仅纯技术指标(无 |
| 基础版 | $29/月 | + |
| 标准版 | $79/月 | + |
| 高级版 | $299/月 | + |
| 专业版 | $699/月 | + |
- 如何配置:添加到文件:
.env
AICOIN_ACCESS_KEY_ID=your-key-id
AICOIN_ACCESS_SECRET=your-secret- 按以下路径自动加载:当前工作目录 →
.env→~/.openclaw/workspace/.env。配置完成后,重新运行相同的脚本命令即可生效。~/.openclaw/.env - 必须告知用户:AiCoin API Key 仅用于获取市场数据,无法进行任何交易操作。如需在交易所下单,需要单独到交易所申请交易 API Key。所有密钥仅保存在你的本地设备 文件中,不会上传到任何服务器。
.env
Troubleshooting
故障排除
- Check Python: (need 3.11+)
python3 --version - Check logs:
node scripts/ft-deploy.mjs logs - Verify exchange keys in (see Setup)
.env - DO NOT try manual fixes — report error, let ft-deploy.mjs handle it
- 检查Python版本:(需要3.11+)
python3 --version - 查看日志:
node scripts/ft-deploy.mjs logs - 验证中的交易所密钥(见环境配置)
.env - 不要尝试手动修复 — 上报错误,让ft-deploy.mjs处理