mirror of
https://ghfast.top/https://github.com/aeroxw/easy-tdx.git
synced 2026-09-12 18:04:16 +08:00
feat: merge datetime fields in DataFrame output, hide MinuteBar internal fields
- K-line: daily+ periods output 'date' only, minute periods output 'datetime' - Transactions (tick-by-tick): combine date param + hour/minute into 'datetime' - XdxrRecord, HistoricalFundFlow: year/month/day merged to 'date' - MinuteBar: rename unknown_1 to _unknown_1 (hidden from DataFrame) - MinuteBar: add datetime column computed from bar index (A-share 240-bar pattern) - get_minute_time_data: use history endpoint only (current-day endpoint broken in pytdx too) - Update all examples to reflect new DataFrame column names
This commit is contained in:
@@ -1,15 +1,9 @@
|
||||
"""演示:获取历史某日分时数据。date 参数为 YYYYMMDD 格式的整数。"""
|
||||
|
||||
import pandas as pd
|
||||
from easy_tdx import TdxClient, Market
|
||||
from easy_tdx import Market, TdxClient
|
||||
|
||||
with TdxClient.from_best_host() as c:
|
||||
date = 20250110
|
||||
bars = c.get_history_minute_time_data(Market.SH, "600000", date)
|
||||
df = pd.DataFrame([{
|
||||
"序号": i + 1,
|
||||
"价格": bar.price,
|
||||
"成交量": bar.vol,
|
||||
} for i, bar in enumerate(bars)])
|
||||
df = c.get_history_minute_time_data(Market.SH, "600000", date)
|
||||
print(f"浦发银行 {date} 分时数据,共 {len(df)} 条:")
|
||||
print(df.to_string(index=False))
|
||||
print(df.head(20).to_string(index=False))
|
||||
|
||||
@@ -1,14 +1,8 @@
|
||||
"""演示:获取今日分时数据(240 条)。"""
|
||||
|
||||
import pandas as pd
|
||||
from easy_tdx import TdxClient, Market
|
||||
from easy_tdx import Market, TdxClient
|
||||
|
||||
with TdxClient.from_best_host() as c:
|
||||
bars = c.get_minute_time_data(Market.SH, "600000")
|
||||
df = pd.DataFrame([{
|
||||
"序号": i + 1,
|
||||
"价格": bar.price,
|
||||
"成交量": bar.vol,
|
||||
} for i, bar in enumerate(bars)])
|
||||
df = c.get_minute_time_data(Market.SH, "600000")
|
||||
print(f"浦发银行今日分时,共 {len(df)} 条:")
|
||||
print(df.to_string(index=False))
|
||||
print(df.head(20).to_string(index=False))
|
||||
|
||||
Reference in New Issue
Block a user