How to pass args[] in PortfolioManagerImpl.java

I cant understand how to pass argument to PortfolioManagerImpl.java file that is necessary to get enddate. How to resolve enddate problem??
@amanagar, @Vinod_Crio_TA

Go through the TODOs(PortfolioManagerApplication) carefully, read that with complete attention, it really gives you a hint.


This line of code is already given to you.

return portfolioManager.calculateAnnualizedReturn(Arrays.asList(portfolioTrades), endDate);`

Note that we are already passing endDate to calculateAnnualizedReturn (which is a function within PortfolioManagerImpl) as an argument. We only have few more things to be done from our side.

PortfolioManager is the interface and PortfolioManagerImpl is the class which is implementing that interface here. And you know we are using factory concept here (please read about the same from references given and get a better understanding).


Create PortfolioManager using PortfoliomanagerFactory

but how? we have only one function inside PortfolioManagerFactory, and it’s quiet obvious…, we need to use that.

PortfolioManagerFactory has a method getPortfolioManager “observe the parameter there”. Now we know what has to be passed, just create an instance of it in PortfolioManagerApplication. And in that getPortfolioManager you must use PortfolioManagerImpl to create an instance of PortfolioManager using RestTemplate provided at the first place.
Now when you call calculateAnnualizedReturn from PortfolioManagerApplication your enddate will be sent to the exact place you wanted.


go through this thread too. It might help you

It is just an implementation class file. You just have to override methods mentioned in PortfolioManager.java .

I’m closing this topic due to no response from anyone since last 12 hours. If your query is resolved you can mark any reply as a solution. If you still have the query, please create a new topic paste the link of this topic in the description and please let me know if your issue still not resolved.