コード例 #1
0
ファイル: ELFManagementService.java プロジェクト: thoslin/ELF
 private void updateFundShare(EtfReportInfo etfReportInfo) throws AccountException {
   BigDecimal fundShare = etfReportInfo.getFillShare();
   if (ETFTradeTypeConsts.ETF_ADMIN_REDEEM.equals(etfReportInfo.getTradeType())) {
     fundShare = fundShare.negate();
   }
   fundService.updateFundShare(etfReportInfo.getFundId(), fundShare);
 }
コード例 #2
0
ファイル: ELFManagementService.java プロジェクト: thoslin/ELF
 private EtfReportInfo convertReport(
     BasketQueryResult basket, Report etfReport, BaseConfig config) {
   EtfReportInfo etfReportInfo = new EtfReportInfo();
   etfReportInfo.setFundId(config.getFundId());
   etfReportInfo.setPortfolioId(config.getPortfolioId());
   List<ExecutionReport> excutionReports = etfReport.getExcutionReports();
   for (ExecutionReport executionReport : excutionReports) {
     assortmentReport(basket, etfReportInfo, executionReport);
   }
   return etfReportInfo;
 }
コード例 #3
0
ファイル: ELFManagementService.java プロジェクト: thoslin/ELF
 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;
 }
コード例 #4
0
ファイル: ELFManagementService.java プロジェクト: thoslin/ELF
  private BigDecimal getCashExecutionAmount(EtfReportInfo etfReportInfo) {
    List<ExecutionReport> etfCashExecutionReport = etfReportInfo.getEtfCashExecutionReport();

    BigDecimal balance = BigDecimal.ZERO;
    for (ExecutionReport executionReport : etfCashExecutionReport) {
      balance = balance.add(executionReport.getAmount());
    }

    List<ExecutionReport> etfCashExecutionReport2 = etfReportInfo.getEtfCashExecutionReport2();
    for (ExecutionReport executionReport : etfCashExecutionReport2) {
      balance = balance.add(executionReport.getAmount());
    }
    return balance;
  }
コード例 #5
0
ファイル: ELFManagementService.java プロジェクト: thoslin/ELF
  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;
  }
コード例 #6
0
ファイル: ELFManagementService.java プロジェクト: thoslin/ELF
 private void setEtfReport(
     BasketQueryResult basket, EtfReportInfo etfReportInfo, ExecutionReport executionReport) {
   etfReportInfo.setEtfExecutionReport2(executionReport);
   if (executionReport.getSide().equals("S")) {
     etfReportInfo.setTradeType(ETFTradeTypeConsts.ETF_ADMIN_CREATION);
   } else {
     etfReportInfo.setTradeType(ETFTradeTypeConsts.ETF_ADMIN_REDEEM);
   }
   etfReportInfo.setPbu(executionReport.getPbu());
   etfReportInfo.setFillShare(executionReport.getFillQty());
   etfReportInfo.setFillQty(
       executionReport.getFillQty().divide(basket.getCreationRedemptionUnit()));
 }
コード例 #7
0
ファイル: ELFManagementService.java プロジェクト: thoslin/ELF
 private void assortmentReport(
     BasketQueryResult basket, EtfReportInfo etfReportInfo, ExecutionReport executionReport) {
   if (basket.getFundInstrumentId2().equals(executionReport.getSymbol())) {
     setEtfReport(basket, etfReportInfo, executionReport);
   }
   if (basket.getCashInstrumentId() != null
       && basket.getCashInstrumentId().equals(executionReport.getSymbol())) {
     etfReportInfo.getEtfCashExecutionReport().add(executionReport);
     if (etfReportInfo.getCashReplaceAmount() == null) {
       etfReportInfo.setCashReplaceAmount(BigDecimal.ZERO);
     }
     etfReportInfo.setCashReplaceAmount(
         etfReportInfo.getCashReplaceAmount().add(executionReport.getAmount()));
   }
   if (basket.getCashInstrumentId2() != null
       && basket.getCashInstrumentId2().equals(executionReport.getSymbol())) {
     etfReportInfo.getEtfCashExecutionReport2().add(executionReport);
     if (etfReportInfo.getCashReplaceAmount() == null) {
       etfReportInfo.setCashReplaceAmount(BigDecimal.ZERO);
     }
     etfReportInfo.setCashReplaceAmount(
         etfReportInfo.getCashReplaceAmount().add(executionReport.getAmount()));
   }
   if (isConsstituent(executionReport.getSymbol(), basket.getConstituentStockQueryResult())) {
     etfReportInfo.getEtfSecurityExecutionReport().add(executionReport);
   }
 }