从纳斯达克网站下载CSV文件 [英] Download csv file from Nasdaq site

查看:95
本文介绍了从纳斯达克网站下载CSV文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试了一段时间以从Web上简单地在RStudio中下载一个csv文件(所以我正在使用R).我以前做过这样的事情,但从未遇到过我现在遇到的问题.尝试了几种在线建议的解决方案.我只是尝试从此处 https://www.nasdaq下载文件.com/market-activity/stocks/aapl/historical .这是到csv->的链接. https://www.nasdaq.com/api/v1/historical/AAPL/stocks/2020-09-09/2020-10-09 .我尝试了httr和RCurl包方法,但没有用.希望有人能帮助我,谢谢.

I tried now for some time to simply download a csv file in RStudio(so i am using R) from the web. I have done stuff like this before and never run into the issues i have now. Tried several solutions suggested online. I simply try to download the following file from here https://www.nasdaq.com/market-activity/stocks/aapl/historical. This is the link to the csv -> https://www.nasdaq.com/api/v1/historical/AAPL/stocks/2020-09-09/2020-10-09. I tried httr and RCurl package methods none worked. Hope someone can help me out, thanks in advance.

到目前为止我尝试过的是:-更新的SSL-我可以安装新软件包,因此互联网通常都能正常工作-更新了git-更新的R-更新了所有软件包-尝试了此处的建议: Download.file在RStudio中失败

What i tried so far: -Updated ssl -I can install new packages so internet generally works -Updated git -Updated R -Updated all packages -Tried what is suggested here: Download.file fails in RStudio

Edit2:不久前,我使用软件包RSelenium进行了webscrape并开始了rem_session.Rselenium是否有可能更改某些基础设置?

A while ago i did webscrape with the package RSelenium and started a rem_session. Is it possible that Rselenium changes some underlying settings?

Edit3:完全卸载的Rstudio + R + Rtool手动删除了所有内容,全新安装后仍然存在相同的问题

Completely uninstalled Rstudio + R + Rtool manually deleted everything, after a fresh installation still the same problem

推荐答案

如果您使用的是Windows操作系统,则需要设置mode = wb参数.

In case you are in a windows OS you need to set the mode=wb argument.

download.file(
    "https://www.nasdaq.com/api/v1/historical/AAPL/stocks/2020-09-09/2020-10-09",
     "file.csv", mode='wb'
)

这篇关于从纳斯达克网站下载CSV文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆