Search in sources :

Example 1 with SaleRequestedEvent

use of com.github.robozonky.api.notifications.SaleRequestedEvent 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);
}
Also used : SaleRequestedEvent(com.github.robozonky.api.notifications.SaleRequestedEvent) SaleOfferedEvent(com.github.robozonky.api.notifications.SaleOfferedEvent) RecommendedInvestment(com.github.robozonky.api.strategies.RecommendedInvestment) Investment(com.github.robozonky.api.remote.entities.sanitized.Investment) RawInvestment(com.github.robozonky.api.remote.entities.RawInvestment)

Aggregations

SaleOfferedEvent (com.github.robozonky.api.notifications.SaleOfferedEvent)1 SaleRequestedEvent (com.github.robozonky.api.notifications.SaleRequestedEvent)1 RawInvestment (com.github.robozonky.api.remote.entities.RawInvestment)1 Investment (com.github.robozonky.api.remote.entities.sanitized.Investment)1 RecommendedInvestment (com.github.robozonky.api.strategies.RecommendedInvestment)1