private static RateCalculation parseOvernightRateCalculation(
CsvRow row,
String leg,
OvernightIndex overnightIndex,
OvernightAccrualMethod accrualMethod) {
OvernightRateCalculation.Builder builder = OvernightRateCalculation.builder();
builder.index(overnightIndex);
builder.accrualMethod(findValue(row, leg, ACCRUAL_METHOD_FIELD)
.map(s -> OvernightAccrualMethod.of(s))
.orElse(accrualMethod));
findValue(row, leg, DAY_COUNT_FIELD)
.map(s -> LoaderUtils.parseDayCount(s))
.ifPresent(v -> builder.dayCount(v));
findValue(row, leg, RATE_CUT_OFF_DAYS_FIELD)
.map(s -> Integer.valueOf(s))
.ifPresent(v -> builder.rateCutOffDays(v));
findValue(row, leg, NEGATIVE_RATE_METHOD_FIELD).map(s -> NegativeRateMethod.of(s))
.ifPresent(v -> builder.negativeRateMethod(v));
findValue(row, leg, GEARING_FIELD)
.map(s -> LoaderUtils.parseDouble(s))
.ifPresent(v -> builder.gearing(ValueSchedule.of(v)));
findValue(row, leg, SPREAD_FIELD)
.map(s -> LoaderUtils.parseDoublePercent(s))
.ifPresent(v -> builder.spread(ValueSchedule.of(v)));
return builder.build();
}