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;

/**
 * 超额收益夏普比率
 */
public class ExcessReturnSharpeRatio extends Rate {

    @Override
    public Double calc(List<CompoundRet> list, Frequency frequency, boolean ifAnnualized) {
//		List<CompoundRet> dateValues = new ArrayList<CompoundRet>();
        for (CompoundRet value : list) {
            if (value.getRetOfFund() == null || value.getRetOfBmk() == null) {
                continue;
            }
//			计算超额收益
//			dateValues.add(new DateValue(value.getEndDate(), value.getRetOfFund()/value.getRetOfBmk()));
            value.setRetOfFund(value.getRetOfFund() - value.getRetOfBmk());
        }
        SharpeRatio sr = new SharpeRatio();
        return sr.calc(list, frequency, ifAnnualized);
    }

}
