package com.smppw.core.reta.calc;


import com.smppw.constants.Consts;
import com.smppw.common.pojo.dto.CompoundRet;
import com.smppw.common.pojo.enums.Frequency;
import com.smppw.core.reta.Rate;
import com.smppw.utils.FunctionUtil;

import java.util.List;

/**
 * @author zhengsongliang
 * @datetime 2017年7月25日 上午10:29:01
 */
public class HistoricalCVaR extends Rate {

	private Double prob;

	public HistoricalCVaR(){}

	public HistoricalCVaR(Double prob){
		this.prob = prob;
	}

	@Override
	public Double calc(List<CompoundRet> list, Frequency frequency, boolean ifAnnualized) {
		Double historicalCVaR = FunctionUtil.HistoricalCVaR(prob == null ? Consts.PROB : prob, FunctionUtil.getFundRetList(list));
		return historicalCVaR;
	}

}
