Not able to figure out failure in Module 3 assessment errors

mainCalculateReturnsVaryingDateRanges() and mainCalculateReturnsOldTrades() are failing during assessment.
My gradle build is running fine, all 12 test cases are getting passed.
I have read through all the similar topics and suggestions from Office hours too, but still not able to figure it out.
All posts are saying to look into the implementation of calculation of no of days.
I have added logic if endDate is not found, so find the latest date and sellPrice prior to endDate, still it’s failing.
No of days I am calculating using ChronoUnit’s DAYS between method, and I have tried it on local compiler, it is giving right no_of_days and no_of_years.
And it is also evident by passing 12 test cases in local build.
It’s been more than a week.
Please look and suggest any other changes. @Vinod_Crio_TA @sridherj-criodo
Any suggestion would be really helpful.

Can u attach the log file here

log file is this :
2020-03-06 18:00:43,402 unitTesting INFO Running gradle test
2020-03-06 18:01:11,865 unitTesting INFO Gradle test run complete
2020-03-06 18:01:11,873 unitTesting INFO Build failed

Hi @iamanuragbansal,
Go through this link

And let me know whether the issue is resolved or not.

@iamanuragbansal Please refer to the following FAQ

  • Make sure you don’t hard code any values while making the API call
  • And follow the TODO’s like “buy_price = open_price on purchase_date and sell_value = close_price on end_date”
    “Return the list of AnnualizedReturns sorted by annualizedReturns in descending order.” correctly.

My logic was all right. It was just silly mistake of hard-code.
I was hard-coding the startDate in the API call taking assumption that trades.json all have same purchaseDate. And later, didn’t even consider there was such assumption made on my part.

yes, issue is now resolved, thanks a lot. :100:

1 Like