Files
nofx/docs/architecture/README.zh-CN.md
tinkle-community 21a15f98eb refactor: remove all backtest module code and references
Delete backtest/ engine (19 files), api/backtest.go, store/backtest.go,
web backtest components (7 files), API client, types, docs, screenshot.
Clean all backtest references from main.go, api/server.go, store/store.go,
App.tsx, HeaderBar.tsx, LandingPage.tsx, translations, README and docs.
2026-03-16 07:38:01 +08:00

139 lines
5.9 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# NOFX 架构文档
**语言:** [English](README.md) | [中文](README.zh-CN.md)
为希望了解 NOFX 内部实现的开发者提供的技术文档。
---
## 概述
NOFX 是一个支持加密货币和美股市场的全栈 AI 交易平台:
- **后端:** Go (Gin 框架, SQLite)
- **前端:** React/TypeScript (Vite, TailwindCSS)
- **AI 模型:** DeepSeek, Qwen, OpenAI (GPT-5.2), Claude, Gemini, Grok, Kimi
- **交易所:** Binance, Bybit, OKX, Hyperliquid, Aster, Lighter
---
## 系统架构
```
┌─────────────────────────────────────────────────────────────────────────────┐
│ NOFX 平台 │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────┐ ┌─────────────────────────────────────┐│
│ │ 策略 │ │ 实盘交易 ││
│ │ 工作室 │ │ (自动交易员) ││
│ └──────┬──────┘ └──────────────────┬──────────────────┘│
│ │ │ │
│ └────────────────────────────┘ │
│ │ │
│ ┌─────────▼─────────┐ │
│ │ 核心服务 │ │
│ │ - 行情数据 │ │
│ │ - AI 模型 │ │
│ │ - 风险控制 │ │
│ └─────────┬─────────┘ │
│ │ │
│ ┌──────────────────────────┼──────────────────────────┐ │
│ │ │ │ │
│ ┌──────▼──────┐ ┌─────────▼─────────┐ ┌────────▼────────┐ │
│ │ 交易所 │ │ 数据库 │ │ 前端 UI │ │
│ │ (CEX/DEX) │ │ (SQLite) │ │ (React SPA) │ │
│ └─────────────┘ └───────────────────┘ └─────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
```
---
## 模块文档
### 核心模块
| 模块 | 描述 | 文档 |
|------|------|------|
| **策略工作室** | 策略配置、币种选择、数据组装、AI 提示词 | [STRATEGY_MODULE.md](STRATEGY_MODULE.md) |
### 模块概览
#### 策略模块
完整的策略配置系统,包括:
- 币种来源选择静态列表、AI500 币池、OI 排行)
- 市场数据指标K线、EMA、MACD、RSI、ATR
- 提示词构建(系统提示词、用户提示词、分段配置)
- AI 响应解析和决策执行
- 风险控制强制执行
**[阅读完整文档 →](STRATEGY_MODULE.md)**
---
## 项目结构
```
nofx/
├── main.go # 程序入口
├── api/ # HTTP API (Gin 框架)
├── trader/ # 交易执行层
├── strategy/ # 策略引擎
├── market/ # 行情数据服务
├── mcp/ # AI 模型客户端
├── store/ # 数据库操作
├── auth/ # JWT 认证
├── manager/ # 多交易员管理
└── web/ # React 前端
├── src/pages/ # 页面组件
├── src/components/ # 共享组件
└── src/lib/api.ts # API 客户端
```
---
## 核心依赖
### 后端 (Go)
| 包 | 用途 |
|---------|---------|
| `gin-gonic/gin` | HTTP API 框架 |
| `adshao/go-binance` | Binance API 客户端 |
| `markcheno/go-talib` | 技术指标计算 |
| `golang-jwt/jwt` | JWT 认证 |
### 前端 (React)
| 包 | 用途 |
|---------|---------|
| `react` | UI 框架 |
| `recharts` | 图表可视化 |
| `swr` | 数据获取 |
| `zustand` | 状态管理 |
| `tailwindcss` | CSS 框架 |
---
## 快速链接
- [策略模块](STRATEGY_MODULE.md) - 策略如何运作
- [快速开始](../getting-started/README.zh-CN.md) - 部署指南
- [常见问题](../faq/README.md) - FAQ
---
## 开发者资源
**想要贡献?**
- 阅读上方的模块文档
- 查看 [Open Issues](https://github.com/NoFxAiOS/nofx/issues)
- 加入我们的社区
**代码仓库:** https://github.com/NoFxAiOS/nofx
---
[← 返回文档首页](../README.md)