fix ExecutionReport checking field values

This commit is contained in:
mmarkelov 2026-04-29 16:26:27 +03:00
parent 5b0438f99b
commit 31c54dae8f

View file

@ -113,17 +113,10 @@ public class Application extends MessageCracker implements quickfix.Application,
ImdgTransaction transaction = imdgProvider.newTransaction();
transaction.beginTransaction();
try {
if (executionReport.isSetField(OrderID.FIELD) && executionReport.isSetField(ExDestination.FIELD) && executionReport.isSetField(TransactTime.FIELD)) {
if (executionReport.isSetField(OrderID.FIELD) && executionReport.isSetField(ExDestination.FIELD) && executionReport.isSetField(TransactTime.FIELD) && executionReport.isSetField(OrdStatus.FIELD)) {
OrderID orderId = executionReport.getOrderID();
ExDestination exDestination = (ExDestination) executionReport.getField(new ExDestination());
TransactTime transactTime = executionReport.getTransactTime();
SecurityID securityID = executionReport.getSecurityID();
Price price = executionReport.getPrice();
OrderQty orderQty = executionReport.getOrderQty();
Account account = executionReport.getAccount();
Side side = executionReport.getSide();
Currency currency = executionReport.getCurrency();
SettlType settlType = executionReport.getSettlType();
OrdStatus ordStatus = executionReport.getOrdStatus();
Pattern orderIdPattern = Pattern.compile("(\\d{6})-([A-Z]+)-(\\d+)");
@ -145,14 +138,20 @@ public class Application extends MessageCracker implements quickfix.Application,
sOrders.setClassCode(exDestination.getValue());
sOrders.setTradeDate(transactTime.getValue().toLocalDate());
sOrders.setSecCode(securityID.getValue());
sOrders.setPrice(BigDecimal.valueOf(price.getValue()));
sOrders.setQty(BigDecimal.valueOf(orderQty.getValue()));
sOrders.setAccount(account.getValue());
sOrders.setSettleCode(settlType.getValue());
sOrders.setPriceCurrency(currency.getValue());
sOrders.setState(String.valueOf(ordStatus.getValue()));
if (executionReport.isSetSecurityID())
sOrders.setSecCode(executionReport.getSecurityID().getValue());
if (executionReport.isSetPrice())
sOrders.setPrice(BigDecimal.valueOf(executionReport.getPrice().getValue()));
if (executionReport.isSetOrderQty())
sOrders.setQty(BigDecimal.valueOf(executionReport.getOrderQty().getValue()));
if (executionReport.isSetAccount())
sOrders.setAccount(executionReport.getAccount().getValue());
if (executionReport.isSetSettlType())
sOrders.setSettleCode(executionReport.getSettlType().getValue());
if (executionReport.isSetCurrency())
sOrders.setPriceCurrency(executionReport.getCurrency().getValue());
sOrders.setState(String.valueOf(ordStatus.getValue()));
if (ordStatus.valueEquals(OrdStatus.NEW)) {
sOrders.setOrderDateTime(transactTime.getValue().toInstant(ZoneOffset.UTC));
} else if (ordStatus.valueEquals(OrdStatus.CANCELED)) {
@ -161,6 +160,7 @@ public class Application extends MessageCracker implements quickfix.Application,
sOrdersImdg.insert(sOrders);
} else {
sOrders.setState(String.valueOf(ordStatus.getValue()));
if (ordStatus.valueEquals(OrdStatus.NEW)) {
sOrders.setOrderDateTime(transactTime.getValue().toInstant(ZoneOffset.UTC));
} else if (ordStatus.valueEquals(OrdStatus.CANCELED)) {