chore: pre-existing in-tree work (event-study/research/vintages/prices + migration script + integrity docs)
Committing the prior uncommitted working-tree state that predates this session's data-source work (was already modified/untracked at session start) so the tree is clean before push. Includes: event-study + research report integrity/forward observation work, prices tests, research hash migration script, and the 2026-08-23/24 engineering-log + test-evidence notes. Verified green as part of the full 362-test suite.
This commit is contained in:
1 parent
dbb787c50a
commit
ead9aeb25c
22 files changed
+2326
-66
No files matched your search
@@ -94,6 +94,39 @@ class EventStudyTests(unittest.TestCase):
|
||||
result = run_event_study(events, prices, windows=(1,), min_events=1)
|
||||
self.assertAlmostEqual(result["windows"]["1"]["gross_return"], 101 / 100 - 1, places=8)
|
||||
|
||||
def test_event_study_requires_known_at_for_point_in_time_prices(self):
|
||||
events = [{"event_id": "pit", "published_at": "2026-01-01T08:00:00+07:00", "signals": [{"symbol": "AOT", "target_weight": 1.0}]}]
|
||||
prices = {
|
||||
"AOT": [
|
||||
{"session_date": "2026-01-01", "close": 100},
|
||||
{"session_date": "2026-01-02", "close": 105, "known_at": "2026-01-02T17:00:00+07:00"},
|
||||
]
|
||||
}
|
||||
with self.assertRaisesRegex(EventStudyError, "known_at"):
|
||||
run_event_study(events, prices, windows=(1,), min_events=1, require_price_known_at=True)
|
||||
|
||||
def test_event_study_rejects_price_known_after_session_as_lookahead(self):
|
||||
events = [{"event_id": "lookahead", "published_at": "2026-01-01T08:00:00+07:00", "signals": [{"symbol": "AOT", "target_weight": 1.0}]}]
|
||||
prices = {
|
||||
"AOT": [
|
||||
{"session_date": "2026-01-01", "close": 100, "known_at": "2026-01-01T17:00:00+07:00", "market_timezone": "Asia/Bangkok"},
|
||||
{"session_date": "2026-01-02", "close": 105, "known_at": "2026-01-03T09:00:00+07:00", "market_timezone": "Asia/Bangkok"},
|
||||
]
|
||||
}
|
||||
with self.assertRaisesRegex(EventStudyError, "known_at"):
|
||||
run_event_study(events, prices, windows=(1,), min_events=1, require_price_known_at=True)
|
||||
|
||||
def test_event_study_checks_known_at_in_market_timezone(self):
|
||||
events = [{"event_id": "timezone-lookahead", "published_at": "2026-01-01T08:00:00+07:00", "signals": [{"symbol": "AOT", "target_weight": 1.0}]}]
|
||||
prices = {
|
||||
"AOT": [
|
||||
{"session_date": "2026-01-01", "close": 100, "known_at": "2026-01-01T18:30:00Z", "market_timezone": "Asia/Bangkok"},
|
||||
{"session_date": "2026-01-02", "close": 105, "known_at": "2026-01-02T17:00:00+07:00", "market_timezone": "Asia/Bangkok"},
|
||||
]
|
||||
}
|
||||
with self.assertRaisesRegex(EventStudyError, "known_at"):
|
||||
run_event_study(events, prices, windows=(1,), min_events=1, require_price_known_at=True)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user