Continuing the discussion from Build Fail on NoData On Enddate while submission:
Using 0th index for opening price and (n-1)th index for a selling price
Also using buildUrl() to return the api and getStockQuote() to return List
Continuing the discussion from Build Fail on NoData On Enddate while submission:
Using 0th index for opening price and (n-1)th index for a selling price
Also using buildUrl() to return the api and getStockQuote() to return List
Please refer to the following FAQ
As I have mentioned in question body i use (n-1) to find the data on end Date.
For example if start date is 2019-01-01 and endDate is 2020-01-01 it will take the last element from the json data
are you sorting the list returned from tiingo api ?
Yes in descending order using Collections.sort
From your logic, it is showing that you are taking the wrong date i.e when endDate is null , you are taking the purchase date.
I removed it still the same test case is failing
1/22 test cases failed
calculateAnnualizedReturnNoDataOnEndDate()
Bro are you sorting the list returned from getstockQuote() function
I’m first calculating totalReturn,annualizedReturns storing these in ArrayList AnnualizedReturn
and then sorting this list
I am not talking about annualreturn ,
i am talking about tiingocandle objects list returned from getstockquote()
it is necessary to sort this list in ASC order .
then choose 0 and n-1 as index.
2 test cases fail after sorting the tingocandle objects list returned from getstockquote()
I’m implementing same logic as of module 3 there all test cases had passed
@shivambhanushali, the list returned from Tiingo is already sorted in
ascending order of date. You don’t have to sort it by descending order. Taking 0th and (n-1) th index, as you already told, will work without sorting the list from Tiingo. That’s why sorting in descending order and taking (n-1)th index is giving you the purchase date.
startdate must be date of index 0
endDate must be date of index n-1