small fixes

This commit is contained in:
counterweight 2025-12-27 12:52:43 +01:00
parent 86c92a7c65
commit 43b250e157
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C
3 changed files with 18 additions and 7 deletions

View file

@ -17,6 +17,7 @@ from models import (
TradeDirection,
)
from price_fetcher import PAIR_BTC_EUR, SOURCE_BITFINEX
from shared_constants import EUR_TRADE_INCREMENT
def tomorrow() -> date:
@ -213,7 +214,7 @@ class TestExchangePriceEndpoint:
assert config["eur_max_buy"] == 300000
assert config["eur_min_sell"] == 12000
assert config["eur_max_sell"] == 320000
assert config["eur_increment"] == 20
assert config["eur_increment"] == EUR_TRADE_INCREMENT
assert config["premium_buy"] == 5
assert config["premium_sell"] == 6
@ -659,6 +660,11 @@ class TestCreateExchange:
"""EUR amount not a multiple of increment is rejected."""
target_date = await setup_availability_and_price(client_factory, admin_user)
# Calculate an amount that's not a multiple of the increment
# Use a valid base amount (multiple of increment) and add a small offset
base_amount = 11500 # €115.00
invalid_amount = base_amount + (EUR_TRADE_INCREMENT - 1) # Not a multiple
with mock_price_fetcher(20000.0):
async with client_factory.create(cookies=regular_user["cookies"]) as client:
response = await client.post(
@ -667,7 +673,7 @@ class TestCreateExchange:
"slot_start": f"{target_date}T09:00:00Z",
"direction": "buy",
"bitcoin_transfer_method": "onchain",
"eur_amount": 11500, # €115, not multiple of €20
"eur_amount": invalid_amount,
},
)