Sources: extracted from two upstream archives (skill-repo, skills-main),
merged with the following policy:
- 15 broken symlinks (pointing to /Users/jameslee/.cc-switch/skills or
../../.agents/skills on a foreign machine) discarded
- 3 real name collisions with identical content (ai-pair, ifind-http-api,
zhipu-websearch) kept as one copy
- Functional overlaps deduped keeping the strongest variant:
- docx family: kept docx (official, full toolchain) + docx-cn
(GB/T 9704 Chinese official-document constants),
dropped docx_writer (no scripts, name collided with docx)
- humanizer family: kept humanizer-zh (6 zh reference docs),
dropped humanizer (en, redundant for CN workflow)
- Skills that only ran in a foreign environment removed:
ablemind-ops, app-publish, hlb-design-system, openclaw-adj-skill,
claude-driver
- alphapai excluded from this public repo because its SKILL.md hard-coded
live credentials
Result: 25 skills, 572 files, ~7.5 MB.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
89 lines
2.3 KiB
Python
89 lines
2.3 KiB
Python
#!/usr/bin/env python3
|
||
# -*- coding: utf-8 -*-
|
||
"""
|
||
基金数据获取示例脚本
|
||
"""
|
||
|
||
import tushare as ts
|
||
import pandas as pd
|
||
import os
|
||
|
||
# 设置tushare API密钥
|
||
# 请在使用前设置您的API密钥, tushare>=1.4.25 版本 支持从环境变量中获取 TUSHARE_TOKEN。
|
||
# ts.set_token('your_token_here')
|
||
|
||
# 初始化pro接口
|
||
pro = ts.pro_api()
|
||
|
||
|
||
def get_fund_list():
|
||
"""
|
||
获取基金列表
|
||
"""
|
||
try:
|
||
data = pro.fund_basic(market='E', status='L', fields='ts_code,fund_name,fund_type,found_date,issue_date,delist_date')
|
||
print("基金列表获取成功:")
|
||
print(data.head())
|
||
return data
|
||
except Exception as e:
|
||
print(f"获取基金列表失败:{e}")
|
||
return None
|
||
|
||
|
||
def get_fund_nav(ts_code, start_date, end_date):
|
||
"""
|
||
获取基金净值数据
|
||
"""
|
||
try:
|
||
data = pro.fund_nav(ts_code=ts_code, start_date=start_date, end_date=end_date)
|
||
print(f"{ts_code}基金净值数据获取成功:")
|
||
print(data.head())
|
||
return data
|
||
except Exception as e:
|
||
print(f"获取基金净值数据失败:{e}")
|
||
return None
|
||
|
||
|
||
def get_fund_manager():
|
||
"""
|
||
获取基金经理数据
|
||
"""
|
||
try:
|
||
data = pro.fund_manager(limit=10, fields='ts_code,fund_name,manager_name,begin_date,end_date')
|
||
print("基金经理数据获取成功:")
|
||
print(data.head())
|
||
return data
|
||
except Exception as e:
|
||
print(f"获取基金经理数据失败:{e}")
|
||
return None
|
||
|
||
|
||
def main():
|
||
"""
|
||
主函数
|
||
"""
|
||
print("===== tushare 基金数据获取示例 =====")
|
||
|
||
# 获取基金列表
|
||
fund_list = get_fund_list()
|
||
|
||
if fund_list is not None:
|
||
# 获取第一只基金的代码
|
||
ts_code = fund_list['ts_code'].iloc[0]
|
||
print(f"\n使用基金代码:{ts_code}")
|
||
|
||
# 获取基金净值数据(最近30天)
|
||
import datetime
|
||
end_date = datetime.datetime.now().strftime('%Y%m%d')
|
||
start_date = (datetime.datetime.now() - datetime.timedelta(days=30)).strftime('%Y%m%d')
|
||
print(f"\n获取基金净值数据:{start_date} 至 {end_date}")
|
||
get_fund_nav(ts_code, start_date, end_date)
|
||
|
||
# 获取基金经理数据
|
||
print("\n获取基金经理数据:")
|
||
get_fund_manager()
|
||
|
||
|
||
if __name__ == "__main__":
|
||
main()
|