package com.smppw.core.reta.calc;


import com.smppw.common.pojo.dto.CompoundRet;
import com.smppw.common.pojo.enums.Frequency;
import com.smppw.core.reta.Rate;

import java.util.List;

/**
 * @author zhengsongliang
 */
public class WinRateWithZero extends Rate {

	@Override
	public Double calc(List<CompoundRet> list, Frequency frequency, boolean ifAnnualized) {
		Double count = 0D;
		for (CompoundRet unit : list) {
			if (unit.getRetOfFund() != null && unit.getRetOfFund() > 0) {
				count++;
			}
		}
		return count / (list.size() - 1);
	}

}
