docs: update README to reflect merged datetime fields in DataFrame output

This commit is contained in:
Justin Gu
2026-05-22 04:22:27 +08:00
parent 02701952ca
commit d7547f7c4c
3 changed files with 21 additions and 26 deletions
+6 -6
View File
@@ -97,6 +97,12 @@
"lastAccessed": 1779392745160,
"type": "file"
},
{
"path": "README.md",
"accessCount": 16,
"lastAccessed": 1779394894399,
"type": "file"
},
{
"path": "src\\easy_tdx\\_df.py",
"accessCount": 12,
@@ -307,12 +313,6 @@
"lastAccessed": 1779389346769,
"type": "directory"
},
{
"path": "README.md",
"accessCount": 2,
"lastAccessed": 1779394525974,
"type": "file"
},
{
"path": "src\\xmtdx\\__init__.py",
"accessCount": 1,
+1 -1
View File
@@ -1 +1 @@
{"session_id":"84b721c5-06e3-4191-ae03-5f4795cf33f3","transcript_path":"C:\\Users\\毛利哥\\.claude\\projects\\D--python-easty-tdx\\84b721c5-06e3-4191-ae03-5f4795cf33f3.jsonl","cwd":"D:\\python\\easty_tdx","effort":{"level":"medium"},"session_name":"merge-datetime-fields-to-columns","model":{"id":"glm-5.1","display_name":"glm-5.1"},"workspace":{"current_dir":"D:\\python\\easty_tdx","project_dir":"D:\\python\\easty_tdx","added_dirs":[],"repo":{"host":"github.com","owner":"handsomejustin","name":"easy_tdx"}},"version":"2.1.145","output_style":{"name":"default"},"cost":{"total_cost_usd":18.830824000000014,"total_duration_ms":10105688,"total_api_duration_ms":4443330,"total_lines_added":725,"total_lines_removed":703},"context_window":{"total_input_tokens":72969,"total_output_tokens":175,"context_window_size":200000,"current_usage":{"input_tokens":201,"output_tokens":175,"cache_creation_input_tokens":0,"cache_read_input_tokens":72768},"used_percentage":36,"remaining_percentage":64},"exceeds_200k_tokens":false,"fast_mode":false,"thinking":{"enabled":true}}
{"session_id":"84b721c5-06e3-4191-ae03-5f4795cf33f3","transcript_path":"C:\\Users\\毛利哥\\.claude\\projects\\D--python-easty-tdx\\84b721c5-06e3-4191-ae03-5f4795cf33f3.jsonl","cwd":"D:\\python\\easty_tdx","effort":{"level":"medium"},"session_name":"merge-datetime-fields-to-columns","model":{"id":"glm-5.1","display_name":"glm-5.1"},"workspace":{"current_dir":"D:\\python\\easty_tdx","project_dir":"D:\\python\\easty_tdx","added_dirs":[],"repo":{"host":"github.com","owner":"handsomejustin","name":"easy_tdx"}},"version":"2.1.145","output_style":{"name":"default"},"cost":{"total_cost_usd":19.846790000000016,"total_duration_ms":10309483,"total_api_duration_ms":4524776,"total_lines_added":739,"total_lines_removed":722},"context_window":{"total_input_tokens":88458,"total_output_tokens":37,"context_window_size":200000,"current_usage":{"input_tokens":3722,"output_tokens":37,"cache_creation_input_tokens":0,"cache_read_input_tokens":84736},"used_percentage":44,"remaining_percentage":56},"exceeds_200k_tokens":false,"fast_mode":false,"thinking":{"enabled":true}}
+14 -19
View File
@@ -45,11 +45,10 @@ with TdxClient("180.153.18.170") as c:
# 自动优选最低延迟服务器
with TdxClient.from_best_host() as c:
bars = c.get_security_bars(Market.SH, "600000", KlineCategory.DAY, 0, 5)
for b in bars:
print(f"{b.year}-{b.month:02d}-{b.day:02d} "
f"开:{b.open:.2f} 高:{b.high:.2f} "
f"低:{b.low:.2f} 收:{b.close:.2f}")
df = c.get_security_bars(Market.SH, "600000", KlineCategory.DAY, 0, 5)
print(df.to_string(index=False))
# date open close high low vol amount
# 2025-01-02 10.25 10.12 10.25 10.08 108154752.0 1.078280e+09
```
### asyncio
@@ -60,13 +59,10 @@ from easy_tdx import AsyncTdxClient, Market, KlineCategory
async def main():
async with AsyncTdxClient.from_best_host() as c:
bars = await c.get_security_bars(
df = await c.get_security_bars(
Market.SH, "600000", KlineCategory.DAY, 0, 5
)
for bar in bars:
print(f"{bar.year}-{bar.month:02d}-{bar.day:02d} "
f"开:{bar.open:.2f} 高:{bar.high:.2f} "
f"低:{bar.low:.2f} 收:{bar.close:.2f}")
print(df.to_string(index=False))
asyncio.run(main())
```
@@ -143,7 +139,7 @@ KlineCategory.MIN_1 MIN_5 MIN_15 MIN_30 MIN_60
KlineCategory.DAY WEEK MONTH YEAR
```
K 线字段:`open` `close` `high` `low` `vol` `amount` `year` `month` `day` `hour` `minute` `_raw`
K 线字段:`date`(日线及以上)或 `datetime`(分钟线) `open` `close` `high` `low` `vol` `amount`
### 分时数据
@@ -156,7 +152,7 @@ with TdxClient.from_best_host() as c:
bars = c.get_history_minute_time_data(Market.SH, "600000", 20250110)
```
分时字段:`price` `vol` `unknown_1`(原 pytdx 丢弃字段,保留供分析)`_raw`
分时字段:`datetime` `price` `vol`
### 逐笔成交
@@ -169,7 +165,7 @@ with TdxClient.from_best_host() as c:
records = c.get_history_transaction_data(Market.SH, "600000", 20250110, 0, 20)
```
成交字段:`hour` `minute` `price` `vol` `buyorsell`0=买, 1=卖, 2=中性, 8=集合竞价)`unknown_last` `_raw`
成交字段:`datetime` `price` `vol` `buyorsell`0=买, 1=卖, 2=中性, 8=集合竞价)
### 财务与公司信息
@@ -225,7 +221,7 @@ with TdxClient.from_best_host() as c:
# 历史日线资金流向序列
flows = c.get_history_fund_flow(Market.SH, "600519", 0, 10)
# flows[0].year / .month / .day / .super_in / .main_net_inflow
# flows[0].date / .super_in / .main_net_inflow
```
### 文件下载
@@ -475,9 +471,8 @@ vipdoc/
### SecurityBarK 线)
```
date(日线及以上)或 datetime(分钟线)
open close high low vol amount
year month day hour minute
_raw
```
### SecurityQuote(实时行情)
@@ -503,19 +498,19 @@ industry_tdx industry_sw
### MinuteBar(分时)
```
price vol unknown_1 _raw
datetime price vol
```
### TransactionRecord(逐笔成交)
```
hour minute price vol buyorsell unknown_last _raw
datetime price vol buyorsell
```
### XdxrRecord(除权除息)
```
market code year month day category name
date market code category name
fenhong peigujia songzhuangu peigu suogu
xingquanjia fenshu
panqian_liutong panhou_liutong # 万股