package com.smppw.core.reta.calc;


import com.smppw.common.pojo.dto.DateValue;
import com.smppw.common.pojo.enums.Indicator;
import com.smppw.utils.CalcUtils;
import com.smppw.core.reta.Rate;
import com.smppw.utils.CommonUtil;

import java.util.List;

public class MaxDrawdownPeakDate extends Rate {

    @Override
    public Double calc(List<DateValue> dateValues) {
        String v = CalcUtils.getMaxDrawdownInfo(dateValues).get(Indicator.MaxDrawdownPeakDate);
        return v == null ? null : CommonUtil.string2Double(String.join("", v.split("-")));
    }
}
