fund-cli 2.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fund_cli-2.0.0/.env.example +77 -0
- fund_cli-2.0.0/.gitignore +103 -0
- fund_cli-2.0.0/.pre-commit-config.yaml +64 -0
- fund_cli-2.0.0/CHANGELOG.md +55 -0
- fund_cli-2.0.0/CONTRIBUTING.md +95 -0
- fund_cli-2.0.0/LICENSE +21 -0
- fund_cli-2.0.0/PKG-INFO +183 -0
- fund_cli-2.0.0/README.md +129 -0
- fund_cli-2.0.0/docs/api/reference.md +63 -0
- fund_cli-2.0.0/docs/development.md +54 -0
- fund_cli-2.0.0/docs/index.md +25 -0
- fund_cli-2.0.0/docs/installation.md +46 -0
- fund_cli-2.0.0/docs/usage/tutorial.md +60 -0
- fund_cli-2.0.0/examples/basic_analysis.py +60 -0
- fund_cli-2.0.0/examples/batch_processing.py +71 -0
- fund_cli-2.0.0/examples/portfolio_optimization.py +59 -0
- fund_cli-2.0.0/pyproject.toml +167 -0
- fund_cli-2.0.0/src/fund_cli/__init__.py +13 -0
- fund_cli-2.0.0/src/fund_cli/__main__.py +10 -0
- fund_cli-2.0.0/src/fund_cli/ai/__init__.py +21 -0
- fund_cli-2.0.0/src/fund_cli/ai/analyzer.py +360 -0
- fund_cli-2.0.0/src/fund_cli/ai/prompts.py +244 -0
- fund_cli-2.0.0/src/fund_cli/ai/providers.py +286 -0
- fund_cli-2.0.0/src/fund_cli/analysis/__init__.py +17 -0
- fund_cli-2.0.0/src/fund_cli/analysis/attribution.py +161 -0
- fund_cli-2.0.0/src/fund_cli/analysis/backtest.py +75 -0
- fund_cli-2.0.0/src/fund_cli/analysis/holding.py +217 -0
- fund_cli-2.0.0/src/fund_cli/analysis/manager.py +133 -0
- fund_cli-2.0.0/src/fund_cli/analysis/performance.py +440 -0
- fund_cli-2.0.0/src/fund_cli/analysis/portfolio.py +152 -0
- fund_cli-2.0.0/src/fund_cli/analysis/risk.py +300 -0
- fund_cli-2.0.0/src/fund_cli/cli.py +98 -0
- fund_cli-2.0.0/src/fund_cli/commands/__init__.py +9 -0
- fund_cli-2.0.0/src/fund_cli/commands/ai_cmd.py +464 -0
- fund_cli-2.0.0/src/fund_cli/commands/analyze_cmd.py +418 -0
- fund_cli-2.0.0/src/fund_cli/commands/compare_cmd.py +264 -0
- fund_cli-2.0.0/src/fund_cli/commands/config_cmd.py +97 -0
- fund_cli-2.0.0/src/fund_cli/commands/data_cmd.py +106 -0
- fund_cli-2.0.0/src/fund_cli/commands/filter_cmd.py +286 -0
- fund_cli-2.0.0/src/fund_cli/commands/holding_cmd.py +140 -0
- fund_cli-2.0.0/src/fund_cli/commands/interactive_cmd.py +84 -0
- fund_cli-2.0.0/src/fund_cli/commands/main.py +17 -0
- fund_cli-2.0.0/src/fund_cli/commands/manager_cmd.py +74 -0
- fund_cli-2.0.0/src/fund_cli/commands/monitor_cmd.py +113 -0
- fund_cli-2.0.0/src/fund_cli/commands/optimize_cmd.py +192 -0
- fund_cli-2.0.0/src/fund_cli/config.py +163 -0
- fund_cli-2.0.0/src/fund_cli/core/__init__.py +8 -0
- fund_cli-2.0.0/src/fund_cli/core/analyzer.py +46 -0
- fund_cli-2.0.0/src/fund_cli/core/data_manager.py +231 -0
- fund_cli-2.0.0/src/fund_cli/core/data_quality.py +162 -0
- fund_cli-2.0.0/src/fund_cli/core/monitor.py +230 -0
- fund_cli-2.0.0/src/fund_cli/core/optimizer.py +50 -0
- fund_cli-2.0.0/src/fund_cli/core/optimizers/__init__.py +13 -0
- fund_cli-2.0.0/src/fund_cli/core/optimizers/efficient_frontier.py +91 -0
- fund_cli-2.0.0/src/fund_cli/core/optimizers/max_sharpe.py +54 -0
- fund_cli-2.0.0/src/fund_cli/core/optimizers/mean_variance.py +84 -0
- fund_cli-2.0.0/src/fund_cli/core/optimizers/risk_parity.py +60 -0
- fund_cli-2.0.0/src/fund_cli/core/reporter.py +67 -0
- fund_cli-2.0.0/src/fund_cli/core/reporters/__init__.py +6 -0
- fund_cli-2.0.0/src/fund_cli/core/reporters/html_reporter.py +62 -0
- fund_cli-2.0.0/src/fund_cli/core/reporters/markdown_reporter.py +40 -0
- fund_cli-2.0.0/src/fund_cli/core/screener.py +142 -0
- fund_cli-2.0.0/src/fund_cli/data/__init__.py +6 -0
- fund_cli-2.0.0/src/fund_cli/data/adapters/__init__.py +7 -0
- fund_cli-2.0.0/src/fund_cli/data/adapters/akshare_adapter.py +442 -0
- fund_cli-2.0.0/src/fund_cli/data/adapters/tushare_adapter.py +254 -0
- fund_cli-2.0.0/src/fund_cli/data/adapters/wind_adapter.py +78 -0
- fund_cli-2.0.0/src/fund_cli/data/base.py +209 -0
- fund_cli-2.0.0/src/fund_cli/data/cache.py +192 -0
- fund_cli-2.0.0/src/fund_cli/data/models.py +248 -0
- fund_cli-2.0.0/src/fund_cli/utils/__init__.py +6 -0
- fund_cli-2.0.0/src/fund_cli/utils/decorators.py +88 -0
- fund_cli-2.0.0/src/fund_cli/utils/helpers.py +127 -0
- fund_cli-2.0.0/src/fund_cli/utils/validators.py +77 -0
- fund_cli-2.0.0/src/fund_cli/views/__init__.py +6 -0
- fund_cli-2.0.0/src/fund_cli/views/charts.py +120 -0
- fund_cli-2.0.0/src/fund_cli/views/reports.py +82 -0
- fund_cli-2.0.0/src/fund_cli/views/tables.py +124 -0
- fund_cli-2.0.0/test_mvp.py +629 -0
- fund_cli-2.0.0/tests/__init__.py +3 -0
- fund_cli-2.0.0/tests/conftest.py +116 -0
- fund_cli-2.0.0/tests/fixtures/sample_data.py +68 -0
- fund_cli-2.0.0/tests/integration/test_data_flow.py +90 -0
- fund_cli-2.0.0/tests/integration/test_monitoring_flow.py +80 -0
- fund_cli-2.0.0/tests/integration/test_optimization_flow.py +94 -0
- fund_cli-2.0.0/tests/unit/test_ai/__init__.py +3 -0
- fund_cli-2.0.0/tests/unit/test_ai/test_analyzer.py +238 -0
- fund_cli-2.0.0/tests/unit/test_ai/test_prompts.py +217 -0
- fund_cli-2.0.0/tests/unit/test_ai/test_providers.py +256 -0
- fund_cli-2.0.0/tests/unit/test_analysis/test_attribution.py +136 -0
- fund_cli-2.0.0/tests/unit/test_analysis/test_backtest.py +62 -0
- fund_cli-2.0.0/tests/unit/test_analysis/test_holding.py +210 -0
- fund_cli-2.0.0/tests/unit/test_analysis/test_manager.py +123 -0
- fund_cli-2.0.0/tests/unit/test_analysis/test_performance.py +149 -0
- fund_cli-2.0.0/tests/unit/test_analysis/test_performance_enhanced.py +79 -0
- fund_cli-2.0.0/tests/unit/test_base_classes.py +69 -0
- fund_cli-2.0.0/tests/unit/test_commands/test_cli.py +104 -0
- fund_cli-2.0.0/tests/unit/test_commands/test_compare_cmd.py +25 -0
- fund_cli-2.0.0/tests/unit/test_commands/test_config_cmd.py +30 -0
- fund_cli-2.0.0/tests/unit/test_commands/test_holding_cmd.py +30 -0
- fund_cli-2.0.0/tests/unit/test_commands/test_interactive.py +19 -0
- fund_cli-2.0.0/tests/unit/test_core/__init__.py +0 -0
- fund_cli-2.0.0/tests/unit/test_core/test_data_quality.py +111 -0
- fund_cli-2.0.0/tests/unit/test_core/test_monitor.py +122 -0
- fund_cli-2.0.0/tests/unit/test_core/test_optimizers.py +124 -0
- fund_cli-2.0.0/tests/unit/test_core/test_reporters.py +69 -0
- fund_cli-2.0.0/tests/unit/test_core/test_screener.py +121 -0
- fund_cli-2.0.0/tests/unit/test_data/test_cache_extended.py +35 -0
- fund_cli-2.0.0/tests/unit/test_data/test_models.py +174 -0
- fund_cli-2.0.0/tests/unit/test_data/test_models_extended.py +135 -0
- fund_cli-2.0.0/tests/unit/test_utils/__init__.py +1 -0
- fund_cli-2.0.0/tests/unit/test_utils/test_helpers.py +140 -0
- fund_cli-2.0.0/tests/unit/test_views.py +145 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# ===========================================
|
|
2
|
+
# Fund CLI 环境变量配置示例
|
|
3
|
+
# ===========================================
|
|
4
|
+
# 复制此文件为 .env 并填入实际值
|
|
5
|
+
|
|
6
|
+
# -------------------------------------------
|
|
7
|
+
# 数据源配置
|
|
8
|
+
# -------------------------------------------
|
|
9
|
+
|
|
10
|
+
# AKShare 配置(免费,无需Token)
|
|
11
|
+
FUND_DATA_AKSHARE_ENABLED=true
|
|
12
|
+
|
|
13
|
+
# Tushare 配置(需要注册获取Token)
|
|
14
|
+
# 注册地址: https://tushare.pro/register
|
|
15
|
+
FUND_DATA_TUSHARE_TOKEN=your_tushare_token_here
|
|
16
|
+
|
|
17
|
+
# Wind 配置(商业数据源,需要授权)
|
|
18
|
+
FUND_DATA_WIND_ENABLED=false
|
|
19
|
+
FUND_DATA_WIND_USERNAME=
|
|
20
|
+
FUND_DATA_WIND_PASSWORD=
|
|
21
|
+
|
|
22
|
+
# 数据缓存配置
|
|
23
|
+
FUND_DATA_CACHE_TTL=3600
|
|
24
|
+
FUND_DATA_CACHE_DIR=~/.fund_cli/cache
|
|
25
|
+
|
|
26
|
+
# -------------------------------------------
|
|
27
|
+
# AI 配置 (V2.0 功能)
|
|
28
|
+
# -------------------------------------------
|
|
29
|
+
|
|
30
|
+
# LLM 提供商: openai, anthropic, azure, etc.
|
|
31
|
+
FUND_AI_PROVIDER=openai
|
|
32
|
+
|
|
33
|
+
# 模型选择
|
|
34
|
+
FUND_AI_MODEL=gpt-4
|
|
35
|
+
|
|
36
|
+
# API Key
|
|
37
|
+
FUND_AI_API_KEY=your_api_key_here
|
|
38
|
+
|
|
39
|
+
# API Base URL (可选,用于代理或私有部署)
|
|
40
|
+
# FUND_AI_API_BASE=https://api.openai.com/v1
|
|
41
|
+
|
|
42
|
+
# 模型参数
|
|
43
|
+
FUND_AI_TEMPERATURE=0.7
|
|
44
|
+
FUND_AI_MAX_TOKENS=2000
|
|
45
|
+
|
|
46
|
+
# -------------------------------------------
|
|
47
|
+
# 分析配置
|
|
48
|
+
# -------------------------------------------
|
|
49
|
+
|
|
50
|
+
# 无风险利率(用于夏普比率等计算)
|
|
51
|
+
FUND_ANALYSIS_RISK_FREE_RATE=0.03
|
|
52
|
+
|
|
53
|
+
# 默认基准指数代码
|
|
54
|
+
FUND_ANALYSIS_DEFAULT_BENCHMARK=000300
|
|
55
|
+
|
|
56
|
+
# 分析周期默认值
|
|
57
|
+
FUND_ANALYSIS_DEFAULT_PERIOD=1y
|
|
58
|
+
|
|
59
|
+
# -------------------------------------------
|
|
60
|
+
# 日志配置
|
|
61
|
+
# -------------------------------------------
|
|
62
|
+
|
|
63
|
+
# 日志级别: DEBUG, INFO, WARNING, ERROR
|
|
64
|
+
FUND_LOG_LEVEL=INFO
|
|
65
|
+
|
|
66
|
+
# 日志文件路径
|
|
67
|
+
# FUND_LOG_FILE=~/.fund_cli/logs/fund-cli.log
|
|
68
|
+
|
|
69
|
+
# -------------------------------------------
|
|
70
|
+
# 开发配置
|
|
71
|
+
# -------------------------------------------
|
|
72
|
+
|
|
73
|
+
# 调试模式
|
|
74
|
+
FUND_DEBUG=false
|
|
75
|
+
|
|
76
|
+
# 开发模式(跳过缓存等)
|
|
77
|
+
FUND_DEV_MODE=false
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
*.egg-info/
|
|
24
|
+
.installed.cfg
|
|
25
|
+
*.egg
|
|
26
|
+
|
|
27
|
+
# PyInstaller
|
|
28
|
+
*.manifest
|
|
29
|
+
*.spec
|
|
30
|
+
|
|
31
|
+
# Installer logs
|
|
32
|
+
pip-log.txt
|
|
33
|
+
pip-delete-this-directory.txt
|
|
34
|
+
|
|
35
|
+
# Unit test / coverage reports
|
|
36
|
+
htmlcov/
|
|
37
|
+
.tox/
|
|
38
|
+
.nox/
|
|
39
|
+
.coverage
|
|
40
|
+
.coverage.*
|
|
41
|
+
.cache
|
|
42
|
+
nosetests.xml
|
|
43
|
+
coverage.xml
|
|
44
|
+
*.cover
|
|
45
|
+
*.py,cover
|
|
46
|
+
.hypothesis/
|
|
47
|
+
.pytest_cache/
|
|
48
|
+
|
|
49
|
+
# Translations
|
|
50
|
+
*.mo
|
|
51
|
+
*.pot
|
|
52
|
+
|
|
53
|
+
# Environments
|
|
54
|
+
.env
|
|
55
|
+
.venv
|
|
56
|
+
env/
|
|
57
|
+
venv/
|
|
58
|
+
ENV/
|
|
59
|
+
env.bak/
|
|
60
|
+
venv.bak/
|
|
61
|
+
|
|
62
|
+
# IDE
|
|
63
|
+
.idea/
|
|
64
|
+
.vscode/
|
|
65
|
+
*.swp
|
|
66
|
+
*.swo
|
|
67
|
+
*~
|
|
68
|
+
.project
|
|
69
|
+
.pydevproject
|
|
70
|
+
.settings/
|
|
71
|
+
|
|
72
|
+
# Jupyter Notebook
|
|
73
|
+
.ipynb_checkpoints
|
|
74
|
+
|
|
75
|
+
# pyenv
|
|
76
|
+
.python-version
|
|
77
|
+
|
|
78
|
+
# mypy
|
|
79
|
+
.mypy_cache/
|
|
80
|
+
.dmypy.json
|
|
81
|
+
dmypy.json
|
|
82
|
+
|
|
83
|
+
# ruff
|
|
84
|
+
.ruff_cache/
|
|
85
|
+
|
|
86
|
+
# OS
|
|
87
|
+
.DS_Store
|
|
88
|
+
Thumbs.db
|
|
89
|
+
|
|
90
|
+
# Project specific
|
|
91
|
+
*.log
|
|
92
|
+
*.tmp
|
|
93
|
+
.cache/
|
|
94
|
+
data/cache/
|
|
95
|
+
*.xlsx
|
|
96
|
+
*.csv
|
|
97
|
+
!tests/fixtures/*.csv
|
|
98
|
+
|
|
99
|
+
# Secrets
|
|
100
|
+
*.pem
|
|
101
|
+
*.key
|
|
102
|
+
secrets.yaml
|
|
103
|
+
secrets.json
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Pre-commit hooks configuration
|
|
2
|
+
# See https://pre-commit.com for more information
|
|
3
|
+
|
|
4
|
+
repos:
|
|
5
|
+
# General hooks
|
|
6
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
7
|
+
rev: v4.5.0
|
|
8
|
+
hooks:
|
|
9
|
+
- id: trailing-whitespace
|
|
10
|
+
- id: end-of-file-fixer
|
|
11
|
+
- id: check-yaml
|
|
12
|
+
args: [--unsafe]
|
|
13
|
+
- id: check-toml
|
|
14
|
+
- id: check-json
|
|
15
|
+
- id: check-added-large-files
|
|
16
|
+
args: ['--maxkb=1000']
|
|
17
|
+
- id: check-merge-conflict
|
|
18
|
+
- id: check-case-conflict
|
|
19
|
+
- id: detect-private-key
|
|
20
|
+
|
|
21
|
+
# Python code formatting
|
|
22
|
+
- repo: https://github.com/psf/black
|
|
23
|
+
rev: 23.12.1
|
|
24
|
+
hooks:
|
|
25
|
+
- id: black
|
|
26
|
+
language_version: python3.10
|
|
27
|
+
|
|
28
|
+
# Linting
|
|
29
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
30
|
+
rev: v0.1.9
|
|
31
|
+
hooks:
|
|
32
|
+
- id: ruff
|
|
33
|
+
args: [--fix, --exit-non-zero-on-fix]
|
|
34
|
+
|
|
35
|
+
# Type checking
|
|
36
|
+
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
37
|
+
rev: v1.7.1
|
|
38
|
+
hooks:
|
|
39
|
+
- id: mypy
|
|
40
|
+
additional_dependencies:
|
|
41
|
+
- pydantic>=2.5.0
|
|
42
|
+
- types-PyYAML
|
|
43
|
+
- pandas-stubs
|
|
44
|
+
args: [--ignore-missing-imports]
|
|
45
|
+
|
|
46
|
+
# Security checks
|
|
47
|
+
- repo: https://github.com/PyCQA/bandit
|
|
48
|
+
rev: 1.7.6
|
|
49
|
+
hooks:
|
|
50
|
+
- id: bandit
|
|
51
|
+
args: ["-c", "pyproject.toml"]
|
|
52
|
+
additional_dependencies: ["bandit[toml]"]
|
|
53
|
+
|
|
54
|
+
# CI configuration
|
|
55
|
+
ci:
|
|
56
|
+
autofix_commit_msg: |
|
|
57
|
+
[pre-commit.ci] auto fixes from pre-commit.com hooks
|
|
58
|
+
for more information, see https://pre-commit.ci
|
|
59
|
+
autofix_prs: true
|
|
60
|
+
autoupdate_branch: ''
|
|
61
|
+
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
|
|
62
|
+
autoupdate_schedule: weekly
|
|
63
|
+
skip: []
|
|
64
|
+
submodules: false
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
所有重要的变更都将记录在此文件中。
|
|
4
|
+
|
|
5
|
+
格式基于 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.0.0/),
|
|
6
|
+
并且本项目遵循 [语义化版本](https://semver.org/lang/zh-CN/)。
|
|
7
|
+
|
|
8
|
+
## [2.0.0] - 2026-05-08
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- AI辅助分析功能(V2.0核心特性)
|
|
12
|
+
- 支持OpenAI、阿里云Qwen等LLM提供商
|
|
13
|
+
- 基金摘要生成、对比分析、投资建议、风险评估
|
|
14
|
+
- 可配置API参数,切换方便
|
|
15
|
+
- 持仓分析模块
|
|
16
|
+
- 持仓查询、行业分布分析
|
|
17
|
+
- 重仓股分析、持仓集中度(HHI)
|
|
18
|
+
- 持仓变化追踪、风格分析(九宫格)
|
|
19
|
+
- 基金经理分析
|
|
20
|
+
- 经理信息查询、业绩统计
|
|
21
|
+
- 稳定性评估
|
|
22
|
+
- 组合优化功能
|
|
23
|
+
- 均值-方差优化、最大夏普比率优化
|
|
24
|
+
- 风险平价优化、有效前沿计算
|
|
25
|
+
- 组合回测功能
|
|
26
|
+
- 业绩归因模块
|
|
27
|
+
- Brinson归因模型
|
|
28
|
+
- 收益分解、风险归因
|
|
29
|
+
- 监控预警功能
|
|
30
|
+
- 监控池管理、净值变动监控
|
|
31
|
+
- 预警规则设置、通知功能
|
|
32
|
+
- 交互式模式
|
|
33
|
+
- REPL风格交互界面
|
|
34
|
+
- 命令自动补全
|
|
35
|
+
|
|
36
|
+
### Changed
|
|
37
|
+
- 重构数据层架构,支持多数据源适配器
|
|
38
|
+
- 优化缓存机制,提升数据获取性能
|
|
39
|
+
- 改进CLI界面,使用Rich库增强输出效果
|
|
40
|
+
- 增强基金筛选功能,支持高级表达式
|
|
41
|
+
- 增强基金分析功能,支持滚动窗口、月度分布、情景分析
|
|
42
|
+
|
|
43
|
+
### Fixed
|
|
44
|
+
- 修复大数据集下的内存占用问题
|
|
45
|
+
- 修复时区处理不一致问题
|
|
46
|
+
|
|
47
|
+
## [1.0.0] - 2024-XX-XX
|
|
48
|
+
|
|
49
|
+
### Added
|
|
50
|
+
- 初始版本发布
|
|
51
|
+
- 基础基金筛选功能
|
|
52
|
+
- 业绩分析功能(收益率、夏普比率、最大回撤等)
|
|
53
|
+
- 基金对比功能
|
|
54
|
+
- 数据管理功能(多数据源、缓存、导出)
|
|
55
|
+
- 系统配置功能
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# 贡献指南
|
|
2
|
+
|
|
3
|
+
感谢您对Fund CLI项目的关注!
|
|
4
|
+
|
|
5
|
+
## 开发环境搭建
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# 克隆仓库
|
|
9
|
+
git clone https://github.com/your-org/fund-cli.git
|
|
10
|
+
cd fund-cli
|
|
11
|
+
|
|
12
|
+
# 创建虚拟环境
|
|
13
|
+
python -m venv .venv
|
|
14
|
+
source .venv/bin/activate # Linux/macOS
|
|
15
|
+
# 或 .venv\Scripts\activate # Windows
|
|
16
|
+
|
|
17
|
+
# 安装开发依赖
|
|
18
|
+
pip install -e ".[dev]"
|
|
19
|
+
|
|
20
|
+
# 安装pre-commit钩子
|
|
21
|
+
pre-commit install
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## 代码提交规范
|
|
25
|
+
|
|
26
|
+
我们使用 [Conventional Commits](https://www.conventionalcommits.org/) 规范:
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
<type>(<scope>): <subject>
|
|
30
|
+
|
|
31
|
+
<body>
|
|
32
|
+
|
|
33
|
+
<footer>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### 类型说明
|
|
37
|
+
|
|
38
|
+
- `feat`: 新功能
|
|
39
|
+
- `fix`: 修复bug
|
|
40
|
+
- `docs`: 文档更新
|
|
41
|
+
- `style`: 代码格式调整(不影响功能)
|
|
42
|
+
- `refactor`: 代码重构
|
|
43
|
+
- `test`: 测试相关
|
|
44
|
+
- `chore`: 构建/工具相关
|
|
45
|
+
|
|
46
|
+
### 示例
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
feat(ai): add Qwen provider support
|
|
50
|
+
|
|
51
|
+
Add Alibaba Cloud Qwen LLM provider for AI analysis.
|
|
52
|
+
Supports qwen-max, qwen-plus, and qwen-turbo models.
|
|
53
|
+
|
|
54
|
+
Closes #123
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## 代码审查流程
|
|
58
|
+
|
|
59
|
+
1. Fork 仓库
|
|
60
|
+
2. 创建功能分支 (`git checkout -b feature/amazing-feature`)
|
|
61
|
+
3. 提交变更 (`git commit -m 'feat: add amazing feature'`)
|
|
62
|
+
4. 推送分支 (`git push origin feature/amazing-feature`)
|
|
63
|
+
5. 创建 Pull Request
|
|
64
|
+
|
|
65
|
+
## 测试要求
|
|
66
|
+
|
|
67
|
+
- 新功能必须包含单元测试
|
|
68
|
+
- 测试覆盖率不得低于80%
|
|
69
|
+
- 所有测试必须通过
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
# 运行测试
|
|
73
|
+
pytest tests/ -v
|
|
74
|
+
|
|
75
|
+
# 运行测试并检查覆盖率
|
|
76
|
+
pytest tests/ --cov=src/fund_cli --cov-report=html
|
|
77
|
+
|
|
78
|
+
# 代码格式化
|
|
79
|
+
black src tests --line-length=100
|
|
80
|
+
|
|
81
|
+
# 代码检查
|
|
82
|
+
ruff check src tests
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## 问题反馈
|
|
86
|
+
|
|
87
|
+
如果您发现了bug或有功能建议,请通过以下方式反馈:
|
|
88
|
+
|
|
89
|
+
1. 查看现有Issue,避免重复提交
|
|
90
|
+
2. 创建新Issue,详细描述问题
|
|
91
|
+
3. 对于bug,请提供复现步骤和环境信息
|
|
92
|
+
|
|
93
|
+
## 许可证
|
|
94
|
+
|
|
95
|
+
通过贡献代码,您同意您的贡献将在MIT许可证下发布。
|
fund_cli-2.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Fund CLI Team
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
fund_cli-2.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: fund-cli
|
|
3
|
+
Version: 2.0.0
|
|
4
|
+
Summary: 专业基金分析CLI工具 - 面向机构客户
|
|
5
|
+
Project-URL: Homepage, https://github.com/your-org/fund-cli
|
|
6
|
+
Project-URL: Documentation, https://fund-cli.readthedocs.io
|
|
7
|
+
Project-URL: Repository, https://github.com/your-org/fund-cli
|
|
8
|
+
Author: Fund CLI Team
|
|
9
|
+
License: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: analysis,cli,finance,fund,investment,quant
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Financial and Insurance Industry
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Topic :: Office/Business :: Financial :: Investment
|
|
19
|
+
Classifier: Topic :: Terminals
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Requires-Dist: akshare>=1.12.0
|
|
22
|
+
Requires-Dist: diskcache>=5.6.0
|
|
23
|
+
Requires-Dist: httpx>=0.25.0
|
|
24
|
+
Requires-Dist: litellm>=1.20.0
|
|
25
|
+
Requires-Dist: matplotlib>=3.8.0
|
|
26
|
+
Requires-Dist: numpy>=1.24.0
|
|
27
|
+
Requires-Dist: pandas>=2.0.0
|
|
28
|
+
Requires-Dist: plotly>=5.18.0
|
|
29
|
+
Requires-Dist: prompt-toolkit>=3.0.0
|
|
30
|
+
Requires-Dist: pydantic-settings>=2.1.0
|
|
31
|
+
Requires-Dist: pydantic>=2.5.0
|
|
32
|
+
Requires-Dist: pyportfolioopt>=1.5.0
|
|
33
|
+
Requires-Dist: python-dateutil>=2.8.0
|
|
34
|
+
Requires-Dist: pyyaml>=6.0
|
|
35
|
+
Requires-Dist: quantstats>=0.0.62
|
|
36
|
+
Requires-Dist: rich>=13.0.0
|
|
37
|
+
Requires-Dist: tushare>=1.4.0
|
|
38
|
+
Requires-Dist: typer[all]>=0.9.0
|
|
39
|
+
Provides-Extra: dev
|
|
40
|
+
Requires-Dist: black>=23.0.0; extra == 'dev'
|
|
41
|
+
Requires-Dist: mypy>=1.7.0; extra == 'dev'
|
|
42
|
+
Requires-Dist: pandas-stubs>=2.0.0; extra == 'dev'
|
|
43
|
+
Requires-Dist: pre-commit>=3.5.0; extra == 'dev'
|
|
44
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
|
|
45
|
+
Requires-Dist: pytest-cov>=4.1.0; extra == 'dev'
|
|
46
|
+
Requires-Dist: pytest>=7.4.0; extra == 'dev'
|
|
47
|
+
Requires-Dist: ruff>=0.1.0; extra == 'dev'
|
|
48
|
+
Requires-Dist: types-pyyaml>=6.0.0; extra == 'dev'
|
|
49
|
+
Provides-Extra: docs
|
|
50
|
+
Requires-Dist: mkdocs-material>=9.4.0; extra == 'docs'
|
|
51
|
+
Requires-Dist: mkdocs>=1.5.0; extra == 'docs'
|
|
52
|
+
Requires-Dist: mkdocstrings[python]>=0.23.0; extra == 'docs'
|
|
53
|
+
Description-Content-Type: text/markdown
|
|
54
|
+
|
|
55
|
+
# Fund CLI
|
|
56
|
+
|
|
57
|
+
<div align="center">
|
|
58
|
+
|
|
59
|
+
**专业基金分析CLI工具 - 面向机构客户**
|
|
60
|
+
|
|
61
|
+
[](https://www.python.org/downloads/)
|
|
62
|
+
[](https://opensource.org/licenses/MIT)
|
|
63
|
+
[](https://github.com/psf/black)
|
|
64
|
+
|
|
65
|
+
</div>
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## 📖 简介
|
|
70
|
+
|
|
71
|
+
Fund CLI 是一款面向机构客户的专业基金分析命令行工具,提供基金筛选、业绩分析、组合对比、风险监控等功能。基于开源技术栈构建,支持多数据源接入和AI辅助分析。
|
|
72
|
+
|
|
73
|
+
## ✨ 核心功能
|
|
74
|
+
|
|
75
|
+
- 🔍 **基金筛选** - 多维度筛选条件,支持业绩、风险、规模等指标
|
|
76
|
+
- 📊 **业绩分析** - 收益率、夏普比率、最大回撤等专业指标
|
|
77
|
+
- ⚖️ **基金对比** - 多基金横向对比分析
|
|
78
|
+
- 📈 **组合优化** - 基于现代投资组合理论的资产配置优化
|
|
79
|
+
- 🤖 **AI分析** (V2.0) - AI辅助投资分析和报告生成
|
|
80
|
+
- 💾 **多数据源** - 支持AKShare、Tushare、Wind等数据源
|
|
81
|
+
|
|
82
|
+
## 🚀 快速开始
|
|
83
|
+
|
|
84
|
+
### 安装
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
# 使用 pip 安装
|
|
88
|
+
pip install fund-cli
|
|
89
|
+
|
|
90
|
+
# 或从源码安装
|
|
91
|
+
git clone https://github.com/your-org/fund-cli.git
|
|
92
|
+
cd fund-cli
|
|
93
|
+
pip install -e ".[dev]"
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### 基本使用
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
# 查看帮助
|
|
100
|
+
fund --help
|
|
101
|
+
|
|
102
|
+
# 筛选基金
|
|
103
|
+
fund filter --type 股票型 --min-scale 10
|
|
104
|
+
|
|
105
|
+
# 分析基金
|
|
106
|
+
fund analyze 000001
|
|
107
|
+
|
|
108
|
+
# 对比基金
|
|
109
|
+
fund compare 000001 000002 000003
|
|
110
|
+
|
|
111
|
+
# 查看基金信息
|
|
112
|
+
fund info 000001
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## 📚 文档
|
|
116
|
+
|
|
117
|
+
- [安装指南](docs/installation.md)
|
|
118
|
+
- [使用教程](docs/usage/)
|
|
119
|
+
- [API文档](docs/api/)
|
|
120
|
+
- [开发指南](docs/development.md)
|
|
121
|
+
|
|
122
|
+
## 🛠️ 技术栈
|
|
123
|
+
|
|
124
|
+
| 类别 | 技术 |
|
|
125
|
+
|------|------|
|
|
126
|
+
| CLI框架 | Typer, Rich |
|
|
127
|
+
| 数据处理 | Pandas, NumPy |
|
|
128
|
+
| 数据源 | AKShare, Tushare |
|
|
129
|
+
| 量化分析 | QuantStats, PyPortfolioOpt |
|
|
130
|
+
| 可视化 | Plotly, Matplotlib |
|
|
131
|
+
| AI集成 | LiteLLM |
|
|
132
|
+
|
|
133
|
+
## 📁 项目结构
|
|
134
|
+
|
|
135
|
+
```
|
|
136
|
+
fund-cli/
|
|
137
|
+
├── src/fund_cli/ # 源代码
|
|
138
|
+
│ ├── cli.py # CLI入口
|
|
139
|
+
│ ├── config.py # 配置管理
|
|
140
|
+
│ ├── core/ # 核心模块
|
|
141
|
+
│ ├── data/ # 数据层
|
|
142
|
+
│ ├── analysis/ # 分析模块
|
|
143
|
+
│ ├── commands/ # CLI命令
|
|
144
|
+
│ └── utils/ # 工具函数
|
|
145
|
+
├── tests/ # 测试代码
|
|
146
|
+
├── docs/ # 文档
|
|
147
|
+
└── examples/ # 示例脚本
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## 🧪 开发
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
# 安装开发依赖
|
|
154
|
+
pip install -e ".[dev]"
|
|
155
|
+
|
|
156
|
+
# 安装 pre-commit 钩子
|
|
157
|
+
pre-commit install
|
|
158
|
+
|
|
159
|
+
# 运行测试
|
|
160
|
+
pytest tests/
|
|
161
|
+
|
|
162
|
+
# 代码格式化
|
|
163
|
+
black src tests
|
|
164
|
+
|
|
165
|
+
# Lint检查
|
|
166
|
+
ruff check src tests
|
|
167
|
+
|
|
168
|
+
# 类型检查
|
|
169
|
+
mypy src
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## 📄 许可证
|
|
173
|
+
|
|
174
|
+
本项目采用 MIT 许可证 - 详见 [LICENSE](LICENSE) 文件。
|
|
175
|
+
|
|
176
|
+
## 🤝 贡献
|
|
177
|
+
|
|
178
|
+
欢迎贡献!请查看 [贡献指南](CONTRIBUTING.md) 了解详情。
|
|
179
|
+
|
|
180
|
+
## 📧 联系方式
|
|
181
|
+
|
|
182
|
+
- 问题反馈: [GitHub Issues](https://github.com/your-org/fund-cli/issues)
|
|
183
|
+
- 功能建议: [GitHub Discussions](https://github.com/your-org/fund-cli/discussions)
|