From cce3fd4f5812202d84f9a1c094362349bd00f029 Mon Sep 17 00:00:00 2001 From: kavore <161734431+kavore@users.noreply.github.com> Date: Sat, 17 Jan 2026 23:23:06 +0300 Subject: [PATCH] bugfix #4 --- bot/services/lknpd_client.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bot/services/lknpd_client.py b/bot/services/lknpd_client.py index 5d1ec25..3d28fcc 100644 --- a/bot/services/lknpd_client.py +++ b/bot/services/lknpd_client.py @@ -257,6 +257,13 @@ class LknpdClient: qty_decimal = Decimal(str(quantity)) total = amount_decimal * qty_decimal + # API expects quantity as integer when it's a whole number + qty_value: int | str + if qty_decimal == qty_decimal.to_integral_value(): + qty_value = int(qty_decimal) + else: + qty_value = str(qty_decimal) + # Build request request_data = { "operationTime": _format_datetime(op_time), @@ -265,7 +272,7 @@ class LknpdClient: { "name": name, "amount": str(amount_decimal), - "quantity": str(qty_decimal), + "quantity": qty_value, } ], "totalAmount": str(total),