如何开始使用 oauth for YQL 获取历史股票数据?
在我寻找市场数据源时,我被引导至雅虎财经的 YQL。它看起来很棒,对于公共使用/查询来说非常简单,但是公共版本的每日限制对于我的需求来说太小了。我得到了我的 yahoo ID 来开始使用 oauth,但我找不到任何好的例子关于我正在尝试做的事情...
我想使用 C# 中的桌面应用程序“登录”,然后继续下载感兴趣的数据。如何使用誓言维度?作为参考,我的背景是使用 html 敏捷包进行简单的屏幕抓取,我从未有过任何 Web 服务的经验。谁能让我开始。我现在陷入困境(并且已经花了整整一周的时间)。提前致谢...
in my search for a market data feed, I've been led to YQL for yahoo finance. It looks great, and very simple for the public use/ queries, but the daily limit for the public version is too small for my needs.. I got my yahoo ID to get started with oauth, but I can't find any good examples pertaining to what I'm trying to do...
I'd like to "sign in" with my desktop app in C#, and proceed to download data of interest. How do I use the oath dimension? My background as a point of reference is simple screen- scraping with the html agility pack, I've never had any experience with web services. Can anyone get me started. I'm stuck at the moment (and have been all week on this). Thanks in advance...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在本例中,您正在访问公共数据(而不是用户私有数据),因此您将使用 OAuth 两条腿授权。 YDN 网站上的此页面是了解不同数据类型的良好起点:私人数据与公共数据。
两条腿意味着您需要以某种方式签署您的请求(使用您的应用程序密钥和秘密),但没有用户授权步骤。 OAuth 签名通常很棘手,因此大多数人会使用 OAuth 库。
YQL 代码示例有一个很好的演练说明这一点的页面。向下滚动到“查询公共数据”部分,查看使用签名的两腿请求调用 YQL 的示例。
运行上面的代码会提供一些历史股票数据,例如:
当然,您正在询问 C#,但希望这能为您提供更多关于所需内容的背景知识。我会搜索 C# 的两条腿 OAuth 解决方案 - 这个问题看起来有一些有效的答案: 有人使用 DNOA 实现了 2 Legged OAuth 吗?。
这是另一个可能的解决方案,一个为您执行两条腿 OAuth 签名的 Web 服务:OAuth-ify:YQL 的 2 足 OAuth 服务。
In this case you are accessing public data (as opposed to user private data), so you'll be using OAuth two-legged authorization. This page on the YDN site is a good starting point for the different data types: Private Data v Public Data.
Two-legged means you need to sign your request a certain way (with your application key & secret), but there is no user-authorization step. OAuth signing is usually tricky, so most people will use an OAuth library.
There is a good walk-through on the YQL Code Examples page that illustrates this. Scroll down to the "Querying Public Data" section to see examples of calling YQL with a signed two-legged request.
Running the above code gives some historical stock data like:
Of course you're asking about C#, but hopefully this gives you more background on what will be needed. I would search for two-legged OAuth solutions for C# - this question looks to have some working answers: Has anybody implemented 2 Legged OAuth using DNOA?.
Here's another possible solution, a web service that does the two-legged OAuth signing for you: OAuth-ify this: 2-legged OAuth service for YQL.