我需要从Yahoo Finance api获取所有股票数据。但是考虑到这个表的安全级别,我无法在http请求的帮助下实现它。
等级1
我找到了YDL YDL的财务表列表,其中包含“显示表格”并获得结果:
<table security="APP">pm.finance</table>
<table security="APP">pm.finance.articles</table>
<table security="APP">pm.finance.autocomplete</table>
<table security="APP">pm.finance.graphs</table>
<table security="APP">pm.finance.markettickers</table>
等级2
当我尝试这个命令“ desc pm.finance ”时,我得到了:
<?xml version="1.0" encoding="UTF-8"?>
<query xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" yahoo:count="1" yahoo:created="2017-12-13T13:24:57Z" yahoo:lang="en-US">
<results>
<table hash="a8196c4d279e0e28fb671a81b9a40bd3" name="pm.finance" security="APP">
<meta>
<sampleQuery>
select * from pm.finance where symbol="YHOO"
</sampleQuery>
</meta>
<request>
<select>
<key name="symbol" required="true" type="xs:string"/>
</select>
</request>
</table>
</results>
</query>
等级3
当我尝试使用示例查询select * from pm.finance where symbol="YHOO"
时,出现此错误:
<?xml version="1.0" encoding="UTF-8"?>
<error xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" yahoo:lang="en-US">
<description>Authentication Error. The table pm.finance requires a higher security level than is provided, you provided ANY but at least APP is expected</description>
我需要在http请求级别实现实现。使用C#HttpWebrequest或HttpClient。来自datatables.com的YDL quides处于非活动状态。我不知道如何使用它。