Skip to content

Commit

Permalink
[Fix] 최대 매도수량 계산로직 오류 수정
Browse files Browse the repository at this point in the history
- 최대 매도수량 계산 시 이미 주문하였으나 거래량이 없어 미체결로 편입된 주식도 매도가능 수량에서 차감하는 로직 기존이 구현
- 해당 로직에 오류가 존재하여 수정함 (미체결 주식수를 차감했어야 하나, 미체결 건수를 차감해서 오류 발생 Ex. 주식 3주를 매도 대기하였으나, 이것이 1건의 주문으로 발생했다면 3을 차감하는게 아니라 1을 차감하고 있어서 제대로 주식 수 만큼 차감할 수 있도록 수정)

Issues #17
  • Loading branch information
novice1993 committed Sep 14, 2023
1 parent 2194cb2 commit 9e9944d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion client/src/components/StockOrderSection/VolumeSetteing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ const VolumeSetting = () => {
// 해당 company 보유 주식이 0이 아닐 때
if (holdingCompanyStock.length !== 0) {
const waitingForSaleStock = orderRecordData.filter((stock: OrderRecordProps) => stock.companyId === companyId && stock.orderTypes === "SELL" && stock.orderStates === "ORDER_WAIT");
avaiableSellingStock = holdingCompanyStock[0].stockCount - waitingForSaleStock.length;
const waitingStockNum = waitingForSaleStock.reduce((acc: number, cur: OrderRecordProps) => {
acc = acc + cur.stockCount;
return acc;
}, 0);
avaiableSellingStock = holdingCompanyStock[0].stockCount - waitingStockNum;
}

const handlePlusOrderVolume = () => {
Expand Down

0 comments on commit 9e9944d

Please sign in to comment.