如何找到网站API提取图形数据?
https://wwwww.okx.com/markets/markets/spot-data/spot-data/btc-btc--btc--btc- USDT 。我想使用R提取数据。尽管我在Stackoverlfow上找到了类似的帖子来做到这一点。我似乎找不到此网站的API。我检查了所有XHR文件,没有链接?这是否意味着隐藏?我只想要“ BTC保证金贷款比率”的API,
谢谢。
https://www.okx.com/markets/spot-data/btc-usdt . I'd like to extract the data using R. Although I found a similar post on stackoverlfow to do this. I can't seem to find the API for this website. I checked all the XHR files and there is no link? does that mean it's hidden? I only want the api for the " BTC Margin lending Ratio"
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
XHR请求将数据作为JSON获取以制作图形。解析并复制情节非常简单。
为了使其更有用,您可以将其包装在启动日期和(可选)结束日期的函数中,并返回带有日期和值列的数据框架:
例如,自1月1日以来获取每日值的数据框架我们可以做:
我们可以这样绘制它:
nofollow noreferrer“> reprex软件包(v2.0.1)
The XHR requests fetch the data as json to make the graph. It's pretty straightforward to parse this and replicate the plot.
To make it more useful, you can wrap this in a function that takes a start date and (optional) end date and returns a data frame with a date and value column:
For example, to get a data frame of daily values since 1st January we can do:
And we can plot it like this:
Created on 2022-06-13 by the reprex package (v2.0.1)