What to do if the endDay might be a off day and no data is available for the particular day?

What to do if the endDay might be a off day and no data is available for the particular day?
I’m stuck at module 2.

While calling the Tiingo API, there could be a case where the might not be an End-Date provided
In that case, you need to extract data for the latest date .

It says close price at endDate. So if the endDate provided was a holiday, the close price of the day before will be retained for that day.

Try fetching the historical data for stock price using TiingoApi for a sample date range using postman. You fill find your answer.
For example you can use: https://api.tiingo.com/tiingo/daily/aapl/prices?startDate=2019-1-2&endDate=2019-1-6&token=<your_token>

In this case you can use the information for the latest date just before the given endDate

Yes there might be a off day, and no data will be available. But you need not worry about it.

Lets say end date you provided is 26th of Dec, but there’s no data available on 24th 25th and 26th of Dec, The last day for which the data available is on 23rd of Dec. In that case you fetch the data from 23rd itself. You don’t have to worry much about it.
Fetch the data from the last element of the api result list. All your problems will be solved.

And even in the case where enddate is not provided. Just fetch the latest result & that only means,fetch the data from the last element of the api result

Hi @razdeep,

A simple solution to this situation would be to always use the last element of the returned objects when you are considering the right object for extracting close price.

This way, it won’t matter if data for endDate is available or not, since you automatically use the data for latest date available.

Let me know if this helps!

Hey @razdeep,

Please make a use of postman and make a call usong different different dates and try to find out the patterns for how the data are coming from the api call.
In most of the cases are data are not available at some of the dates but api will always provide you a brief data upto the latest date as possible which you have applied.
You don’t have to hardcode anything just make an api call and use debugger to see the response you get.

You have to use the last date for which the data is available.

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.