This commit is contained in:
parent
5639f9ff8b
commit
970da463fc
1 changed files with 14 additions and 18 deletions
|
|
@ -175,10 +175,12 @@ public class KSRepCashNettoReportBuilder extends CSVReportBuilder<SessionIdParam
|
|||
ksRepCashNettoReport.setTkr(registry.getTradingClearingRegistry());
|
||||
ksRepCashNettoReport.setDate(nowDate);
|
||||
|
||||
BigDecimal cmtBalance = null;
|
||||
BigDecimal lmtBalance = null;
|
||||
BigDecimal oblValue = null;
|
||||
BigDecimal reqValue = null;
|
||||
BigDecimal cmtBalance = BigDecimal.ZERO;
|
||||
BigDecimal lmtBalance = BigDecimal.ZERO;
|
||||
BigDecimal oblValue = BigDecimal.ZERO;
|
||||
BigDecimal reqValue = BigDecimal.ZERO;
|
||||
boolean withValue = false;
|
||||
boolean withOblReqValue = false;
|
||||
Set<SessionType> sessionTypeForValue = Set.of(
|
||||
SessionType.IPOT,
|
||||
SessionType.TRDT,
|
||||
|
|
@ -196,12 +198,12 @@ public class KSRepCashNettoReportBuilder extends CSVReportBuilder<SessionIdParam
|
|||
SessionType sessionType = IEnumKey.getEnumByKey(SessionType.class, cmtRegistry.getSessionType());
|
||||
if (sessionType == null) continue;
|
||||
if (sessionTypeForValue.contains(sessionType)) {
|
||||
if (cmtBalance == null) cmtBalance = BigDecimal.ZERO;
|
||||
cmtBalance = cmtBalance.add(cmtRegistry.getBalance());
|
||||
withValue = true;
|
||||
}
|
||||
if (sessionTypeForOblReqValue.contains(sessionType)) {
|
||||
if (reqValue == null) reqValue = BigDecimal.ZERO;
|
||||
reqValue = reqValue.add(cmtRegistry.getBalance());
|
||||
withOblReqValue = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -210,26 +212,20 @@ public class KSRepCashNettoReportBuilder extends CSVReportBuilder<SessionIdParam
|
|||
SessionType sessionType = IEnumKey.getEnumByKey(SessionType.class, lmtRegistry.getSessionType());
|
||||
if (sessionType == null) continue;
|
||||
if (sessionTypeForValue.contains(sessionType)) {
|
||||
if (lmtBalance == null) lmtBalance = BigDecimal.ZERO;
|
||||
lmtBalance = lmtBalance.add(lmtRegistry.getBalance());
|
||||
withValue = true;
|
||||
}
|
||||
if (sessionTypeForOblReqValue.contains(sessionType)) {
|
||||
if (oblValue == null) oblValue = BigDecimal.ZERO;
|
||||
oblValue = oblValue.add(lmtRegistry.getBalance());
|
||||
withOblReqValue = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
BigDecimal value;
|
||||
if (cmtBalance != null) {
|
||||
value = cmtBalance.subtract(Objects.requireNonNullElse(lmtBalance, BigDecimal.ZERO));
|
||||
}
|
||||
else {
|
||||
if (lmtBalance != null) value = lmtBalance.negate();
|
||||
else value = null;
|
||||
}
|
||||
ksRepCashNettoReport.setValue(value);
|
||||
ksRepCashNettoReport.setOblValue(oblValue);
|
||||
ksRepCashNettoReport.setReqValue(reqValue);
|
||||
value = cmtBalance.subtract(lmtBalance);
|
||||
ksRepCashNettoReport.setValue(withValue ? value : null);
|
||||
ksRepCashNettoReport.setOblValue(withOblReqValue ? oblValue : null);
|
||||
ksRepCashNettoReport.setReqValue(withOblReqValue ? reqValue : null);
|
||||
|
||||
rows.add(ksRepCashNettoReport);
|
||||
} catch (Throwable e) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue