/** @syncpriority 170 */
  @Override
  public double getAnsweringBid(String nodeId, BidUpdate bu) {
    AuctionState as = getAuctionState(nodeId);
    Agorics ag = getAgorics(nodeId);
    // The bid update is provided separately to the existing
    // auctionstate to allow a more advanced strategy to adjust its
    // decisions. We are dumb, so we just look at the bid update

    // If there are no bidders, just bid the minimum
    if (bu.getListenerIdCount() == 0) return ag.getMinBid();

    double myNewBid = getPreferredBid(cleanBids(bu), ag.getIncrement());
    if (myNewBid == as.getLastSentBid()) {
      // No bid
      return 0;
    }
    if (myNewBid < as.getLastSentBid()) {
      if (canReduceBid.get(nodeId)) {
        canReduceBid.put(nodeId, false);
        return myNewBid;
      }
      return 0;
    }
    return myNewBid;
  }
  /** @syncpriority 170 */
  @Override
  public double getOpeningBid(String nodeId) {
    AuctionState as = getAuctionState(nodeId);
    Agorics ag = getAgorics(nodeId);
    List<ReceivedBid> bids = as.getBids();

    // We should never get here if our max is above their min, but check
    // just in case
    if (ag.getMinBid() > maxBid()) return 0;

    // If there are no bidders, just bid the minimum
    if (bids.size() == 0) return ag.getMinBid();

    return getPreferredBid(bids, ag.getIncrement());
  }
示例#3
0
 public void setCurrencyClient(CurrencyClient client) {
   curClient = client;
   Agorics.Builder ab = Agorics.newBuilder();
   ab.setCurrencyUrl(client.currencyUrl());
   ab.setAcceptPaymentMethods(client.getAcceptPaymentMethods());
   ab.setMinBid(client.getMinBid());
   ab.setIncrement(client.getBidIncrement());
   ab.setMinTopRate(client.getMinTopRate());
   myAgorics = ab.build();
   if (escrowProvider != null) escrowProvider.setCurrencyClient(client);
 }