test_followthrough_profit_loop_review.py 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. from __future__ import annotations
  2. import unittest
  3. from pathlib import Path
  4. from dragon_branch_configs import alpha_first_glued_followthrough_probe_config, alpha_first_glued_refined_hot_cap_config
  5. from dragon_followthrough_profit_loop_review import collect_followthrough_reentries, collect_glued_block_candidates
  6. from dragon_rc1_golden_baseline import _load_indicator_snapshot
  7. class TestFollowthroughProfitLoopReview(unittest.TestCase):
  8. def setUp(self) -> None:
  9. self.base_dir = Path(__file__).resolve().parents[1]
  10. self.indexed, _ = _load_indicator_snapshot(self.base_dir)
  11. def test_collects_known_mid_zone_block_candidate(self) -> None:
  12. blocked = collect_glued_block_candidates(
  13. self.indexed,
  14. alpha_first_glued_refined_hot_cap_config(),
  15. branch_name="base_rc1",
  16. )
  17. target = blocked[
  18. (blocked["signal_date"] == "2020-11-30")
  19. & (blocked["subtype"] == "mid_zone_very_weak_b1")
  20. ].copy()
  21. self.assertEqual(len(target), 1)
  22. def test_maps_probe_mid_followthrough_origin(self) -> None:
  23. reentries = collect_followthrough_reentries(
  24. self.indexed,
  25. alpha_first_glued_followthrough_probe_config(),
  26. branch_name="probe_mid_zone",
  27. )
  28. self.assertEqual(len(reentries), 1)
  29. row = reentries.iloc[0]
  30. self.assertEqual(row["origin_date"], "2020-11-30")
  31. self.assertEqual(row["buy_date"], "2020-12-01")
  32. self.assertEqual(row["subtype"], "mid_zone_very_weak_b1")
  33. self.assertEqual(int(row["bars_waited"]), 1)
  34. if __name__ == "__main__":
  35. unittest.main()