73 lines
1.5 KiB
Java
73 lines
1.5 KiB
Java
package quant.rich.emoney.pojo;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.Collections;
|
|
import java.util.HashSet;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Set;
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
import lombok.Data;
|
|
import lombok.experimental.Accessors;
|
|
|
|
@Data
|
|
@Accessors(chain=true)
|
|
public class MultiIndexPlanDetail {
|
|
|
|
/**
|
|
* 指标
|
|
*/
|
|
List<MultiIndexPlanPart> indexes;
|
|
|
|
/**
|
|
* 抓取的 K 线粒度
|
|
*/
|
|
List<Integer> periods;
|
|
|
|
/**
|
|
* 设置抓取周期并去重
|
|
* @param periods
|
|
* @return
|
|
*/
|
|
public MultiIndexPlanDetail setPeriods(List<Integer> periods) {
|
|
if (CollectionUtils.isEmpty(periods)) {
|
|
this.periods = Collections.emptyList();
|
|
return this;
|
|
}
|
|
Set<Integer> hashSet = new HashSet<>();
|
|
periods.forEach(period -> {
|
|
if (period != null) {
|
|
hashSet.add(period);
|
|
}
|
|
});
|
|
this.periods = new ArrayList<>(hashSet);
|
|
return this;
|
|
}
|
|
|
|
/**
|
|
* 获取抓取周期。已去重
|
|
* @return
|
|
*/
|
|
public List<Integer> getPeriods() {
|
|
setPeriods(periods);
|
|
return periods;
|
|
}
|
|
|
|
@Data
|
|
@Accessors(chain=true)
|
|
public static class MultiIndexPlanPart {
|
|
|
|
/**
|
|
* 单指标代码
|
|
*/
|
|
String indexCode;
|
|
|
|
/**
|
|
* 单指标参数
|
|
*/
|
|
Map<String, String> params;
|
|
}
|
|
}
|