What to do with getStockQuote()

I cant understand in which purpose getStockQuote will be used. Again the return type is List<Candle>
but the TingoCandle has the definition of the functions those getStockQuote has. How to go through
getStockQuote function and how to use it?
@amanagar, @Vinod_Crio_TA, @sridherj-criodo, @anand-crio

@Soumyadip, You can use these hints:

  1. Go through the TODO carefully.
  2. Carefully look at what the input is, what the output is, and what you should do to convert the input to output

The name of the function clearly specifies its functionality. Think in this way, you are actually getting List from getStockQuote().

getStockQuote() is the method that is responsible for calling the appropriate Tiingo service logic to get the data from the API and preprocess it.
Candle is the class which is used to de-serialize the JSON response received from Tiingo service.(Compare the members of the Candle class with the JSON response from Tiingo API)

@Apoorv_Goyal Yes, but are we use List ? As the definition of the functions of Candle is declared in TingoCandle. Are we use directly List or have to implement TingoCandle??

Hi @Soumyadip,

Think of it this way.

You are dividing the work previously being done by one object between two different ones. This way, your code stays maintainable and in general is a better practice.

Here, we use getStockQuote() methodto call the appropriate method from Tiingo Service whoch fetched the data from the API and then we can further ppreprocess this data before passing it on to the next function. On the other hand, we use TiingoCandle deserialize the JSON received from API.

Let me know if this helps!

Read more about liskov substitution principle to clarify more on why functions of Candle are defined in TingoCandle.
TingleCandle is a class and you are supposed to store multiple TingoCandle objects ,think of it like what you would do when you want to create a list of integers where integer is a single object.

I am not able to figure out what exactly is to be returned from getStockQuote().
DO we have to convert the TiingoCandle[] into List?

Yes thats one way of doing it. I would suggest you to explore functions of List class that convert array to list.
Also whenever you run into any dilemma regarding what needs to be returned just check the return datatype in the function definition. Hope it helps speed up future debugging.

Also, would you tell me what is to be done in getPortfolioManager() function of the PortfolioManagerFactory class. I am a bit confused.

@Apoorv_Goyal Basically I am using List in getStockQuote function. Am I right?

Please be more specific about the issue that you are facing.
On a side note carefully follow the ToDos mentioned along with the stubs

If you are talking about the return type then you are in the right direction.
Keep in mind whenever you return something that does not match the function definition your ide will highlight it. Make full use of ide features like QuickFix.


// Implement the method in such a way that it will return new Instance of

// PortfolioManager using RestTemplate provided.

I am not getting how to create an instance of PortfolioManager with the rest template as the PortfolioManager class has no variable of type rest template.

You can get an idea from what has to be done on the basis of return type of the function, here the return type is list which refers to the returning the parsed JSON data from the Tiingo API

Think about how you can create a new instance of a class with given arguments.
Read about parameterized constructors.
Also you are free to add member variables in your class so if a variable is not available create a new one.

I think this should work fine. Try running tests and use debugger if you face any issue.

@Soumyadip The issue seem to be resolved, as you have progressed onto next modules and hence I am closing this topic.

For further queries, you can create a new topic and continue there.