예제 #1
0
  @Override
  public void resetChart(Boolean resetDisplayedList) {

    for (SlidingPortfolioShare sShare : chartTarget.getCurrentTabShareList()) {
      Stock viewStateParams = chartTarget.getHightlitedEventModel().getViewParamRoot();
      if (viewStateParams != null && viewStateParams.equals(sShare.getStock())) {
        sShare.setDisplayOnChart(true);
      } else {
        sShare.setDisplayOnChart(false);
      }
    }

    chartTarget.getMainChartWraper().resetLineChart();
    chartTarget.getMainChartWraper().resetBarChart();
    chartTarget.getMainChartWraper().resetIndicChart();
  }
예제 #2
0
  private void hideAllButSelected(final Stock selectedShare) {

    for (SlidingPortfolioShare sShare : chartTarget.getCurrentTabShareList()) {
      if (!sShare.getStock().equals(selectedShare)) {
        sShare.setDisplayOnChart(false);
      } else {
        sShare.setDisplayOnChart(true);
      }
    }
    chartTarget.getStripedCloseFunction().updateStartDate(chartTarget.getSlidingStartDate());
    chartTarget.getStripedCloseFunction().updateEndDate(chartTarget.getSlidingEndDate());
    chartTarget
        .getMainChartWraper()
        .updateLineDataSet(
            chartTarget.getCurrentTabShareList(),
            chartTarget.getStripedCloseFunction(),
            getIsApplyColor(),
            chartTarget.getPlotChartDimensions());
  }
  @Override
  public Number[] targetShareData(
      SlidingPortfolioShare portfolioShare,
      Quotations stockQuotations,
      MInteger startDateQuotationIndex,
      MInteger endDateQuotationIndex) {

    if (arbitraryStartDate != null && arbitraryEndDate != null) {

      Date startDate = getStartDate(stockQuotations);
      startDateQuotationIndex.value =
          stockQuotations.getClosestIndexBeforeOrAtDateOrIndexZero(0, startDate);
      Date endDate = getEndDate(stockQuotations);
      endDateQuotationIndex.value =
          stockQuotations.getClosestIndexBeforeOrAtDateOrIndexZero(
              startDateQuotationIndex.value, endDate);
      BigDecimal investPerUnit = BigDecimal.ZERO;
      if (includeMoneyOut) {
        investPerUnit =
            portfolioShare.getPriceUnitCost(
                portfolioShare.calcSlidingEndDate(), portfolioShare.getTransactionCurrency());
      } else {
        investPerUnit =
            portfolioShare.getPriceAvgBuy(
                portfolioShare.calcSlidingEndDate(), portfolioShare.getTransactionCurrency());
      }

      return relativeCloses(
          stockQuotations, startDateQuotationIndex, endDateQuotationIndex, investPerUnit);
    } else {
      throw new InvalidParameterException();
    }
  }