Package com.quantcomponents.algo

Examples of com.quantcomponents.algo.TradeStatsProcessor


            @Override
            public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
              try {
              ExecutionInfo executionInfo = executionMap.get(executionHandle);
              if (executionInfo == null) {
                TradeStatsProcessor processor = new TradeStatsProcessor();
                String processorOutputSeriesID = "output-" + processor.toString();
                ISeries<Date, Double, ISeriesPoint<Date, Double>> executionOutputSeries = executionHandle.getManager().getExecutionOutput(executionHandle.getHandle());
                executionInfo = new ExecutionInfo(processor, new LinkedListSeries<Date, Double, ISeriesPoint<Date, Double>>(processorOutputSeriesID, false));
                executionInfo.processor.wire(Collections.singletonMap(TradeStatsProcessor.INPUT_SERIES_NAME, executionOutputSeries) ,executionInfo.outputSeries);
                executionMap.put(executionHandle, executionInfo);
              }
View Full Code Here


      executionInfo.processor.unwire();
    }
  }
 
  private void updateStats() {
    final TradeStatsProcessor tradeStatsProcessor = currentExecutionInfo == null ? null : currentExecutionInfo.processor;
    if (tradeStatsProcessor != null) {
      parent.getDisplay().asyncExec(new Runnable() {
        @Override
        public void run() {
          ITradeStatsPoint bestTrade = tradeStatsProcessor.getBestTrade();
          if (bestTrade != null) {
            bestTradeTimeDisplay.setText(sdf.format(bestTrade.getIndex()));
            bestTradePnlDisplay.setText(df.format(bestTrade.getTradePnl()));
          } else {
            bestTradeTimeDisplay.setText("");
            bestTradePnlDisplay.setText("");
          }
          ITradeStatsPoint worstTrade = tradeStatsProcessor.getWorstTrade();
          if (worstTrade != null) {
            worstTradeTimeDisplay.setText(sdf.format(worstTrade.getIndex()));
            worstTradePnlDisplay.setText(df.format(worstTrade.getTradePnl()));
          } else {
            worstTradeTimeDisplay.setText("");
            worstTradePnlDisplay.setText("");
          }
          SimplePoint maxDDEnd = tradeStatsProcessor.getEndOfMaxDrawdown();
          if (maxDDEnd != null) {
            maxDrawdownEndTimeDisplay.setText(sdf.format(maxDDEnd.getIndex()));
            maxDrawdownValueDisplay.setText(df.format(maxDDEnd.getValue() - tradeStatsProcessor.getStartOfMaxDrawdown().getValue()));
          } else {
            maxDrawdownEndTimeDisplay.setText("");
            maxDrawdownValueDisplay.setText("");
          }
          SimplePoint maxRUEnd = tradeStatsProcessor.getEndOfMaxRunup();
          if (maxRUEnd != null) {
            maxRunupEndTimeDisplay.setText(sdf.format(maxRUEnd.getIndex()));
            maxRunupValueDisplay.setText(df.format(maxRUEnd.getValue() - tradeStatsProcessor.getStartOfMaxRunup().getValue()));
          } else {
            maxRunupEndTimeDisplay.setText("");
            maxRunupValueDisplay.setText("");
          }
          SimplePoint lowestEP = tradeStatsProcessor.getLowestEquityPoint();
          if (lowestEP != null) {
            lowestEquityTimeDisplay.setText(sdf.format(lowestEP.getIndex()));
            lowestEquityValueDisplay.setText(df.format(lowestEP.getValue()));
          } else {
            lowestEquityTimeDisplay.setText("");
            lowestEquityValueDisplay.setText("");
          }
          SimplePoint highestEP = tradeStatsProcessor.getHighestEquityPoint();
          if (highestEP != null) {
            highestEquityTimeDisplay.setText(sdf.format(highestEP.getIndex()));
            highestEquityValueDisplay.setText(df.format(highestEP.getValue()));
          } else {
            highestEquityTimeDisplay.setText("");
View Full Code Here

TOP

Related Classes of com.quantcomponents.algo.TradeStatsProcessor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.