Step 5: Update exchange price endpoint to use new pricing config

- Update ExchangeConfigResponse schema with direction-specific fields
- Remove premium_percentage from PriceResponse (now in config)
- Update price endpoint to load pricing config from database
- Update frontend to use direction-specific min/max and calculate premium
- Update tests to seed pricing config
- Add logic to clamp amount when direction changes
This commit is contained in:
counterweight 2025-12-26 20:20:23 +01:00
parent d838d1be96
commit d317939ad0
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C
5 changed files with 145 additions and 44 deletions

View file

@ -13,6 +13,7 @@ interface PriceDisplayProps {
lastUpdate: Date | null;
direction: "buy" | "sell";
agreedPrice: number;
premiumPercent: number;
}
/**
@ -94,10 +95,10 @@ export function PriceDisplay({
lastUpdate,
direction,
agreedPrice,
premiumPercent,
}: PriceDisplayProps) {
const t = useTranslation("exchange");
const marketPrice = priceData?.price?.market_price ?? 0;
const premiumPercent = priceData?.price?.premium_percentage ?? 5;
const isPriceStale = priceData?.price?.is_stale ?? false;
return (