[英]MATLAB Yahoo data feed error
I'm trying to use Yahoo API in MATLAB R2015a to retrieve historical data (prices) for commodities. 我正在尝试在MATLAB R2015a中使用Yahoo API来检索商品的历史数据(价格)。 I can get the price for current date, but not for a historical date range.
我可以获取当前日期的价格,但不能获取历史日期范围的价格。 So for example Last price for CK15.CBT Corn May 15:
因此,例如CK15.CBT玉米5月15日的最新价格:
clear
clc
c = yahoo;
a = fetch(c,'CK15.CBT','Last');
disp (a);
d = fetch(c,'CK15.CBT','Last','02/02/15','02/05/15');
disp (d);
Displaying "a" works ok, but "d" returns the following error messages: 显示“ a”可以,但是“ d”返回以下错误消息:
Error using yahoo/fetch>isdatafield (line 543)
Current data field specified but historical data requested.
Error in yahoo/fetch (line 74)
elseif isdatafield(varargin{1},numinputs)
Error in Untitled (line 7)
d = fetch(c,'CK15.CBT','Last','02/02/15','02/05/15');
Could you please help me how to work with yahoo API in MATLAB to get commodities prices for specified time range? 您能帮我如何在MATLAB中使用yahoo API以获得指定时间范围内的商品价格吗? Or do you have a suggestion for any other way how to do it?
还是您对其他方法有什么建议?
Thank you 谢谢
I don't have the Datafeed toolbox so I cannot check, but you probably don't want to invoke the parameter 'Last'
when you request a range of values. 我没有数据馈送工具箱,因此无法检查,但是当您请求一个值范围时,您可能不想调用参数
'Last'
。
d = fetch(c,'CK15.CBT','02/02/15','02/05/15');
should work better. 应该更好地工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.