#whether i sort or not , both test cases are failing .
how can i debug for these ?
Check your app in local build using command
check whether all the test cases are passing or not.
are you checking for cases like when the end date is before the purchase date, end date argument not provided etc?
Have you checked the app for all possible corner cases? Like possibly when the dates don’t line up?
Use total no. Of days/ 365 to calculate number of years in Double data type. It will help you.
Yup, all were passing
Are you throwing valid exception and are you providing required output for some special cases such as when end date < start date or there is no data available for end date?
@nabhanpv , 1. if end date is before the puchase date , raise exception
2. end date argument is not provided ,use current date .
i directly did 365/no of days .i guess its not the problem
Hey I got your error. If you are using 365/no. Of days it will restrict your precision value. If both are interger or long. If you are doing double/floating point calculation to achieve precision one must be in double/floating point. E.g.
If you do 365/64 it will give you 5.0 but is it really what we need, No.
Google your query how to do floating point arithmetic in java.
If you already did this reply will find help you to find other possibilities.
You’re right in this.
Mark as solution broo
- I am throwing runtime exception when end <start
2.passing current day when no day end day is provided
- changed 365 and no_of_days both into double ,in order to maintain precision .
- also taking close price of last available end date in api call .
#still old trades is failing .
@Crio-Admin @Sakshat-Crio.Do @Saurabh_Crio_TA can u suggest something?
- Firstly make sure you’ve not hard coded anything.
- Secondly, when you make a call to tiingo api and there is no response of end date. Then are you calculating close value of the latest date ?
when there is no response of end date , I am taking the enddate as we did in module 2
n not hardcoding anything
@Sakshat-Crio.Do can u look into my code ?
I’m looking into it. Just give me some time
Hey, when end date is not there in the response are you sure that you are taking the latest date closing price. I don’t think so.
Do verify your calculation logic also.
result from the api call ,i deserialized and collected into the collection list
and i am passing enddate into calculateAnnualizedReturns as getdate of last element of collection…which is lastest date .right ?
Did you verify your calculation logic?