RomelTorres / alpha_vantage

A python wrapper for Alpha Vantage API for financial data.
MIT License
4.3k stars 741 forks source link

`TimeSeries.get_symbol_search` JSON output does not work without pandas #299

Closed kade-robertson closed 3 years ago

kade-robertson commented 3 years ago

Maybe this is expected, but I wasn't sure if this was intentional behaviour.

Other TimeSeries functions are able to function without relying on pandas to produce the output. For example, TimeSeries.get_intraday(ticker = "MSFT") will return the JSON data associated with that request. However, TimeSeries.get_symbol_search(keywords = "MSFT") will fail, citing that pandas hasn't been installed, even though the default behaviour is to directly return the JSON data.

I'm fairly certain it's because of this section of the JSON output handler: https://github.com/RomelTorres/alpha_vantage/blob/a70f110c4883ffe66f2d1f36571a61c2a90e563d/alpha_vantage/alphavantage.py#L239-L252

This block appears to be identical to the way the pandas output option handles lists. However this doesn't make a lot of sense to me -- this should just return the raw JSON array like any other request would return the raw JSON data. Is there a reason for this behaviour?

dhoeppe commented 3 years ago

I share your thought that the part you linked makes no sense, it should not return a DataFrame when the specified output format is JSON.

I submitted a pull request that should fix this issue.

AlphaVantageSupport commented 3 years ago

Temporarily closing this issue due to a prolonged period since the last response was posted. Will re-open if needed.