전체적인 리팩토링

This commit is contained in:
2026-03-12 09:26:27 +09:00
parent 406af7408a
commit e51d767878
97 changed files with 13651 additions and 363 deletions

View File

@@ -9,6 +9,7 @@ export interface BookRow {
price: number;
size: number;
changeValue: number | null;
changeRate: number | null;
isHighlighted: boolean;
}
@@ -166,11 +167,13 @@ export function buildBookRows({
const price = side === "ask" ? level.askPrice : level.bidPrice;
const size = side === "ask" ? level.askSize : level.bidSize;
const changeValue = resolvePriceChange(price, basePrice);
const changeRate = resolvePriceChangeRate(price, basePrice);
return {
price,
size: Math.max(size, 0),
changeValue,
changeRate,
isHighlighted: latestPrice > 0 && price === latestPrice,
} satisfies BookRow;
});
@@ -208,3 +211,10 @@ function resolvePriceChange(price: number, basePrice: number) {
}
return price - basePrice;
}
function resolvePriceChangeRate(price: number, basePrice: number) {
if (price <= 0 || basePrice <= 0) {
return null;
}
return ((price - basePrice) / basePrice) * 100;
}