This commit is contained in:
2026-09-07 21:22:51 +08:00
parent 9778d54f3d
commit ba61ed5de7
28 changed files with 303 additions and 64 deletions

View File

@@ -2,9 +2,14 @@ from datetime import datetime, time
from math import floor
_MORNING_START, _MORNING_END = time(9, 30), time(11, 30)
_AFTERNOON_START, _AFTERNOON_END = time(13), time(15)
def trading_time(now: datetime) -> bool:
if now.weekday() >= 5: return False
return time(9, 30) <= now.time() <= time(11, 30) or time(13) <= now.time() <= time(15)
clock = now.time()
return _MORNING_START <= clock <= _MORNING_END or _AFTERNOON_START <= clock <= _AFTERNOON_END
def calc_buy_volume(price: float, buy_value: float) -> int:
@@ -29,4 +34,4 @@ def calculate_min_profit_rate(price: float, profit_mult: int) -> float:
elif price >= 100:
return 7 * profit_mult # 7%
else:
return 9 * profit_mult # 9%
return 9 * profit_mult # 9%