Codota Logo
MarketPosition
Code IndexAdd Codota to your IDE (free)

How to use
MarketPosition
in
org.powertac.common

Best Java code snippets using org.powertac.common.MarketPosition (Showing top 7 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
SimpleDateFormat s =
  • Codota IconString pattern;new SimpleDateFormat(pattern)
  • Codota IconString template;Locale locale;new SimpleDateFormat(template, locale)
  • Codota Iconnew SimpleDateFormat()
  • Smart code suggestions by Codota
}
origin: powertac/powertac-server

private double getRemaining (Broker broker,
               HashMap<Broker, Double> posns,
               int ts)
{
 Double result = posns.get(broker);
 if (null == result) {
  MarketPosition posn = broker.findMarketPositionByTimeslot(ts);
  // offset is zero for final ts
  int offset = ts - timeslotRepo.currentSerialNumber();
  double limit = mktPosnLimitFinal;
  if (enabledTimeslots.size() > 1) {
   limit -= (offset * (mktPosnLimitFinal - mktPosnLimitInitial)
        / (enabledTimeslots.size() - 1));
  }
  result = Math.max(0.0, limit - posn.getOverallBalance());
  posns.put(broker, result);
 }
 return result;
}
origin: powertac/powertac-server

private void updateBrokerMarketPosition(MarketTransaction tx) 
{
 Broker broker = tx.getBroker();
 MarketPosition mkt =
   broker.findMarketPositionByTimeslot(tx.getTimeslotIndex());
 if (mkt == null) {
  mkt = new MarketPosition(broker, tx.getTimeslot(), tx.getMWh());
  log.debug("New MarketPosition(" + broker.getUsername() + 
       ", " + tx.getTimeslot().getSerialNumber() + "): " + 
       mkt.getId());
  broker.addMarketPosition(mkt, tx.getTimeslotIndex());
 }
 else {
  mkt.updateBalance(tx.getMWh());
 }
}
origin: powertac/powertac-server

/**
 * Gets the net market position for the current timeslot. This only works on
 * processed transactions, but it can be used before activation in case there
 * can be no new market transactions for the current timeslot. This is the
 * normal case. The value will be positive if the broker is importing power
 * during the current timeslot.
 */
@Override
public synchronized double getCurrentMarketPosition(Broker broker) 
{
 Timeslot current = timeslotRepo.currentTimeslot();
 log.debug("current timeslot: " + current.getSerialNumber());
 MarketPosition position =
   broker.findMarketPositionByTimeslot(current.getSerialNumber());
 if (position == null) {
  log.debug("null position for ts " + current.getSerialNumber());
  return 0.0;
 }
 log.info("market position for " + broker.getUsername()
      + ": " + position.getOverallBalance());
 return position.getOverallBalance();
}
origin: powertac/powertac-server

private void submitOrder (double neededKWh, Timeslot timeslot)
{
 double neededMWh = neededKWh / 1000.0;
 if (Math.abs(neededMWh) < competition.getMinimumOrderQuantity()) {
  // don't bother
  return;
 }
 Double limitPrice;
 MarketPosition posn = face.findMarketPositionByTimeslot(timeslot.getSerialNumber());
 if (posn != null)
  neededMWh -= posn.getOverallBalance();
 log.debug("needed mWh=" + neededMWh);
 if (Math.abs(neededMWh) < minMWh) {
  log.info("no power required in timeslot " + timeslot.getSerialNumber());
  return;
 }
 else {
  limitPrice = computeLimitPrice(timeslot, neededMWh);
 }
 log.info("new order for " + neededMWh + " at " + limitPrice +
      " in timeslot " + timeslot.getSerialNumber());
 Order result = new Order(face, timeslot.getSerialNumber(), neededMWh, limitPrice);
 lastOrder.put(timeslot, result);
 brokerProxyService.routeMessage(result);
}
origin: powertac/powertac-server

if (skip-- > 0 && (posn == null || posn.getOverallBalance() == 0.0))
 continue;
if (posn != null) {
 availableCapacity += posn.getOverallBalance();
origin: powertac/powertac-server

/**
 * Generates Orders in the market to sell remaining available capacity.
 */
public void generateOrders (Instant now, List<Timeslot> openSlots)
{
 log.info("Generate orders for " + getUsername());
 double[] tempCorrections =
   computeWeatherCorrections();
 int i = 0;
 for (Timeslot slot: openSlots) {
  int index = slot.getSerialNumber();
  MarketPosition posn =
   findMarketPositionByTimeslot(index);
  double start = 0.0;
  double demand = computeScaledValue(index, tempCorrections[i++]);
  if (posn != null) {
   // posn.overallBalance is negative if we have sold power in this slot
   start = posn.getOverallBalance();
  }
  double needed = demand - start;
  Order offer = new Order(this, index, needed, null);
  log.info(getUsername() + " orders " + needed +
        " ts " + index);
  brokerProxyService.routeMessage(offer);
 }
}
origin: powertac/powertac-server

if (posn != null) {
 start = -posn.getOverallBalance();
org.powertac.commonMarketPosition

Most used methods

  • getOverallBalance
  • <init>
  • getId
  • updateBalance

Popular in Java

  • Updating database using SQL prepared statement
  • putExtra (Intent)
  • getContentResolver (Context)
  • onRequestPermissionsResult (Fragment)
  • FileWriter (java.io)
    Convenience class for writing character files. The constructors of this class assume that the defaul
  • KeyStore (java.security)
    This class represents an in-memory collection of keys and certificates. It manages two types of entr
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • BoxLayout (javax.swing)
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now