fix(data): judge late newest rows as sparse; require SPY print only in the ETF panel
Tickers count as alive for 10 rows after their last bar, so a newest row printed by a few early tickers is dropped until the rest arrive. The benchmark-print session rule now applies only to the mixed US/HK ETF panel: Yahoo's 510300.SS lags CN stocks by days and would stall the CN book. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -42,6 +42,13 @@ class PanelRefreshTests(unittest.TestCase):
|
||||
self.assertTrue((returns > 0).all(), returns)
|
||||
self.assertAlmostEqual(merged["AAA"].iloc[0], 50.0)
|
||||
|
||||
def test_newest_row_printed_by_few_tickers_is_dropped(self):
|
||||
panel = _panel({
|
||||
"A": [1, 1, 1, np.nan], "B": [1, 1, 1, np.nan],
|
||||
"C": [1, 1, 1, np.nan], "D": [1, 1, 1, 2],
|
||||
})
|
||||
self.assertNotIn(panel.index[-1], data_manager._drop_sparse_rows(panel).index)
|
||||
|
||||
def test_rows_printed_by_a_minority_of_tickers_are_dropped(self):
|
||||
panel = _panel({
|
||||
"SPY": [1, 1, np.nan, 1, 1],
|
||||
|
||||
Reference in New Issue
Block a user