Skip to content

Commit

Permalink
[Fix] 전날 종가대비 현재 호가 가격변동률 로직 오류 수정
Browse files Browse the repository at this point in the history
- 전날 종가 대비 현재 매수/매도호가 가격 변동률 로직 오류 존재하여 일부 수정

Issues #17
  • Loading branch information
novice1993 committed Sep 15, 2023
1 parent a733efa commit 6c26543
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions client/src/components/StockOrderSection/StockPrice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ const StockPrice = (props: StockPriceProps) => {
}

// 전날 종가대비 매도/매수호가 변동률 계산
const presentStockPrice = parseInt(stockInfo.stockInfResponseDto.stck_prpr, 10);
const priceChageAmountComparedYesterday = Math.abs(parseInt(stockInfo.stockInfResponseDto.prdy_vrss, 10));
const previousDayStockClosingPrice = presentStockPrice - priceChageAmountComparedYesterday;
const changeRate = (((price - previousDayStockClosingPrice) / previousDayStockClosingPrice) * 100).toFixed(2);
const presentStockPrice = parseInt(stockInfo.stockInfResponseDto.stck_prpr, 10); // 현재가
const priceChageAmountComparedYesterday = parseInt(stockInfo.stockInfResponseDto.prdy_vrss, 10); // 전날 종가대비 현재가 가격 차이
const yesterDayStockClosingPrice = presentStockPrice - priceChageAmountComparedYesterday; // 잔날종가 = 현재가 - 전날 종가대비 현재가 가격 차이
const changeRate = (((price - yesterDayStockClosingPrice) / yesterDayStockClosingPrice) * 100).toFixed(2);

return (
<Container index={index} ref={index === 9 ? ref : null} price={price} orderPrice={orderPrice} onClick={handleSetOrderPrice}>
Expand Down

0 comments on commit 6c26543

Please sign in to comment.