Execution условие на маркет
This commit is contained in:
parent
d5366ab2a1
commit
f21bafb2d7
6 changed files with 19 additions and 7 deletions
|
|
@ -4,14 +4,19 @@ import java.time.LocalDate;
|
|||
import java.util.Objects;
|
||||
import ru.clearing.classes.statics.data.execution.ExecutionCommon;
|
||||
|
||||
public record ExecUploadKey(LocalDate tradeDate, Long exchangeExecutionId, String side) {
|
||||
public record ExecUploadKey(LocalDate tradeDate, Long exchangeExecutionId, String market, String side) {
|
||||
|
||||
public static ExecUploadKey cash(LocalDate tradingDate, Long exchangeExecutionId, String side) {
|
||||
return new ExecUploadKey(tradingDate, exchangeExecutionId, side);
|
||||
public static ExecUploadKey cash(LocalDate tradingDate, Long exchangeExecutionId, String market, String side) {
|
||||
return new ExecUploadKey(tradingDate, exchangeExecutionId, market, side);
|
||||
}
|
||||
|
||||
public static ExecUploadKey cash(ExecutionCommon exec) {
|
||||
return new ExecUploadKey(exec.getTradingDate(), exec.getExchangeExecutionId(), exec.getSide());
|
||||
return new ExecUploadKey(
|
||||
exec.getTradingDate(),
|
||||
exec.getExchangeExecutionId(),
|
||||
exec.getMarket(),
|
||||
exec.getSide()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -176,6 +176,7 @@ public class ExecutionCurrencyComponent implements IExecutionUploadComponent {
|
|||
// MoneyFlowSide excDepSide = sTrdSide == Side.BUY ? MoneyFlowSide.BUY : MoneyFlowSide.SELL;
|
||||
ExecUploadKey excKey = ExecUploadKey.cash(sTrd.getTradeDate(),
|
||||
sTrd.getTradeNum(),
|
||||
sTrd.getClassCode(),
|
||||
sTrdSide.getKey());
|
||||
return cash.containsKey(excKey);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -160,6 +160,7 @@ public class ExecutionDepositComponent implements IExecutionUploadComponent {
|
|||
MoneyFlowSide excDepSide = sTrdSide.equals(Side.BUY) ? MoneyFlowSide.BUY : MoneyFlowSide.SELL;
|
||||
ExecUploadKey excKey = ExecUploadKey.cash(sTrd.getTradeDate(),
|
||||
sTrd.getTradeNum(),
|
||||
sTrd.getClassCode(),
|
||||
excDepSide.getKey());
|
||||
return cash.containsKey(excKey);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -189,6 +189,7 @@ public class ExecutionFondComponent implements IExecutionUploadComponent {
|
|||
Side excDepSide = sTrdSide.equals(Side.BUY) ? Side.BUY : Side.SELL;
|
||||
ExecUploadKey excKey = ExecUploadKey.cash(sTrd.getTradeDate(),
|
||||
sTrd.getTradeNum(),
|
||||
sTrd.getClassCode(),
|
||||
excDepSide.getKey());
|
||||
return cash.containsKey(excKey);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import ru.spcex.platform.imdg.api.predicate.ImdgPredicate;
|
|||
import ru.spcex.platform.imdg.api.predicate.ImdgPredicateBuilder;
|
||||
import ru.spcex.platform.imdg.api.predicate.specific.RegistryCodeSqlBuilder;
|
||||
import ru.spcex.platform.utils.enumeration.IEnumKey;
|
||||
import ru.spcex.platform.utils.text.TextUtil;
|
||||
|
||||
@Component
|
||||
public class KSCommissionTradesReportBuilder extends CSVReportBuilder<EmptyParams, KSCommissionTradesReport> {
|
||||
|
|
@ -168,6 +169,8 @@ public class KSCommissionTradesReportBuilder extends CSVReportBuilder<EmptyParam
|
|||
Collection<ExecutionDeposit> executionDeposits = executionDepositImdg.getCollectionObjectsByPredicate(
|
||||
pb.and(
|
||||
pb.equals("exchangeExecutionId", registry.getGroupId()),
|
||||
TextUtil.isEmpty(registry.getMarket()) ?
|
||||
pb.alwaysTrue() : pb.equals("market", registry.getMarket()),
|
||||
pb.notNull("market")
|
||||
)
|
||||
);
|
||||
|
|
|
|||
|
|
@ -149,6 +149,7 @@ public class KSRepTradesReportBuilder extends CSVReportBuilder<EmptyParams, KSRe
|
|||
Collection<Registry> registryCollection = registryImdg.getCollectionObjectsByPredicate(
|
||||
pbRegistry.and(
|
||||
pbRegistry.equals("groupId", groupId),
|
||||
pbRegistry.equals("market", execution.getMarket()), //fixme может быть "старый" registry без market
|
||||
pbRegistry.equals("companyId", execution.getCompanyId()),
|
||||
pbRegistry.in("registryStatus",
|
||||
RegistryStatus.NACC.getKey(),
|
||||
|
|
@ -170,7 +171,7 @@ public class KSRepTradesReportBuilder extends CSVReportBuilder<EmptyParams, KSRe
|
|||
}
|
||||
}
|
||||
}
|
||||
statusForExecution.put(new ExecutionKey(groupId, execution.getSessionId()), status);
|
||||
statusForExecution.put(new ExecutionKey(groupId, execution.getMarket(), execution.getSessionId()), status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -365,7 +366,7 @@ public class KSRepTradesReportBuilder extends CSVReportBuilder<EmptyParams, KSRe
|
|||
status = "2";
|
||||
} else if (execution instanceof ExecutionFond) {
|
||||
Long groupId = execution.getExchangeExecutionId();
|
||||
status = statusForExecution.get(new ExecutionKey(groupId, execution.getSessionId()));
|
||||
status = statusForExecution.get(new ExecutionKey(groupId, execution.getMarket(), execution.getSessionId()));
|
||||
if (status == null) {
|
||||
log.warn(
|
||||
"Broken execution (can't define status). Registry for groupId = {}, companyId = {} not found. Execution (id = {}) skipped",
|
||||
|
|
@ -390,6 +391,6 @@ public class KSRepTradesReportBuilder extends CSVReportBuilder<EmptyParams, KSRe
|
|||
}
|
||||
}
|
||||
|
||||
private record ExecutionKey(Long groupId, Long sessionId) {
|
||||
private record ExecutionKey(Long groupId, String market, Long sessionId) {
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue