-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BE] 26.08 이동 평균선 계산 로직 추가 (#183) #199
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다.
BE/src/ranking/ranking.service.ts
Outdated
@@ -98,7 +98,7 @@ export class RankingService { | |||
|
|||
return { | |||
topRank: parsedTopRank, | |||
userRank: userRank, | |||
userRank, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟢 얘는 린트 오류때문에 수정하신 건가요? 갑자기 왜 수정하신 건지 모를 파일이 끼어있는 느낌이에요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
헉 시정하겠습니다
이거 그러면 프론트분께 이야기된 건가요?? 기존에 제 코드에서는 프론트분께서 날짜 입력하면 최대 100개까지, 미입력시에는 오늘 날짜를 기준으로 30개씩만 가지고 올 수 있게 되어있었거든요 |
if (periodDivCode === 'D') prevDay.setDate(today.getDate() - 60);
if (periodDivCode === 'M') prevDay.setDate(today.getDate() - 1200);
if (periodDivCode === 'Y') prevDay.setDate(today.getDate() - 20000);
prevDay.setDate(today.getDate() - 365); 그리고 여기 코드, if문에서 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다! 진님께서 말씀해주신 부분만 체크해주시면 될 것 같습니당ㅎㅎ
newDate2 = new Date().toISOString().slice(0, 10).replace(/-/g, ''); | ||
newDate1 = prevDay.toISOString().slice(0, 10).replace(/-/g, ''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟢 이 부분 좀 더 간단하게 하는 내장 메소드 없나 찾아봤는데 없네요...ㅋㅋ 고생하셨습니다!!
…-JuGa into feature/api/calculateMAL-#183
헉.....감사합니다 |
해당 내용은 코드를 작성하기 전에 산님과 이야기 나눠보았습니다! |
✅ 주요 작업
💭 고민과 해결과정
평균선을 계산하기 위해선 기존에 30개만 가져오던 데이터에서 일별 차트의 경우 최소 5일 최대 20의 데이터를 더 가져와야 했습니다.
이를 위해선 처음에 prevDay를 50일로 설정했으나 주식의 경우 주말, 공휴일 데이터가 없기 때문에 50일 전이라 해도 그보다 적은 데이터를 반환하는 현상이 발생함에 따라 60일 전부터의 데이터를 조회하도록 하였습니다.