gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-14 01:01:31 26 4
gpt4 key购买 nike

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

Zonky.getInvestments介绍

[英]Retrieve investments from user's portfolio via PortfolioApi, in a given order.
[中]按照给定的顺序,通过PortfolioApi从用户的投资组合中检索投资。

代码示例

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

public Optional<Investment> getInvestmentByLoanId(final int loanId) {
  final Select s = new Select().equals("loan.id", loanId);
  return getInvestments(s).findFirst();
}

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

public Optional<Investment> getInvestment(final long id) {
  final Select s = new Select().equals("id", id);
  return getInvestments(s).findFirst();
}

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

public Optional<Investment> getInvestment(final long id) {
  final Select s = new Select().equals("id", id);
  return getInvestments(s).findFirst();
}

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

public Optional<Investment> getInvestmentByLoanId(final int loanId) {
  final Select s = new Select().equals("loan.id", loanId);
  return getInvestments(s).findFirst();
}

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

private static Set<Integer> retrieveSoldParticipationIds(final Tenant tenant) {
  final Select s = new Select().equals("status", "SOLD");
  return tenant.call(zonky -> zonky.getInvestments(s))
      .mapToInt(Investment::getLoanId)
      .distinct()
      .boxed()
      .collect(Collectors.toSet());
}

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

private SoldParticipationCache(final Tenant tenant) {
  this.listedSoldRemotely = Reloadable.with(() -> {
    final Select s = new Select().equals("status", "SOLD");
    return tenant.call(zonky -> zonky.getInvestments(s))
        .mapToInt(Investment::getLoanId)
        .distinct()
        .boxed()
        .collect(Collectors.toSet());
  })
      .reloadAfter(Duration.ofMinutes(5))
      .build();
}

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

public Stream<Investment> getDelinquentInvestments() {
  return getInvestments(new Select()
                 .in("loan.status", "ACTIVE", "PAID_OFF")
                 .equals("loan.unpaidLastInst", "true")
                 .equals("status", "ACTIVE"));
}

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

public Stream<Investment> getDelinquentInvestments() {
  return getInvestments(new Select()
                 .in("loan.status", "ACTIVE", "PAID_OFF")
                 .equals("loan.unpaidLastInst", "true")
                 .equals("status", "ACTIVE"));
}

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

private static void sell(final PowerTenant tenant, final SellStrategy strategy) {
  final Select sellable = new Select()
      .equalsPlain("onSmp", "CAN_BE_OFFERED_ONLY")
      .equals("status", "ACTIVE"); // this is how Zonky queries for this
  final Set<Investment> marketplace = tenant.call(zonky -> zonky.getInvestments(sellable))
      .parallel()
      .collect(Collectors.toSet());
  final SessionState<Investment> sold = new SessionState<>(tenant, marketplace, Investment::getLoanId,
                               "soldInvestments");
  final Set<InvestmentDescriptor> eligible = marketplace.stream()
      .filter(i -> !sold.contains(i)) // to make dry run function properly
      .map(i -> getDescriptor(i, tenant))
      .collect(Collectors.toSet());
  final PortfolioOverview overview = tenant.getPortfolio().getOverview();
  tenant.fire(sellingStartedLazy(() -> EventFactory.sellingStarted(eligible, overview)));
  final Collection<Investment> investmentsSold = strategy.recommend(eligible, overview)
      .peek(r -> tenant.fire(EventFactory.saleRecommended(r)))
      .map(r -> processSale(tenant, r, sold))
      .flatMap(o -> o.map(Stream::of).orElse(Stream.empty()))
      .collect(Collectors.toSet());
  tenant.fire(sellingCompletedLazy(() -> EventFactory.sellingCompleted(investmentsSold,
                                     tenant.getPortfolio().getOverview())));
}

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

private static void sell(final PowerTenant tenant, final SellStrategy strategy) {
  final Select sellable = new Select()
      .equalsPlain("onSmp", "CAN_BE_OFFERED_ONLY")
      .equals("status", "ACTIVE"); // this is how Zonky queries for this
  final Set<Investment> marketplace = tenant.call(zonky -> zonky.getInvestments(sellable))
      .parallel()
      .collect(Collectors.toSet());
  final SessionState<Investment> sold = new SessionState<>(tenant, marketplace, Investment::getLoanId,
                               "soldInvestments");
  final Set<InvestmentDescriptor> eligible = marketplace.stream()
      .filter(i -> !sold.contains(i)) // to make dry run function properly
      .map(i -> getDescriptor(i, tenant))
      .collect(Collectors.toSet());
  final PortfolioOverview overview = tenant.getPortfolio().getOverview();
  tenant.fire(sellingStartedLazy(() -> EventFactory.sellingStarted(eligible, overview)));
  final Collection<Investment> investmentsSold = strategy.recommend(eligible, overview)
      .peek(r -> tenant.fire(EventFactory.saleRecommended(r)))
      .map(r -> processSale(tenant, r, sold))
      .flatMap(o -> o.map(Stream::of).orElse(Stream.empty()))
      .collect(Collectors.toSet());
  tenant.fire(sellingCompletedLazy(() -> EventFactory.sellingCompleted(investmentsSold,
                                     tenant.getPortfolio().getOverview())));
}

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

@Test
void getters() {
  final Zonky z = mockZonky();
  assertSoftly(softly -> {
    softly.assertThat(z.getAvailableLoans(Select.unrestricted())).isEmpty();
    softly.assertThat(z.getBlockedAmounts()).isEmpty();
    softly.assertThat(z.getInvestments(Select.unrestricted())).isEmpty();
    softly.assertThat(z.getInvestment(1)).isEmpty();
    softly.assertThat(z.getDelinquentInvestments()).isEmpty();
    softly.assertThat(z.getAvailableParticipations(Select.unrestricted())).isEmpty();
    softly.assertThat(z.getTransactions(Select.unrestricted())).isEmpty();
    softly.assertThat(z.getDevelopments(1)).isEmpty();
  });
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com