private void addCashAdjustTradeEventLegs( EtfReportInfo etfReportInfo, TradeAccountEvent tradeAccount, List<AdjustTradeEventLeg> adjustTradeEventLegs) { BigDecimal balance = getCashExecutionAmount(etfReportInfo); if (balance.compareTo(BigDecimal.ZERO) > 0) { AdjustTradeEventLeg adjustTradeEventLeg = new AdjustTradeEventLeg(); SecurityAndSecurityTypeQueryResult cashSecurityInfo = securityService.querySecurityIdByLocalCodeAndExchangeCode("CNY", "OTC"); adjustTradeEventLeg.setAccountId(tradeAccount.getCashAccountId()); adjustTradeEventLeg.setSecurityId(cashSecurityInfo.getSecurityId()); adjustTradeEventLeg.setSecurityTypeCode(cashSecurityInfo.getSecurityTypeCode()); adjustTradeEventLeg.setLongShort(LongShortConsts.LONG); adjustTradeEventLeg.setBalance(balance); adjustTradeEventLegs.add(adjustTradeEventLeg); } }
private void addSecurityAdjustTradeEventLegs( TradeAccountEvent tradeAccount, List<ExecutionReport> etfSecurityExecutionReport, List<AdjustTradeEventLeg> adjustTradeEventLegs, BasketQueryResult basket) { for (ExecutionReport executionReport : etfSecurityExecutionReport) { AdjustTradeEventLeg adjustTradeEventLeg = new AdjustTradeEventLeg(); List<ConstituentStockQueryResult> constituentStockQueryResult = basket.getConstituentStockQueryResult(); ConstituentStockQueryResult constituentStock = getConstituentStock(executionReport, constituentStockQueryResult); adjustTradeEventLeg.setAccountId(tradeAccount.getTradeAccountId()); adjustTradeEventLeg.setBalance(executionReport.getFillQty()); adjustTradeEventLeg.setLongShort(LongShortConsts.LONG); adjustTradeEventLeg.setSecurityId(constituentStock.getSecurityId()); adjustTradeEventLeg.setSecurityTypeCode(constituentStock.getSecurityTypeCode()); adjustTradeEventLegs.add(adjustTradeEventLeg); } }