[Feature Request] Add support for fetching intraday volume data in the get_dataframe method
For intraday prices, Tiingo can provide the IEX volume if explicitly requested as "?columns=open,high,low,close,volume" per their docs.
Unfortunately the get_dataframe doesn't expose this, when no metric_name is provided, it passes no value for the column parameter to Tiingo's APIs
url = self._get_url(stock, frequency)
response = self._request('GET', url, params=params)
df = pd.DataFrame(response.json())
I recommend providing a way to request the volume optionally so that the user can get all fields for OHLCV (and choose to discard volume as it may not be complete, or use it with that understanding)
Hi @whyrv ,
This is great feedback, thanks for taking a look and providing this idea! When thinking about how to expose this to users, how would you feel if metric_name can be provided as either a list of strings, or as a single string (for the single metric case)? In the case where metric_name was provided as a list, we could thread that through to _get_url as you've suggested.
Hi, your suggestion makes sense. I hacked this locally by overriding this method by passing an additional flag includeIntradayVolume as follows
def get_dataframe(self, tickers,
startDate=None, endDate=None, metric_name=None, frequency='daily', includeIntradayVolume=True):
#...
# append volume to columns appropriately under the right conditions: intraday and this flag is set.
params['columns'] = 'open,high,low,close,volume'
You could do this and document that volume is IEX only for intraday or flip the boolean.
thanks for looking into this.
Hi @whyrv, happy to hear that this worked, thanks for sharing your solution. I'd be happy to review a PR if you are interested in making a PR with this adjustment, otherwise I'll leave this open for contributions / add it next time I cut a feature release .
Hello @whyrv, could you may detail your solution a little bit more? I am unfortunaltely not able to come across with an workaround. Thanks!
Cheers
Hi,
This is the relevant set of changes I had made (search for ### below) in the get_dataframe API I mentioned above.
regards.
valid_columns = {'open', 'high', 'low', 'close', 'volume', 'adjOpen', 'adjHigh', 'adjLow',
'adjClose', 'adjVolume', 'divCash', 'splitFactor'}
if metric_name is not None and metric_name not in valid_columns:
raise APIColumnNameError('Valid data items are: ' + str(valid_columns))
if metric_name is None and isinstance(tickers, list):
raise MissingRequiredArgumentError("""When tickers is provided as a list, metric_name is a required argument.
Please provide a metric_name, or call this method with one ticker at a time.""")
params = {
'format': 'json',
'resampleFreq': frequency,
}
### -> this here is key, you need to pass these as columns for getting intraday.
if includeIntradayVolume:
params['columns'] = 'open,high,low,close,volume'
if startDate:
params['startDate'] = startDate
if endDate:
params['endDate'] = endDate
Hi,
thanks for the quick reply. That is really strange. Basically, I did the same but I had the if includeIntradayVolume line below the endDate, which did not seem to work.
@hydrosquall I could work on getting a PR later this week.
That would be very welcome! Thanks @datatalking
So I looked for the 'get_dataframe' method, it doesn't look like anybody actually specifically named in which file since it's in three. I'm guessing you are talking about test_tingo_pandas.py? That method is also in api.py and basic-usage-with-pandas.ipynb
Ok, I think I found it and made the change, not sure if this is the exact place you were thinking so here is a screen shot.

The other part of the solution is adding the additional parameter includeIntradayVolume=True in after the fmt=json like this?
Which creates my next question, how do you have it defined?
Is it the int64 defined here? Tiingo Docs Section 2.5.3 Historical Intraday Prices Endpoint gave
https://api.tiingo.com/iex/<ticker>/prices?startDate=2019-01-02&resampleFreq=5min as an RESTendpoint
Tiingo can also provide the fmt="CSV" so would an additional documentation issue be good to add that?
https://api.tiingo.com/documentation/general/overview Section 1.14

@datatalking @hydrosquall Any update on this issue? I really need volume data wtih intraday, need to pass volume to the columns params as mentioned in doc,, but not sure how to do with this library?
The number of shares traded on IEX only. This value will only be exposed if explicitly passed to the "columns" request parameter. E.g. ?columns=open,high,low,close,volume
Hey @rizclive , the https://github.com/hydrosquall/tiingo-python/pull/673 PR hasn't been worked on in a while.
I think you would be able to get the volume data without further code changes if you request the metric with name "volume" directly:
ticker_history = client.get_dataframe("some-iex-ticker", metric_name='volume')
@rizclive and @hydrosquall I've not worked on this since OP, I could look at it this weekend if this feature still needed or available?
@hydrosquall I have tried passing metric_name='volume' but its doesn't seems to be working when I specify lower timeframe then daily. @datatalking would be good to get this feature released.
Thanks! Riz