feat: dynamic assets banner price stats alignment intrinsic value labels and closed store text

This commit is contained in:
2026-11-18 18:26:18 +03:30
parent 21472823b4
commit 1aceafd02d
18 changed files with 384 additions and 73 deletions
@@ -57,8 +57,28 @@ export function resolveMetalDayRangePrices(options: {
metal: ChartMetalType
metalRatio: number
}) {
const baseHigh = options.price?.up?.buy ?? getTradeBuyPrice(options.price as Parameters<typeof getTradeBuyPrice>[0])
const baseLow = options.price?.up?.sell ?? getTradeSellPrice(options.price as Parameters<typeof getTradeSellPrice>[0])
let baseHigh = options.price?.up?.buy ?? getTradeBuyPrice(options.price as Parameters<typeof getTradeBuyPrice>[0])
let baseLow = options.price?.up?.sell ?? getTradeSellPrice(options.price as Parameters<typeof getTradeSellPrice>[0])
const tradePrice = getTradeBuyPrice(options.price as Parameters<typeof getTradeBuyPrice>[0])
// اگر سقف و کف بر اساس تن (بیش از ۱۰۰ میلیون ریال) آمده باشند، به مقیاس کیلوگرم تبدیل کن
if (baseHigh > 100_000_000) {
baseHigh = Math.round(baseHigh / 1000)
}
if (baseLow > 100_000_000) {
baseLow = Math.round(baseLow / 1000)
}
// اگر مقادیر نامعتبر باشند یا به دلیل مغایرت منبع فاصله غیرمنطقی داشته باشند
if (tradePrice > 0) {
if (baseHigh <= 0 || (baseHigh / tradePrice > 2.5) || (tradePrice / baseHigh > 2.5)) {
baseHigh = tradePrice
}
if (baseLow <= 0 || (baseLow / tradePrice > 2.5) || (tradePrice / baseLow > 2.5)) {
baseLow = tradePrice
}
}
const ratio = options.metalRatio || CHART_METAL_MARKUP_RATIO[options.metal]
return {