private List<AdjustTradeEventLeg> getTradeEventLegs( EtfReportInfo etfReportInfo, BasketQueryResult basket) throws AccountException { TradeAccountEvent tradeAccount = tradeAccountService.getTradeAccountByNo( etfReportInfo.getEtfExecutionReport2().getAccount()); List<ExecutionReport> etfSecurityExecutionReport = etfReportInfo.getEtfSecurityExecutionReport(); List<AdjustTradeEventLeg> adjustTradeEventLegs = new ArrayList<AdjustTradeEventLeg>(); addSecurityAdjustTradeEventLegs( tradeAccount, etfSecurityExecutionReport, adjustTradeEventLegs, basket); addCashAdjustTradeEventLegs(etfReportInfo, tradeAccount, adjustTradeEventLegs); return adjustTradeEventLegs; }
private AdjustTradeEvent createPositionEvent( EtfReportInfo etfReportInfo, BaseConfig config, BasketQueryResult basket) throws AccountException { AdjustTradeEvent adjustTradeEvent = new AdjustTradeEvent(); adjustTradeEvent.setTradeLevel(TradeLevelConsts.FILL); if (ETFTradeTypeConsts.ETF_ADMIN_CREATION.equals(etfReportInfo.getTradeType())) { adjustTradeEvent.setTradeType(TradeTypeConsts.ETF_ADMIN_SUBSCRIBE); } if (ETFTradeTypeConsts.ETF_ADMIN_REDEEM.equals(etfReportInfo.getTradeType())) { adjustTradeEvent.setTradeType(TradeTypeConsts.ETF_ADMIN_REDEEM); } adjustTradeEvent.setPortfolioId(config.getPortfolioId()); adjustTradeEvent.setUserId(SYSTEM_USER_ID); adjustTradeEvent.setExchange(etfReportInfo.getEtfExecutionReport2().getExchangeCode()); List<AdjustTradeEventLeg> adjustTradeEventLegs = getTradeEventLegs(etfReportInfo, basket); adjustTradeEvent.setTradeEventlegs(adjustTradeEventLegs); return adjustTradeEvent; }