quant
ind1 <- which(tmp$market_per < x )
ind2 <- sort(c(ind1,ind1+1))
ans <- tmp[ind2,]
a <- ans$other_clo[seq(2,nrow(ans),2)]/ans$other_clo[seq(1,nrow(ans),2)]-1
a<- f.rNA(a)
a <- a[-which(a==max(a),arr.ind = TRUE)]
per <- mean(a)
t.s <- t.test(a)
t_value <- unname(t.s$statistic)
num=length(a)/2
res <- data.frame(other_profit=per,other_Tvalue=t_value,other_index=x,other_num=num)
result <- rbind(result,res)
x=x+0.1
}
table(substr(ans$date,1,4))/2
mean(ans$other_per[seq(2,nrow(ans),2)],na.rm=T)
result$cum <- result$other_profit*result$other_num
result