@Test public void passesCompletlyAggregatedCandlSticksToTheOriginalTradeGuard() { when(timeFrameConverter.aggregate(any())).thenReturn(Optional.of(DUMMY_AGGREGATED_CANDLE_STICK)) .thenReturn(empty()).thenReturn(empty()).thenReturn(Optional.of(DUMMY_AGGREGATED_CANDLE_STICK)) .thenReturn(empty()); cut.updateMarketData(DUMMY_INPUT_CANDLE_STICK); verify(orig).updateMarketData(DUMMY_AGGREGATED_CANDLE_STICK); cut.updateMarketData(DUMMY_INPUT_CANDLE_STICK); verifyNoMoreInteractions(orig); cut.updateMarketData(DUMMY_INPUT_CANDLE_STICK); verifyNoMoreInteractions(orig); cut.updateMarketData(DUMMY_INPUT_CANDLE_STICK); verify(orig, times(2)).updateMarketData(DUMMY_AGGREGATED_CANDLE_STICK); cut.updateMarketData(DUMMY_INPUT_CANDLE_STICK); verifyNoMoreInteractions(orig); }
@Override public void updateMarketData(final CIN marketData) { timeFrameConverter.aggregate(marketData).ifPresent(aggregated -> { firstCandleCompleted = true; orig.updateMarketData(aggregated); }); }
TimeFrameConvertingTradeGuard implements OrderFilter<CIN> { @Override public void updateMarketData(final CIN marketData) { timeFrameConverter.aggregate(marketData).ifPresent(aggregated -> { firstCandleCompleted = true; orig.updateMarketData(aggregated); }); } }
TimeFrameConvertingTradeGuard implements OrderFilter<CIN> { @Override public void updateMarketData(final CIN marketData) { timeFrameConverter.aggregate(marketData).ifPresent(aggregated -> { firstCandleCompleted = true; orig.updateMarketData(aggregated); }); } TimeFrameConvertingTradeGuard(final OrderFilter<DatedCandleStick<OTF>> orig,
            final TimeFrameConverter<CIN, COUT, ITF, OTF> timeFrameConverter); }
TimeFrameConvertingTradeGuard implements OrderFilter<CIN> { @Override public void updateMarketData(final CIN marketData) { timeFrameConverter.aggregate(marketData).ifPresent(aggregated -> { firstCandleCompleted = true; orig.updateMarketData(aggregated); }); } TimeFrameConvertingTradeGuard(final OrderFilter<DatedCandleStick<OTF>> orig,
            final TimeFrameConverter<CIN, COUT, ITF, OTF> timeFrameConverter); @Override void updateMarketData(final CIN marketData); @Override Optional<Failed> filterOrder(final BasicPendingOrder order); }
TimeFrameConvertingTradeGuard implements OrderFilter<CIN> { @Override public void updateMarketData(final CIN marketData) { timeFrameConverter.aggregate(marketData).ifPresent(aggregated -> { firstCandleCompleted = true; orig.updateMarketData(aggregated); }); } TimeFrameConvertingTradeGuard(final OrderFilter<DatedCandleStick<OTF>> orig,
            final TimeFrameConverter<CIN, COUT, ITF, OTF> timeFrameConverter); @Override void updateMarketData(final CIN marketData); @Override Optional<Failed> filterOrder(final BasicPendingOrder order);  }