tq_exchange returning error message
mcfsalla opened this issue · comments
The tq_exchange function is returning the same error for any exchange:
Error: Can't rename columns that don't exist.
x Column 'Symbol' doesn't exist.
Here's the website. https://www.nasdaq.com/market-activity/stocks/screener?exchange=nyse
I can't find the link that will download the CSV from it. Seems like they don't want people getting the CSV via CURL.
I ran into the same issue. I found when you click on the download CSV button there is an API call made that returns a JSON envelope back with the info. No authorization header required.
The exchange can be tweaked, the limit=25 doesn't seem to matter.
Awesome! This could be the solution.
Ran into the same problem:
tq_exchange("NASDAQ")
Error: Can't rename columns that don't exist.
x Column `Symbol` doesn't exist.
Looking for guidance from the team, It seems like this is the path to a solution:
https://stackoverflow.com/questions/37996827/convert-json-file-to-a-csv-file-using-r
Agree?
I ended up using httr's GET() function which can do json parsing. It produces a data frame with the column headers and a list of rows, each being a list of values.
Solution seems straightforward. I'm tied up and won't be able to tackle for a bit. If someone can make a pull request, it would be much appreciated. Otherwise I'll tackle once I get some free time.
I tried to fix it, works for me: #194
Until this fix gets to CRAN please install using:
remotes::install_github("business-science/tidyquant")