execution uploading optimization
This commit is contained in:
parent
21cd02b20a
commit
fc8d235fce
3 changed files with 53 additions and 21 deletions
|
|
@ -106,6 +106,9 @@ public class ExecutionCurrencyComponent implements IExecutionUploadComponent {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
public void processNewTS(Long fromId) {
|
public void processNewTS(Long fromId) {
|
||||||
|
if (fromId == null) {
|
||||||
|
cash.clear();
|
||||||
|
}
|
||||||
LocalDate today = LocalDate.now();
|
LocalDate today = LocalDate.now();
|
||||||
log.debug("Start check new S_TRADE at {}, fromId={}", today, fromId);
|
log.debug("Start check new S_TRADE at {}, fromId={}", today, fromId);
|
||||||
//выбираем STrades на сегодня с правильным section
|
//выбираем STrades на сегодня с правильным section
|
||||||
|
|
@ -139,15 +142,22 @@ public class ExecutionCurrencyComponent implements IExecutionUploadComponent {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// MoneyFlowSide excDepSide = sTrdSide == Side.BUY ? MoneyFlowSide.BUY : MoneyFlowSide.SELL;
|
// MoneyFlowSide excDepSide = sTrdSide == Side.BUY ? MoneyFlowSide.BUY : MoneyFlowSide.SELL;
|
||||||
ExecUploadKey execCash = ExecUploadKey.cash(sTrd.getTradeDate(),
|
ExecUploadKey excKey = ExecUploadKey.cash(sTrd.getTradeDate(),
|
||||||
sTrd.getTradeNum(),
|
sTrd.getTradeNum(),
|
||||||
sTrdSide.getKey());
|
sTrdSide.getKey());
|
||||||
return cash.contains(execCash);
|
if (fromId != null) {
|
||||||
// return executionCurrencyImdg.getFirstObjectByFieldValues(
|
return cash.contains(excKey);
|
||||||
// Map.of("tradingDate", sTrd.getTradeDate(),
|
} else {
|
||||||
// "exchangeExecutionId", sTrd.getTradeNum(),
|
ExecutionCurrency exec = executionCurrencyImdg.getFirstObjectByFieldValues(
|
||||||
// "side", sTrdSide.getKey())) != null;
|
Map.of("tradingDate", sTrd.getTradeDate(),
|
||||||
|
"exchangeExecutionId", sTrd.getTradeNum(),
|
||||||
|
"side", sTrdSide.getKey()));
|
||||||
|
if (exec != null) {
|
||||||
|
cash.add(excKey);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
log.info("{} strades left after already-added filtering", sTrades.size());
|
log.info("{} strades left after already-added filtering", sTrades.size());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -105,6 +105,9 @@ public class ExecutionDepositComponent implements IExecutionUploadComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void processNewTS(Long fromId) {
|
public void processNewTS(Long fromId) {
|
||||||
|
if (fromId == null) {
|
||||||
|
cash.clear();
|
||||||
|
}
|
||||||
log.debug("Start check new S_TRADE after {}, fromId={}", tradingDay, fromId);
|
log.debug("Start check new S_TRADE after {}, fromId={}", tradingDay, fromId);
|
||||||
//выбираем STrades на сегодня с правильным section
|
//выбираем STrades на сегодня с правильным section
|
||||||
Collection<STrades> sTrades;
|
Collection<STrades> sTrades;
|
||||||
|
|
@ -137,13 +140,22 @@ public class ExecutionDepositComponent implements IExecutionUploadComponent {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
MoneyFlowSide excDepSide = sTrdSide.equals(Side.BUY) ? MoneyFlowSide.BUY : MoneyFlowSide.SELL;
|
MoneyFlowSide excDepSide = sTrdSide.equals(Side.BUY) ? MoneyFlowSide.BUY : MoneyFlowSide.SELL;
|
||||||
return cash.contains(
|
ExecUploadKey excKey = ExecUploadKey.cash(sTrd.getTradeDate(),
|
||||||
ExecUploadKey.cash(sTrd.getTradeDate(), sTrd.getTradeNum(), excDepSide.getKey())
|
sTrd.getTradeNum(),
|
||||||
);
|
excDepSide.getKey());
|
||||||
//return executionDepositImdg.getFirstObjectByFieldValues(
|
if (fromId != null) {
|
||||||
// Map.of("tradingDate", sTrd.getTradeDate(),
|
return cash.contains(excKey);
|
||||||
// "exchangeExecutionId", sTrd.getTradeNum(),
|
} else {
|
||||||
// "side", excDepSide.getKey())) != null;
|
ExecutionDeposit exec = executionDepositImdg.getFirstObjectByFieldValues(
|
||||||
|
Map.of("tradingDate", sTrd.getTradeDate(),
|
||||||
|
"exchangeExecutionId", sTrd.getTradeNum(),
|
||||||
|
"side", excDepSide.getKey()));
|
||||||
|
if (exec != null) {
|
||||||
|
cash.add(excKey);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
log.info("{} strades left after already-added filtering", sTrades.size());
|
log.info("{} strades left after already-added filtering", sTrades.size());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -124,6 +124,9 @@ public class ExecutionFondComponent implements IExecutionUploadComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void processNewTS(Long fromId) {
|
public void processNewTS(Long fromId) {
|
||||||
|
if (fromId == null) {
|
||||||
|
cash.clear();
|
||||||
|
}
|
||||||
log.debug("Start check new S_TRADE after {}, fromId={}", tradingDay, fromId);
|
log.debug("Start check new S_TRADE after {}, fromId={}", tradingDay, fromId);
|
||||||
//выбираем STrades на сегодня с правильным section
|
//выбираем STrades на сегодня с правильным section
|
||||||
Collection<STrades> sTrades;
|
Collection<STrades> sTrades;
|
||||||
|
|
@ -156,13 +159,20 @@ public class ExecutionFondComponent implements IExecutionUploadComponent {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Side excDepSide = sTrdSide.equals(Side.BUY) ? Side.BUY : Side.SELL;
|
Side excDepSide = sTrdSide.equals(Side.BUY) ? Side.BUY : Side.SELL;
|
||||||
return cash.contains(
|
ExecUploadKey excKey = ExecUploadKey.cash(sTrd.getTradeDate(), sTrd.getTradeNum(), excDepSide.getKey());
|
||||||
ExecUploadKey.cash(sTrd.getTradeDate(), sTrd.getTradeNum(), excDepSide.getKey())
|
if (fromId != null) {
|
||||||
);
|
return cash.contains(excKey);
|
||||||
//return executionFondImdg.getFirstObjectByFieldValues(
|
} else {
|
||||||
// Map.of("tradingDate", sTrd.getTradeDate(),
|
ExecutionFond exec = executionFondImdg.getFirstObjectByFieldValues(
|
||||||
// "exchangeExecutionId", sTrd.getTradeNum(),
|
Map.of("tradingDate", sTrd.getTradeDate(),
|
||||||
// "side", excDepSide.getKey())) != null;
|
"exchangeExecutionId", sTrd.getTradeNum(),
|
||||||
|
"side", excDepSide.getKey()));
|
||||||
|
if (exec != null) {
|
||||||
|
cash.add(excKey);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
log.info("{} strades left after already-added filtering", sTrades.size());
|
log.info("{} strades left after already-added filtering", sTrades.size());
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue