1773 0

[问答] R语言从quantmod获得沪深300数据,求Adjusted的log return时出错,求解! [推广有奖]

  • 0关注
  • 1粉丝

大专生

63%

还不是VIP/贵宾

-

威望
0
论坛币
766 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
158 点
帖子
9
精华
0
在线时间
105 小时
注册时间
2013-9-16
最后登录
2025-11-10

楼主
小谢O(∩_∩)O 发表于 2016-3-3 16:45:33 |AI写论文
8论坛币
>getSymbols("000300.ss",from="2008-01-03",to="2016-03-02")
[1] "000300.SS"
Warning message:
In download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=", from.m,  :
  downloaded length 109492 != reported length 200
>getSymbols("AAPL",from="2008-01-03",to="2016-03-02")
[1] "AAPL"
Warning message:
In download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=", from.m,  :
  downloaded length 149743 != reported length 200

>AAPL.rtn=diff(log(AAPL $ AAPL.Adjusted))
>HS300=diff(log(000300.ss $ 000300.ss.Adjusted))


Error: unexpected symbol in "HS300=diff(log(000300.ss"
> head(AAPL)
           AAPL.Open AAPL.High AAPL.Low AAPL.Close AAPL.Volume AAPL.Adjusted
2008-01-03    195.41    197.39   192.69     194.93   210516600      25.78894
2008-01-04    191.45    193.00   178.89     180.05   363958000      23.82034
2008-01-07    181.25    183.60   170.23     177.64   518048300      23.50150
2008-01-08    180.14    182.46   170.80     171.25   380954000      22.65611
2008-01-09    171.30    179.50   168.30     179.40   453470500      23.73435
2008-01-10    177.58    181.00   175.41     178.02   370743800      23.55177
> head(`000300.SS`)
           000300.SS.Open 000300.SS.High 000300.SS.Low 000300.SS.Close 000300.SS.Volume 000300.SS.Adjusted
2008-01-03        5422.03        5422.03       5422.03         5422.03                0            5422.03
2008-01-04        5483.65        5483.65       5483.65         5483.65                0            5483.65
2008-01-07        5556.59        5556.59       5556.59         5556.59                0            5556.59
2008-01-08        5528.05        5528.05       5528.05         5528.05                0            5528.05
2008-01-09        5613.76        5613.76       5613.76         5613.76                0            5613.76
2008-01-10        5672.15        5672.15       5672.15         5672.15                0            5672.15
>



在用HS300数据的时候提示错误Error: unexpected symbol in "HS300=diff(log(000300.ss"

用苹果(AAPL)的数据的时候不出错。
求大神指教

关键词:adjusted quantmod 沪深300数据 RETURN adjust reported message return Error 沪深

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-30 06:17