package com.smppw.core.reta.calc;

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

import java.util.Collections;
import java.util.List;

/**
 * @author zhengsongliang
 */
public class SingleMaxDrawdown extends Rate {
	@Override
	public Double calc(List<CompoundRet> list, Frequency frequency, boolean ifAnnualized) {
		if (list.isEmpty())
			return null;
		List<Double> fundRetList = IndicatorCalc.getFundRetList(list);
		if (fundRetList.size() == 0) {
			return null;
		}
		return Collections.min(fundRetList);
	}
}
