small fix
This commit is contained in:
parent
812677b20a
commit
ec1267cdba
@ -276,7 +276,8 @@
|
|||||||
|
|
||||||
let change;
|
let change;
|
||||||
let currentDataRowOneDay;
|
let currentDataRowOneDay;
|
||||||
let baseClose = data?.getStockQuote?.previousClose;
|
let baseClose =
|
||||||
|
data?.getStockQuote?.previousClose || oneDayPrice?.at(0)?.open;
|
||||||
|
|
||||||
const length = oneDayPrice?.length;
|
const length = oneDayPrice?.length;
|
||||||
for (let i = length - 1; i >= 0; i--) {
|
for (let i = length - 1; i >= 0; i--) {
|
||||||
@ -288,9 +289,9 @@
|
|||||||
|
|
||||||
// Calculate percentage change if baseClose and currentDataRow are valid
|
// Calculate percentage change if baseClose and currentDataRow are valid
|
||||||
const closeValue =
|
const closeValue =
|
||||||
$realtimePrice !== null
|
$realtimePrice !== null && $realtimePrice !== undefined
|
||||||
? $realtimePrice
|
? $realtimePrice
|
||||||
: (currentDataRowOneDay?.close ?? currentDataRowOneDay?.value);
|
: currentDataRowOneDay?.close || currentDataRowOneDay?.value;
|
||||||
|
|
||||||
if (closeValue && baseClose) {
|
if (closeValue && baseClose) {
|
||||||
change = ((closeValue / baseClose - 1) * 100)?.toFixed(2);
|
change = ((closeValue / baseClose - 1) * 100)?.toFixed(2);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user