mirror of
https://ghfast.top/https://github.com/aeroxw/easy-tdx.git
synced 2026-09-12 14:34:15 +08:00
feat!: rename project from xmtdx to easy-tdx
- Package directory: src/xmtdx/ -> src/easy_tdx/ - Import path: from easy_tdx import ... - pip install easy-tdx - Add LICENSE (MIT) with upstream attribution (pytdx, xmtdx) - Add NOTICE with detailed attribution - Update all examples, tests, scripts, docs - Bump version to 1.0.0 BREAKING CHANGE: import path changed from `xmtdx` to `easy_tdx` Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
9c5672b4d2
commit
50491f9aae
@@ -1,7 +1,7 @@
|
||||
"""演示:异步客户端连接与基本用法。"""
|
||||
|
||||
import asyncio
|
||||
from xmtdx import AsyncTdxClient, Market, KlineCategory
|
||||
from easy_tdx import AsyncTdxClient, Market, KlineCategory
|
||||
|
||||
|
||||
async def main():
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""演示:自动从候选服务器中选延迟最低的建立连接。"""
|
||||
|
||||
from xmtdx import TdxClient, Market
|
||||
from easy_tdx import TdxClient, Market
|
||||
|
||||
# 方式一:手动指定服务器
|
||||
with TdxClient("180.153.18.170") as c:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""演示:测量多台通达信服务器延迟并排序。"""
|
||||
|
||||
import pandas as pd
|
||||
from xmtdx import TdxClient
|
||||
from easy_tdx import TdxClient
|
||||
|
||||
results = TdxClient.ping_all()
|
||||
df = pd.DataFrame(results, columns=["服务器", "延迟(s)"])
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""演示:获取全市场涨跌统计概况。"""
|
||||
|
||||
import pandas as pd
|
||||
from xmtdx import TdxClient
|
||||
from easy_tdx import TdxClient
|
||||
|
||||
with TdxClient.from_best_host() as c:
|
||||
stat = c.get_market_stat()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""演示:获取市场证券总数。"""
|
||||
|
||||
from xmtdx import TdxClient, Market
|
||||
from easy_tdx import TdxClient, Market
|
||||
|
||||
with TdxClient.from_best_host() as c:
|
||||
sh_count = c.get_security_count(Market.SH)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"""
|
||||
|
||||
import pandas as pd
|
||||
from xmtdx import TdxClient, Market
|
||||
from easy_tdx import TdxClient, Market
|
||||
|
||||
with TdxClient.from_best_host() as c:
|
||||
stocks = c.get_security_list(Market.SH, start=0)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
import logging
|
||||
import pandas as pd
|
||||
from xmtdx import TdxClient
|
||||
from easy_tdx import TdxClient
|
||||
|
||||
# 启用日志,查看分页进度
|
||||
logging.basicConfig(level=logging.INFO, format="%(message)s")
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""演示:批量获取实时五档行情。最多支持 80 只/次。"""
|
||||
|
||||
import pandas as pd
|
||||
from xmtdx import TdxClient, Market
|
||||
from easy_tdx import TdxClient, Market
|
||||
|
||||
with TdxClient.from_best_host() as c:
|
||||
stocks = [
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"""
|
||||
|
||||
import pandas as pd
|
||||
from xmtdx import TdxClient, Market, KlineCategory
|
||||
from easy_tdx import TdxClient, Market, KlineCategory
|
||||
|
||||
with TdxClient.from_best_host() as c:
|
||||
bars = c.get_index_bars(Market.SH, "999999", KlineCategory.DAY, 0, 10)
|
||||
|
||||
@@ -6,7 +6,7 @@ K 线类别:
|
||||
"""
|
||||
|
||||
import pandas as pd
|
||||
from xmtdx import TdxClient, Market, KlineCategory
|
||||
from easy_tdx import TdxClient, Market, KlineCategory
|
||||
|
||||
with TdxClient.from_best_host() as c:
|
||||
bars = c.get_security_bars(Market.SZ, "002176", KlineCategory.DAY, 0, 100)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""演示:获取历史某日分时数据。date 参数为 YYYYMMDD 格式的整数。"""
|
||||
|
||||
import pandas as pd
|
||||
from xmtdx import TdxClient, Market
|
||||
from easy_tdx import TdxClient, Market
|
||||
|
||||
with TdxClient.from_best_host() as c:
|
||||
date = 20250110
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""演示:获取今日分时数据(240 条)。"""
|
||||
|
||||
import pandas as pd
|
||||
from xmtdx import TdxClient, Market
|
||||
from easy_tdx import TdxClient, Market
|
||||
|
||||
with TdxClient.from_best_host() as c:
|
||||
bars = c.get_minute_time_data(Market.SH, "600000")
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""演示:获取历史逐笔成交数据。date 参数为 YYYYMMDD 格式的整数。"""
|
||||
|
||||
import pandas as pd
|
||||
from xmtdx import TdxClient, Market
|
||||
from easy_tdx import TdxClient, Market
|
||||
|
||||
with TdxClient.from_best_host() as c:
|
||||
date = 20250110
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""演示:获取当日逐笔成交数据。"""
|
||||
|
||||
import pandas as pd
|
||||
from xmtdx import TdxClient, Market
|
||||
from easy_tdx import TdxClient, Market
|
||||
|
||||
with TdxClient.from_best_host() as c:
|
||||
records = c.get_transaction_data(Market.SH, "600000", 0, 20)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""演示:获取公司信息目录与各个分类的详细内容。"""
|
||||
|
||||
import pandas as pd
|
||||
from xmtdx import TdxClient, Market
|
||||
from easy_tdx import TdxClient, Market
|
||||
|
||||
CODE = "600519"
|
||||
NAME = "贵州茅台"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""演示:获取最新财务数据。"""
|
||||
|
||||
import pandas as pd
|
||||
from xmtdx import TdxClient, Market
|
||||
from easy_tdx import TdxClient, Market
|
||||
|
||||
with TdxClient.from_best_host() as c:
|
||||
info = c.get_finance_info(Market.SH, "600519")
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""演示:计算个股涨跌停价格。"""
|
||||
|
||||
import pandas as pd
|
||||
from xmtdx import TdxClient, Market
|
||||
from easy_tdx import TdxClient, Market
|
||||
|
||||
CODE = "600519"
|
||||
NAME = "贵州茅台"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""演示:获取除权除息历史记录。"""
|
||||
|
||||
import pandas as pd
|
||||
from xmtdx import TdxClient, Market, XDXR_CATEGORY_NAMES
|
||||
from easy_tdx import TdxClient, Market, XDXR_CATEGORY_NAMES
|
||||
|
||||
with TdxClient.from_best_host() as c:
|
||||
records = c.get_xdxr_info(Market.SH, "600519")
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"""
|
||||
|
||||
import pandas as pd
|
||||
from xmtdx import TdxClient
|
||||
from easy_tdx import TdxClient
|
||||
|
||||
with TdxClient.from_best_host() as c:
|
||||
blocks = c.get_block_info("block_gn.dat")
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"""
|
||||
|
||||
import pandas as pd
|
||||
from xmtdx import TdxClient, Market
|
||||
from easy_tdx import TdxClient, Market
|
||||
|
||||
with TdxClient.from_best_host() as c:
|
||||
flow = c.get_fund_flow(Market.SH, "600519")
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""演示:获取个股历史日线资金流向序列。"""
|
||||
|
||||
import pandas as pd
|
||||
from xmtdx import TdxClient, Market
|
||||
from easy_tdx import TdxClient, Market
|
||||
|
||||
with TdxClient.from_best_host() as c:
|
||||
flows = c.get_history_fund_flow(Market.SH, "600519", 0, 10)
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from xmtdx import CALC_HOSTS, TdxClient
|
||||
from easy_tdx import CALC_HOSTS, TdxClient
|
||||
|
||||
OUTPUT_DIR = Path(__file__).parent / "downloads"
|
||||
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from xmtdx import TdxClient
|
||||
from xmtdx.models.finance import TdxBlock
|
||||
from xmtdx.offline import detect_tdx_home, read_block_dat, read_customer_blocks
|
||||
from easy_tdx import TdxClient
|
||||
from easy_tdx.models.finance import TdxBlock
|
||||
from easy_tdx.offline import detect_tdx_home, read_block_dat, read_customer_blocks
|
||||
|
||||
|
||||
def _print_blocks(blocks: list[TdxBlock], title: str) -> None:
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
需要本地已安装通达信并下载过日线数据。
|
||||
"""
|
||||
|
||||
from xmtdx.offline import detect_tdx_home, read_daily_bars, find_daily_bar_file
|
||||
from xmtdx import Market
|
||||
from easy_tdx.offline import detect_tdx_home, read_daily_bars, find_daily_bar_file
|
||||
from easy_tdx import Market
|
||||
|
||||
home = detect_tdx_home()
|
||||
if home is None:
|
||||
|
||||
@@ -18,9 +18,9 @@ vipdoc 目录结构:
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
from xmtdx.offline import detect_tdx_home, resolve_vipdoc
|
||||
from xmtdx.offline import find_daily_bar_file, find_5min_bar_file, find_lc1_bar_file
|
||||
from xmtdx import Market
|
||||
from easy_tdx.offline import detect_tdx_home, resolve_vipdoc
|
||||
from easy_tdx.offline import find_daily_bar_file, find_5min_bar_file, find_lc1_bar_file
|
||||
from easy_tdx import Market
|
||||
|
||||
# --- 检测安装目录 ---
|
||||
print("=" * 60)
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from xmtdx.offline import detect_tdx_home, read_ex_daily_bars
|
||||
from easy_tdx.offline import detect_tdx_home, read_ex_daily_bars
|
||||
|
||||
home = detect_tdx_home()
|
||||
if home is None:
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from xmtdx.offline import detect_tdx_home, read_gbbq
|
||||
from easy_tdx.offline import detect_tdx_home, read_gbbq
|
||||
|
||||
home = detect_tdx_home()
|
||||
if home is None:
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from xmtdx.offline import detect_tdx_home, read_history_financial
|
||||
from easy_tdx.offline import detect_tdx_home, read_history_financial
|
||||
|
||||
home = detect_tdx_home()
|
||||
if home is None:
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
需要本地已安装通达信并下载过分钟数据。
|
||||
"""
|
||||
|
||||
from xmtdx.offline import (
|
||||
from easy_tdx.offline import (
|
||||
detect_tdx_home,
|
||||
read_5min_bars,
|
||||
read_lc_min_bars,
|
||||
@@ -16,7 +16,7 @@ from xmtdx.offline import (
|
||||
find_lc1_bar_file,
|
||||
find_lc5_bar_file,
|
||||
)
|
||||
from xmtdx import Market
|
||||
from easy_tdx import Market
|
||||
|
||||
home = detect_tdx_home()
|
||||
if home is None:
|
||||
|
||||
Reference in New Issue
Block a user