fix calc_buy_num floor -> round

This commit is contained in:
2026-09-15 10:38:47 +08:00
parent efc53b35fc
commit bfe89ba122
3 changed files with 262 additions and 2 deletions

View File

@@ -14,7 +14,7 @@ def trading_time(now: datetime) -> bool:
def calc_buy_volume(price: float, buy_value: float) -> int:
if price <= 0 or buy_value <= 0: return 0
return max(1, floor(buy_value / (price * 100))) * 100
return max(1, round(buy_value / (price * 100))) * 100
def calculate_min_profit_rate(price: float, profit_mult: int) -> float:
"""