2020年3月29日日曜日

EPS 2020MAR28

> eps_year_xts["2019::"]
             [,1]
2019-01-01 134.39
2019-04-01 135.27
2019-07-01 132.90
2019-10-01 139.39
2020-01-01 142.11
2020-04-01 147.50
2020-07-01 156.85
2020-10-01 162.94
2021-01-01 166.64
2021-04-01 169.53
2021-07-01 171.27
2021-10-01 174.02

Downloads$ cat eps.txt
12/31/2021 $49.87 $43.89 12.28 13.82 $187.66 $166.82
9/30/2021 $48.78 $44.00 12.63 14.08 $182.50 $163.75
6/30/2021 $46.16 $40.63 13.03 14.49 $176.93 $159.07
3/31/2021 $42.85 $38.30 13.52 14.92 $170.52 $154.52
12/31/2020 $44.71 $40.83 13.96 15.37 $165.09 $149.92
9/30/2020 $43.21 $39.32 14.45 15.94 $159.55 $144.62
6/30/2020 $39.75 $36.07 14.76 16.55 $156.15 $139.29
3/31/2020 $37.42 $33.70 14.72 16.68 $156.54 $138.15
12/31/2019 (97.8%) 3230.78 $39.17 $35.53 14.67 16.53 $157.11 $139.47
9/30/2019  2976.74 $39.81 $33.99 19.46 22.40 $152.97 $132.90
6/30/2019 2941.76 $40.14 $34.93 19.04 21.75 $154.54 $135.27
3/31/2019 2834.40 $37.99 $35.02 18.52 21.09 $153.05 $134.39
Downloads$ tac eps.txt | awk '{gsub("\\$","",$NF);print "eps_year_xts[\"2019::\"]["NR"] <- "$NF}'
eps_year_xts["2019::"][1] <- 134.39
eps_year_xts["2019::"][2] <- 135.27
eps_year_xts["2019::"][3] <- 132.90
eps_year_xts["2019::"][4] <- 139.47
eps_year_xts["2019::"][5] <- 138.15
eps_year_xts["2019::"][6] <- 139.29
eps_year_xts["2019::"][7] <- 144.62
eps_year_xts["2019::"][8] <- 149.92
eps_year_xts["2019::"][9] <- 154.52
eps_year_xts["2019::"][10] <- 159.07
eps_year_xts["2019::"][11] <- 163.75
eps_year_xts["2019::"][12] <- 166.82

2020年3月10日火曜日

1日に+5%以上変動した日を持つそれぞれの月の月間騰落率を計算する




length(index(SP5))
# w <- last(SP5[,4][2:17659]/as.vector(SP5[,4][1:17658]),100)
w <- SP5[,4][1:length(index(SP5))-1]/as.vector(SP5[,4][2:length(index(SP5)) ])
head(w)
#               Close
# 1950-01-04 1.0114046
# 1950-01-05 1.0047478
# 1950-01-06 1.0029533
# 1950-01-09 1.0058893
# 1950-01-10 0.9970727
# 1950-01-11 1.0035231
i <- index(w[w >1.05])
head(i)
# [1] "1950-06-26" "1955-09-26" "1962-05-28" "1987-10-16" "1987-10-19" "1987-10-26"
v <- c()
# calculate seq. num and store it into v.
for(d in seq(1,length(i),1)){v <- append(v,(length(w[paste(as.character(as.Date(index(w[1]))),as.character(as.Date(i[d])),sep='::')])))}
v
substr(as.character(index(w[i])),1,7)
#[1] "1950-06" "1955-09" "1962-05" "1986-09" "1987-10" "1987-10" "1987-10" "1988-01" "1989-10"
#[10] "1997-10" "1998-08" "2000-04" "2001-09" "2008-09" "2008-10" "2008-10" "2008-10" "2008-10"
#[19] "2008-11" "2008-11" "2008-11" "2008-11" "2008-11" "2008-11" "2009-01" "2009-02" "2011-08"
#[28] "2011-08" "2020-03"
# unique(substr(as.character(index(w[i])),1,7))
to.monthly(SP5)[unique(substr(as.character(index(w[i])),1,7))][,4] /to.monthly(SP5)[unique(substr(as.character(index(w[i])),1,7))][,1]


        SP5.Close
 6 1950 0.9424614
 9 1955 1.0069172
 5 1962 0.9140099
 9 1986 0.9145614
10 1987 0.7823696
 1 1988 1.0403480
10 1989 0.9748245
10 1997 0.9655223
 8 1998 0.8542033
 4 2000 0.9692042
 9 2001 0.9182766
 9 2008 0.9056786
10 2008 0.8321379
11 2008 0.9252274
 1 2009 0.9146059
 2 2009 0.8930858
 8 2011 0.9429827
 3 2020 0.9234369

1日に5%以上下落した翌営業日の収益を計算する Next Day Daily return after more than 5% drop



length(index(SP5))
# w <- last(SP5[,4][2:17659]/as.vector(SP5[,4][1:17658]),100)
w <- SP5[,4][2:length(index(SP5))]/as.vector(SP5[,4][1:length(index(SP5)) -1])
head(w)
#               Close
# 1950-01-04 1.0114046
# 1950-01-05 1.0047478
# 1950-01-06 1.0029533
# 1950-01-09 1.0058893
# 1950-01-10 0.9970727
# 1950-01-11 1.0035231
i <- index(w[w <0.95])
head(i)
# [1] "1950-06-26" "1955-09-26" "1962-05-28" "1987-10-16" "1987-10-19" "1987-10-26"
v <- c()
for(d in seq(1,length(i),1)){v <- append(v,(length(w[paste(as.character(as.Date(index(w[1]))),as.character(as.Date(i[d])),sep='::')])))}
v
length(v)
# [1] 25
w[v[-25]+1]


               Close
1950-06-27 0.9889563
1955-09-27 1.0227646
1962-05-29 1.0464865
1987-10-19 0.7953307
1987-10-20 1.0533268
1987-10-27 1.0242456
1988-01-11 1.0168037
1989-10-16 1.0275738
1997-10-28 1.0511522
1998-09-01 1.0386303
2000-04-17 1.0330836
2008-09-30 1.0541747
2008-10-08 0.9886673
2008-10-10 0.9882407
2008-10-16 1.0425075
2008-10-23 1.0126340
2008-11-06 0.9497360
2008-11-07 1.0288546
2008-11-13 1.0692127
2008-11-20 0.9328771
2008-11-21 1.0632476
2008-12-02 1.0399407
2009-01-21 1.0434912
2011-08-09 1.0474068

2020年3月8日日曜日

EPS 2020MAR08



R$ tac eps.txt
3/31/2019 2834.40 $37.99 $35.02 18.52 21.09 $153.05 $134.39
6/30/2019 2941.76 $40.14 $34.93 19.04 21.75 $154.54 $135.27
9/30/2019  2976.74 $39.81 $33.99 19.46 22.40 $152.97 $132.90
12/31/2019 (96.3%) 3230.78 $39.21 $35.78 18.80 21.14 $157.15 $139.72
3/31/2020 $38.76 $35.25 18.71 21.11 $157.92 $139.95
6/30/2020 $42.67 $38.82 18.41 20.54 $160.45 $143.83
9/30/2020 $45.42 $41.71 17.79 19.49 $166.06 $151.55
12/31/2020 $46.19 $42.64 17.07 18.65 $173.04 $158.41
3/31/2021 $44.08 $39.97 16.56 18.11 $178.36 $163.13
6/30/2021 $47.60 $42.53 16.12 17.71 $183.29 $166.84
9/30/2021 $50.10 $45.41 15.72 17.32 $187.97 $170.55
12/31/2021 $51.00 $45.59 15.32 17.03 $192.78 $173.50
R$ tac eps.txt | awk '{gsub("\\$","",$NF);print "eps_year_xts[\"2019::\"]["NR"] <- "$NF}'
eps_year_xts["2019::"][1] <- 134.39
eps_year_xts["2019::"][2] <- 135.27
eps_year_xts["2019::"][3] <- 132.90
eps_year_xts["2019::"][4] <- 139.72
eps_year_xts["2019::"][5] <- 139.95
eps_year_xts["2019::"][6] <- 143.83
eps_year_xts["2019::"][7] <- 151.55
eps_year_xts["2019::"][8] <- 158.41
eps_year_xts["2019::"][9] <- 163.13
eps_year_xts["2019::"][10] <- 166.84
eps_year_xts["2019::"][11] <- 170.55
eps_year_xts["2019::"][12] <- 173.50