# xquant **Repository Path**: dicuu/xquant ## Basic Information - **Project Name**: xquant - **Description**: This project is a quantitative tool for the financial trading market, with the goal of maximizing profits. It may take the help of some existing mathematical formulas and trading logic. - **Primary Language**: Go - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-06-15 - **Last Updated**: 2025-06-23 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # X-Quant X-Quant is a quantitative tool for the financial trading market, with the goal of maximizing profits. It may take the help of some existing mathematical formulas and trading logic. [![](https://img.shields.io/badge/Author-Dicuu-orange.svg)](https://gitee.com/dicuu/xquant) [![star](https://gitee.com/dicuu/xquant/badge/star.svg)](https://gitee.com/dicuu/xquant) [![fork](https://gitee.com/dicuu/xquant/badge/fork.svg?theme=dark)](https://gitee.com/dicuu/xquant) ![License](https://img.shields.io/badge/license-MIT-green.svg) ![Language](https://img.shields.io/badge/language-Go1.24-blue.svg) [![](https://img.shields.io/badge/version-v0.0.1-brightgreen.svg)](https://gitee.com/dicuu/xquant) Reference: - jvQuant WIKI: [https://jvquant.com/wiki/](https://jvquant.com/wiki/) - BigQuant WIKI: [https://bigquant.com/wiki/home](https://bigquant.com/wiki/home) ## What is Quantitative Trading 量化交易是利用数学模型和大数据分析来指导股票交易决策的一种方法。 与传统的基于直觉和经验的交易方式不同,量化交易侧重于通过算法分析历史数据,从而发现潜在的市场趋势和交易机会。 ## Step in Quantitative Trading ### 数据分析 收集和分析历史交易数据,包括股价、成交量、市场新闻等。 ### 策略开发 基于数据分析结果,开发可以预测市场趋势的交易策略。 ### 回测 在历史数据上测试策略,验证其有效性。 回测平台会自动执行交易策略,包括买入、卖出、止损、止盈等操作,并计算回测结果,例如累计收益率、最大回撤、夏普比率等指标。 **回测的目的:** 验证投资策路的有效性和可行性,同时也可以帮助优化和调整策略参数,以获得更好的交昜结果 需要注意的是,回测结果仅是对历史数据的模拟,不能完全代表未来的市场情况,因此在实际交易时仍需要谨慎评估和风险控制。 ### 实盘交易 将经过回测验证的策略应用于实际交易。 ## Common Trading Strategies ### 基于均线的交易策略 当股票的短期均线上穿长期均线时买入,下穿时卖出。 ### 基于动量的交易策略 投资近期表现最好的股票。 ### 机器学习交易策略 利用机器学习模型预测股票价格。 ## 项目目录 ```shell xquant/ # 项目根目录 ├── bin/ # 可执行文件 ├── cmd/ # 命令行入口 │ ├── backtest/ # 回测命令 │ ├── broker/ # 实盘交易命令 │ ├── market/ # 行情数据获取命令 │ └── xquant/ # 主程序入口 ├── internal/ # 内部模块(不对外暴露) │ ├── market/ # 行情模块(DDD风格) │ │ ├── domain/ # 领域模型 │ │ │ ├── ticker.go # 股票实体 │ │ │ ├── quote.go # 行情数据实体 │ │ │ └── repository.go # 仓储接口 │ │ ├── application/ # 应用服务 │ │ │ ├── quote_service.go # 行情服务 │ │ │ └── history_service.go # 历史数据服务 │ │ └── infrastructure/ # 基础设施 │ │ ├── data_source/ # 数据源适配器 │ │ │ ├── tushare.go # Tushare数据源 │ │ │ ├── baostock.go # 东方财富数据源 │ │ │ └── polygon.go # Polygon.io数据源(美股) │ │ └── repository/ # 仓储实现 │ │ └── database.go # 数据库实现 │ ├── strategy/ # 策略模块 │ │ ├── domain/ # 领域模型 │ │ │ ├── base_strategy.go # 策略基类 │ │ │ ├── indicators.go # 技术指标 │ │ │ └── signal.go # 交易信号 │ │ ├── application/ # 应用服务 │ │ │ └── strategy_service.go # 策略管理服务 │ │ └── infrastructure/ # 基础设施 │ │ └── strategy_registry.go # 策略注册中心 │ ├── backtest/ # 回测模块 │ │ ├── domain/ # 领域模型 │ │ │ ├── portfolio.go # 投资组合 │ │ │ ├── order.go # 订单 │ │ │ └── trade.go # 交易 │ │ ├── application/ # 应用服务 │ │ │ └── backtest_service.go # 回测服务 │ │ └── infrastructure/ # 基础设施 │ │ ├── simulator.go # 市场模拟器 │ │ └── metrics.go # 回测指标计算 │ ├── broker/ # 实盘交易模块 │ │ ├── domain/ # 领域模型 │ │ │ ├── account.go # 账户 │ │ │ └── position.go # 持仓 │ │ ├── application/ # 应用服务 │ │ │ └── trading_service.go # 交易服务 │ │ └── infrastructure/ # 基础设施 │ │ ├── broker_adapter/ # 券商适配器 │ │ │ ├── huatai.go # 华泰证券 │ │ │ ├── eastmoney.go # 东方财富 │ │ │ └── ib.go # Interactive Brokers(美股) │ ├── common/ # 公共模块 │ │ ├── errors/ # 错误定义 │ │ ├── utils/ # 工具函数 │ │ └── config/ # 配置管理 │ └── api/ # API接口定义 │ ├── dto/ # 数据传输对象 │ └── contract/ # 服务契约 ├── pkg/ # 可复用的公共库 │ ├── logging/ # 日志系统 │ ├── database/ # 数据库访问 │ ├── cache/ # 缓存组件 │ └── metrics/ # 指标收集 ├── web/ # Web界面(可选) │ ├── frontend/ # 前端代码 │ └── backend/ # 后端API ├── docs/ # 文档 │ ├── getting_started.md # 快速开始 │ ├── api_reference.md # API参考 │ ├── strategy_guide.md # 策略开发指南 │ └── contributing.md # 贡献指南 └── Makefile, go.mod, etc. # 构建和依赖文件 ``` ## Installation We provide `Makefile` to facilitate the build of executable files for various platforms. ```shell # input make help # output > Usage: > make build - Build The Executable File of The Current Platform > make build-all - Build All Supported Platforms > make run - Run X-Quant > make clean - Clean The Output Directory > make test - Run Unit Tests ``` ## How to Use 1. jvQuant Token 2. Formulate some trading strategies in subproject `trade-me` 3. xxxx