mirror of
https://ghfast.top/https://github.com/aeroxw/easy_tdx_max.git
synced 2026-09-12 15:44:18 +08:00
fix: ruff format compliance for CI
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
e290ea3f21
commit
fd03e2a334
@@ -791,9 +791,7 @@ class MacClient:
|
|||||||
|
|
||||||
boards_df = self.get_board_list(board_type)
|
boards_df = self.get_board_list(board_type)
|
||||||
if boards_df.empty:
|
if boards_df.empty:
|
||||||
return pd.DataFrame(
|
return pd.DataFrame(columns=["code", "name", "close_end", "close_start", "change_pct"])
|
||||||
columns=["code", "name", "close_end", "close_start", "change_pct"]
|
|
||||||
)
|
|
||||||
|
|
||||||
fetch_count = days + 10 # 缓冲节假日
|
fetch_count = days + 10 # 缓冲节假日
|
||||||
target_ts: pd.Timestamp | None = None
|
target_ts: pd.Timestamp | None = None
|
||||||
@@ -1620,9 +1618,7 @@ class AsyncMacClient:
|
|||||||
|
|
||||||
boards_df = await self.get_board_list(board_type)
|
boards_df = await self.get_board_list(board_type)
|
||||||
if boards_df.empty:
|
if boards_df.empty:
|
||||||
return pd.DataFrame(
|
return pd.DataFrame(columns=["code", "name", "close_end", "close_start", "change_pct"])
|
||||||
columns=["code", "name", "close_end", "close_start", "change_pct"]
|
|
||||||
)
|
|
||||||
|
|
||||||
fetch_count = days + 10
|
fetch_count = days + 10
|
||||||
target_ts: pd.Timestamp | None = None
|
target_ts: pd.Timestamp | None = None
|
||||||
|
|||||||
@@ -240,9 +240,7 @@ def test_full_ranking(mock_board_list, mock_kline):
|
|||||||
@patch.object(MacClient, "get_board_list")
|
@patch.object(MacClient, "get_board_list")
|
||||||
def test_top_n_truncation(mock_board_list, mock_kline):
|
def test_top_n_truncation(mock_board_list, mock_kline):
|
||||||
"""top_n=2 时只返回前 2 个板块。"""
|
"""top_n=2 时只返回前 2 个板块。"""
|
||||||
boards_df = _make_boards_df(
|
boards_df = _make_boards_df([("881001", "A", 1), ("881002", "B", 1), ("881003", "C", 1)])
|
||||||
[("881001", "A", 1), ("881002", "B", 1), ("881003", "C", 1)]
|
|
||||||
)
|
|
||||||
mock_board_list.return_value = boards_df
|
mock_board_list.return_value = boards_df
|
||||||
|
|
||||||
dates = [f"2025-05-{d:02d}" for d in range(1, 31)]
|
dates = [f"2025-05-{d:02d}" for d in range(1, 31)]
|
||||||
@@ -271,9 +269,7 @@ def test_top_n_truncation(mock_board_list, mock_kline):
|
|||||||
@patch.object(MacClient, "get_board_list")
|
@patch.object(MacClient, "get_board_list")
|
||||||
def test_ascending_order(mock_board_list, mock_kline):
|
def test_ascending_order(mock_board_list, mock_kline):
|
||||||
"""ascending=True 时跌幅最大的排前面。"""
|
"""ascending=True 时跌幅最大的排前面。"""
|
||||||
boards_df = _make_boards_df(
|
boards_df = _make_boards_df([("881001", "A", 1), ("881002", "B", 1)])
|
||||||
[("881001", "A", 1), ("881002", "B", 1)]
|
|
||||||
)
|
|
||||||
mock_board_list.return_value = boards_df
|
mock_board_list.return_value = boards_df
|
||||||
|
|
||||||
dates = [f"2025-05-{d:02d}" for d in range(1, 31)]
|
dates = [f"2025-05-{d:02d}" for d in range(1, 31)]
|
||||||
@@ -331,9 +327,7 @@ def test_with_target_date(mock_board_list, mock_kline):
|
|||||||
client.get_board_list = mock_board_list
|
client.get_board_list = mock_board_list
|
||||||
client.get_stock_kline = mock_kline
|
client.get_stock_kline = mock_kline
|
||||||
|
|
||||||
result = MacClient.get_board_change_ranking(
|
result = MacClient.get_board_change_ranking(client, board_type=0, target_date=20250520, days=5)
|
||||||
client, board_type=0, target_date=20250520, days=5
|
|
||||||
)
|
|
||||||
assert not result.empty
|
assert not result.empty
|
||||||
# target_date=20250520, 对应 index 19 (0-based), close=119
|
# target_date=20250520, 对应 index 19 (0-based), close=119
|
||||||
# start_pos = 19 - 5 = 14, close=114
|
# start_pos = 19 - 5 = 14, close=114
|
||||||
|
|||||||
Reference in New Issue
Block a user