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:
parent
d838d1be96
commit
d317939ad0
5 changed files with 145 additions and 44 deletions
|
|
@ -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 (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue