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.setTkr(registry.getTradingClearingRegistry());
|
||||||
ksRepCashNettoReport.setDate(nowDate);
|
ksRepCashNettoReport.setDate(nowDate);
|
||||||
|
|
||||||
BigDecimal cmtBalance = null;
|
BigDecimal cmtBalance = BigDecimal.ZERO;
|
||||||
BigDecimal lmtBalance = null;
|
BigDecimal lmtBalance = BigDecimal.ZERO;
|
||||||
BigDecimal oblValue = null;
|
BigDecimal oblValue = BigDecimal.ZERO;
|
||||||
BigDecimal reqValue = null;
|
BigDecimal reqValue = BigDecimal.ZERO;
|
||||||
|
boolean withValue = false;
|
||||||
|
boolean withOblReqValue = false;
|
||||||
Set<SessionType> sessionTypeForValue = Set.of(
|
Set<SessionType> sessionTypeForValue = Set.of(
|
||||||
SessionType.IPOT,
|
SessionType.IPOT,
|
||||||
SessionType.TRDT,
|
SessionType.TRDT,
|
||||||
|
|
@ -196,12 +198,12 @@ public class KSRepCashNettoReportBuilder extends CSVReportBuilder<SessionIdParam
|
||||||
SessionType sessionType = IEnumKey.getEnumByKey(SessionType.class, cmtRegistry.getSessionType());
|
SessionType sessionType = IEnumKey.getEnumByKey(SessionType.class, cmtRegistry.getSessionType());
|
||||||
if (sessionType == null) continue;
|
if (sessionType == null) continue;
|
||||||
if (sessionTypeForValue.contains(sessionType)) {
|
if (sessionTypeForValue.contains(sessionType)) {
|
||||||
if (cmtBalance == null) cmtBalance = BigDecimal.ZERO;
|
|
||||||
cmtBalance = cmtBalance.add(cmtRegistry.getBalance());
|
cmtBalance = cmtBalance.add(cmtRegistry.getBalance());
|
||||||
|
withValue = true;
|
||||||
}
|
}
|
||||||
if (sessionTypeForOblReqValue.contains(sessionType)) {
|
if (sessionTypeForOblReqValue.contains(sessionType)) {
|
||||||
if (reqValue == null) reqValue = BigDecimal.ZERO;
|
|
||||||
reqValue = reqValue.add(cmtRegistry.getBalance());
|
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());
|
SessionType sessionType = IEnumKey.getEnumByKey(SessionType.class, lmtRegistry.getSessionType());
|
||||||
if (sessionType == null) continue;
|
if (sessionType == null) continue;
|
||||||
if (sessionTypeForValue.contains(sessionType)) {
|
if (sessionTypeForValue.contains(sessionType)) {
|
||||||
if (lmtBalance == null) lmtBalance = BigDecimal.ZERO;
|
|
||||||
lmtBalance = lmtBalance.add(lmtRegistry.getBalance());
|
lmtBalance = lmtBalance.add(lmtRegistry.getBalance());
|
||||||
|
withValue = true;
|
||||||
}
|
}
|
||||||
if (sessionTypeForOblReqValue.contains(sessionType)) {
|
if (sessionTypeForOblReqValue.contains(sessionType)) {
|
||||||
if (oblValue == null) oblValue = BigDecimal.ZERO;
|
|
||||||
oblValue = oblValue.add(lmtRegistry.getBalance());
|
oblValue = oblValue.add(lmtRegistry.getBalance());
|
||||||
|
withOblReqValue = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BigDecimal value;
|
BigDecimal value;
|
||||||
if (cmtBalance != null) {
|
value = cmtBalance.subtract(lmtBalance);
|
||||||
value = cmtBalance.subtract(Objects.requireNonNullElse(lmtBalance, BigDecimal.ZERO));
|
ksRepCashNettoReport.setValue(withValue ? value : null);
|
||||||
}
|
ksRepCashNettoReport.setOblValue(withOblReqValue ? oblValue : null);
|
||||||
else {
|
ksRepCashNettoReport.setReqValue(withOblReqValue ? reqValue : null);
|
||||||
if (lmtBalance != null) value = lmtBalance.negate();
|
|
||||||
else value = null;
|
|
||||||
}
|
|
||||||
ksRepCashNettoReport.setValue(value);
|
|
||||||
ksRepCashNettoReport.setOblValue(oblValue);
|
|
||||||
ksRepCashNettoReport.setReqValue(reqValue);
|
|
||||||
|
|
||||||
rows.add(ksRepCashNettoReport);
|
rows.add(ksRepCashNettoReport);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue