← スキル一覧に戻る

tushare-duckdb
by tycallen
🚀 A high-performance, locally-cached 💾 Tushare 📈 data interface powered by 🦆 DuckDB
⭐ 8🍴 2📅 2026年1月24日
SKILL.md
name: tushare-duckdb description: Query Chinese stock data from local DuckDB cache. Use when user wants local data access instead of direct Tushare API calls.
tushare-duckdb
Local DuckDB cache layer for Tushare Pro data. For API parameter details, use /tushare-finance <api_name>.
Quick Start
Read Data (no network, concurrent-safe)
from tushare_db import DataReader
reader = DataReader(db_path="tushare.db")
# Single stock with forward adjustment
df = reader.get_stock_daily('000001.SZ', '20240101', adj='qfq')
# Multiple stocks
df = reader.get_multiple_stocks_daily(['000001.SZ', '600519.SH'], '20240101')
# Trade calendar
df = reader.get_trade_calendar('20240101', '20241231')
# Stock list
df = reader.get_stock_basic(list_status='L')
# Custom SQL
df = reader.query("SELECT * FROM daily WHERE ts_code = ?", ['000001.SZ'])
reader.close()
Download Data (requires TUSHARE_TOKEN env var)
from tushare_db import DataDownloader
downloader = DataDownloader(db_path="tushare.db", rate_limit_profile="standard")
# Basic data
downloader.download_trade_calendar()
downloader.download_stock_basic()
# Daily data for all stocks
downloader.download_all_stocks_daily(start_date='20200101')
# Daily update (single date)
downloader.download_daily_data_by_date('20241218')
downloader.close()
Key Notes
- Date format:
YYYYMMDDstring (e.g.,'20240101') - Adjustment types:
adj_factortable stores raw Tushare adjustment factorsqfq(forward):price * (factor / latest_factor)— latest price = market pricehfq(backward):price * factor— historical prices stay fixed- DataReader handles calculation automatically via
adj='qfq'oradj='hfq'
- Rate limit profiles:
'trial','standard','pro'
Implemented Tables
| Table | Tushare API | Primary Keys | Fixed/Default Params |
|---|---|---|---|
trade_cal | trade_cal | exchange, cal_date | exchange='SSE' |
stock_basic | stock_basic | ts_code | — |
stock_company | stock_company | ts_code | — |
daily | daily | ts_code, trade_date | asset='E' (stocks), 'I' (index) |
adj_factor | adj_factor | ts_code, trade_date | — |
daily_basic | daily_basic | ts_code, trade_date | — |
index_basic | index_basic | ts_code | — |
index_classify | index_classify | industry_code | src='SW2021' |
index_member_all | index_member_all | ts_code, l3_code, in_date | — |
index_weight | index_weight | index_code, trade_date, con_code | — |
cyq_perf | cyq_perf | ts_code, trade_date | — |
stk_factor_pro | stk_factor_pro | ts_code, trade_date | — |
moneyflow | moneyflow | ts_code, trade_date | — |
moneyflow_dc | moneyflow_dc | ts_code, trade_date | — |
dc_index | dc_index | ts_code, trade_date | — |
dc_member | dc_member | ts_code, trade_date, con_code | — |
fina_indicator_vip | fina_indicator_vip | ts_code, end_date | — |
income | income / income_vip | ts_code, end_date, report_type | — |
balancesheet | balancesheet / balancesheet_vip | ts_code, end_date, report_type | — |
cashflow | cashflow / cashflow_vip | ts_code, end_date, report_type | — |
dividend | dividend | ts_code, end_date | — |
margin_detail | margin_detail | ts_code, trade_date | — |
hs_const | hs_const | ts_code, in_date | — |
For column details and parameter meanings, invoke /tushare-finance <api_name>.
スコア
総合スコア
60/100
リポジトリの品質指標に基づく評価
✓SKILL.md
SKILL.mdファイルが含まれている
+20
✓LICENSE
ライセンスが設定されている
+10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
レビュー
💬
レビュー機能は近日公開予定です