use of com.github.robozonky.api.strategies.RecommendedInvestment in project robozonky by RoboZonky.
the class NaturalLanguageSellStrategyTest method noLoansApplicable.
@Test
void noLoansApplicable() {
final MarketplaceFilter filter = MarketplaceFilter.of(MarketplaceFilterCondition.alwaysAccepting());
final ParsedStrategy p = new ParsedStrategy(DefaultPortfolio.PROGRESSIVE, Collections.singleton(filter));
final SellStrategy s = new NaturalLanguageSellStrategy(p);
final PortfolioOverview portfolio = mock(PortfolioOverview.class);
when(portfolio.getCzkAvailable()).thenReturn(p.getMinimumBalance());
when(portfolio.getCzkInvested()).thenReturn(p.getMaximumInvestmentSizeInCzk() - 1);
final Stream<RecommendedInvestment> result = s.recommend(Collections.singletonList(mockDescriptor()), portfolio);
assertThat(result).isEmpty();
}
use of com.github.robozonky.api.strategies.RecommendedInvestment in project robozonky by RoboZonky.
the class Selling method processInvestment.
private Optional<Investment> processInvestment(final Zonky zonky, final RecommendedInvestment r) {
Events.fire(new SaleRequestedEvent(r));
final Investment i = r.descriptor().item();
if (isDryRun) {
LOGGER.debug("Not sending sell request for loan #{} due to dry run.", i.getLoanId());
} else {
LOGGER.debug("Sending sell request for loan #{}.", i.getLoanId());
zonky.sell(i);
LOGGER.trace("Request over.");
}
Investment.putOnSmp(i);
Events.fire(new SaleOfferedEvent(i, r.descriptor().related()));
return Optional.of(i);
}
Aggregations