diff --git a/recommendations-viewer/.gitignore b/recommendations-viewer/.gitignore new file mode 100644 index 0000000..27b3e38 --- /dev/null +++ b/recommendations-viewer/.gitignore @@ -0,0 +1,30 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist +dist-ssr +*.local + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? + +# Environment variables +.env +.env.local +.env.production.local +.env.development.local diff --git a/recommendations-viewer/README.md b/recommendations-viewer/README.md new file mode 100644 index 0000000..60a2c6d --- /dev/null +++ b/recommendations-viewer/README.md @@ -0,0 +1,79 @@ +# 交易推荐查看器 + +一个独立的React前端应用,用于查看实时交易推荐。 + +## 功能特点 + +- ✅ 实时查看交易推荐(基于当前行情数据) +- ✅ 每10秒自动刷新价格 +- ✅ 支持按方向过滤(做多/做空) +- ✅ 显示详细的推荐信息(价格、止损、止盈、仓位、杠杆等) +- ✅ 显示技术指标详情 +- ✅ 响应式设计,支持移动端 + +## 安装和运行 + +### 1. 安装依赖 + +```bash +cd recommendations-viewer +npm install +``` + +### 2. 配置API地址(可选) + +如果需要修改API地址,可以: + +- 在项目根目录创建 `.env` 文件: + ``` + VITE_API_URL=http://your-api-url.com + ``` + +- 或者修改 `vite.config.js` 中的代理配置 + +### 3. 启动开发服务器 + +```bash +npm run dev +``` + +应用将在 `http://localhost:3001` 启动 + +### 4. 构建生产版本 + +```bash +npm run build +``` + +构建后的文件在 `dist` 目录中 + +## 项目结构 + +``` +recommendations-viewer/ +├── src/ +│ ├── components/ +│ │ ├── RecommendationsViewer.jsx # 主组件 +│ │ └── RecommendationsViewer.css # 样式文件 +│ ├── services/ +│ │ └── api.js # API服务 +│ ├── main.jsx # 应用入口 +│ └── index.css # 全局样式 +├── index.html # HTML模板 +├── package.json # 项目配置 +├── vite.config.js # Vite配置 +└── README.md # 说明文档 +``` + +## API接口 + +应用使用以下API接口: + +- `GET /api/recommendations?type=realtime&direction=BUY&limit=50&min_signal_strength=5` + - 获取实时推荐列表 + +## 注意事项 + +- 这是一个只读应用,不包含任何操作功能(如标记、执行、取消等) +- 推荐数据每10秒自动刷新,确保价格信息实时更新 +- 如果API服务不可用,会显示错误信息 diff --git a/recommendations-viewer/index.html b/recommendations-viewer/index.html new file mode 100644 index 0000000..a2cdeb6 --- /dev/null +++ b/recommendations-viewer/index.html @@ -0,0 +1,12 @@ + + +
+ + +暂无推荐记录
+{rec.recommendation_reason || '-'}
+{rec.market_regime === 'trending' ? '趋势市场' : '震荡市场'}
++ {rec.trend_4h === 'up' ? '上涨' : + rec.trend_4h === 'down' ? '下跌' : '中性'} +
+{parseFloat(rec.volume_24h).toFixed(2)}
+{parseFloat(rec.volatility).toFixed(4)}
+