| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- from __future__ import annotations
- from datetime import date
- from typing import Optional
- def should_increment_pending(
- *,
- active: bool,
- subtype: str,
- origin_date: Optional[date],
- row_date: date,
- ) -> bool:
- if not active or not subtype or origin_date is None:
- return False
- return row_date != origin_date
- def evaluate_pending_confirmation(
- *,
- active: bool,
- subtype: str,
- in_position: bool,
- kdj_sell: bool,
- ql_sell: bool,
- bars_waited: int,
- window_bars: int,
- ql_buy: bool,
- ) -> tuple[str, str, bool]:
- if not active or not subtype:
- return "NONE", "", False
- if in_position:
- return "NONE", "", True
- if kdj_sell or ql_sell:
- return "NONE", "", True
- if bars_waited > window_bars:
- return "NONE", "", True
- if bars_waited >= 1 and ql_buy:
- return "BUY", f"deep_oversold_rebound_buy:confirmed_{subtype}", True
- return "NONE", "", False
|