fix: convert string to int when buy/sell

This commit is contained in:
zhiyong 2025-05-13 10:33:32 +08:00
parent f88909cb2d
commit ad90cba1fb

View File

@ -280,7 +280,7 @@ def buy():
raise ValueError("Missing required parameters")
price = float(price_str)
amount = int(amount_str)
amount = int(float(amount_str))
if order_type == ORDER_TYPE_LIMIT and (price <= 0 or amount <= 0):
raise ValueError("Price and amount must be positive")
@ -351,7 +351,7 @@ def sell():
raise ValueError("Missing required parameters")
price = float(price_str)
amount = int(amount_str)
amount = int(float(amount_str))
if order_type == ORDER_TYPE_LIMIT and (price <= 0 or amount <= 0):
raise ValueError("Price and amount must be positive")