com.github.robozonky.common.remote.Zonky.sell()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(119)

本文整理了Java中com.github.robozonky.common.remote.Zonky.sell()方法的一些代码示例,展示了Zonky.sell()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Zonky.sell()方法的具体详情如下:
包路径:com.github.robozonky.common.remote.Zonky
类名称:Zonky
方法名:sell

Zonky.sell介绍

暂无

代码示例

代码示例来源:origin: RoboZonky/robozonky

private static Optional<Investment> processSale(final PowerTenant tenant, final RecommendedInvestment r,
                        final SessionState<Investment> sold) {
  tenant.fire(EventFactory.saleRequested(r));
  final Investment i = r.descriptor().item();
  final boolean isRealRun = !tenant.getSessionInfo().isDryRun();
  LOGGER.debug("Will send sell request for loan #{}: {}.", i.getLoanId(), isRealRun);
  if (isRealRun) {
    tenant.run(z -> z.sell(i));
    LOGGER.info("Offered to sell investment in loan #{}.", i.getLoanId());
  }
  sold.put(i); // make sure dry run never tries to sell this again in this instance
  tenant.fire(EventFactory.saleOffered(i, r.descriptor().related()));
  return Optional.of(i);
}

代码示例来源:origin: com.github.robozonky/robozonky-app

private static Optional<Investment> processSale(final PowerTenant tenant, final RecommendedInvestment r,
                        final SessionState<Investment> sold) {
  tenant.fire(EventFactory.saleRequested(r));
  final Investment i = r.descriptor().item();
  final boolean isRealRun = !tenant.getSessionInfo().isDryRun();
  LOGGER.debug("Will send sell request for loan #{}: {}.", i.getLoanId(), isRealRun);
  if (isRealRun) {
    tenant.run(z -> z.sell(i));
    LOGGER.info("Offered to sell investment in loan #{}.", i.getLoanId());
  }
  sold.put(i); // make sure dry run never tries to sell this again in this instance
  tenant.fire(EventFactory.saleOffered(i, r.descriptor().related()));
  return Optional.of(i);
}

代码示例来源:origin: RoboZonky/robozonky

@Test
void sell() {
  final ControlApi control = mock(ControlApi.class);
  final Api<ControlApi> ca = mockApi(control);
  final Zonky z = mockZonkyControl(ca);
  final Investment p = Investment.custom()
      .setRemainingPrincipal(BigDecimal.TEN)
      .setSmpFee(BigDecimal.ONE)
      .setId(1)
      .build();
  z.sell(p);
  verify(control).offer(any());
}

相关文章