edu.cuny.cat.market.matching
Class ThetaShoutEngine

java.lang.Object
  extended by edu.cuny.cat.market.AuctioneerPolicy
      extended by edu.cuny.cat.market.matching.ShoutEngine
          extended by edu.cuny.cat.market.matching.LazyMaxVolumeShoutEngine
              extended by edu.cuny.cat.market.matching.ThetaShoutEngine
All Implemented Interfaces:
AuctionEventListener, edu.cuny.config.param.Parameterizable, edu.cuny.obj.Resetable
Direct Known Subclasses:
AdaptiveThetaShoutEngine, SplineThetaShoutEngine

public class ThetaShoutEngine
extends LazyMaxVolumeShoutEngine

This class represents a continuum of shout matching policies, including FourHeapShoutEngine and LazyMaxVolumeShoutEngine. It uses a matching quantity coefficient, theta, to determine a matching quantity that falls between 0 and the maximal quantity calculated in LazyMaxVolumeShoutEngine. When theta is 1, the quantity is the maximal; when theta is 0, the quantity is the equilibrium quantity; and when theta is -1, no matches will be made.

Parameters

base .theta
-1 <= double <= 1 (0 by default)
(the matching quantity coefficient controlling the matching quantity relative to the equilibrium quantity and the maximial quantity.)
base .orderly
boolean (true by default)
(whether to pair up matched shouts in the same order of price, or favor most competitive shouts by pairing them up respectively from both sides with the condition that the underlying shout set of the matching set is guaranteed.)

Default Base

theta_matching

Version:
$Revision: 1.4 $
Author:
Jinzhong Niu

Field Summary
static double DEFAULT_THETA
          by default, do maximal volume
protected  boolean orderly
          whether to match bids and asks in totally ascending order, or favor the most competitive shouts to pair them up as in FourHeapShoutEngine.
static java.lang.String P_DEF_BASE
           
static java.lang.String P_ORDERLY
           
static java.lang.String P_THETA
           
protected  double theta
          matching quantity coefficient
 
Fields inherited from class edu.cuny.cat.market.matching.LazyMaxVolumeShoutEngine
asks, bids, bIn, bOut, matchingVolume, sIn, sOut, uniform
 
Fields inherited from class edu.cuny.cat.market.matching.ShoutEngine
AscendingOrder, DescendingOrder
 
Fields inherited from class edu.cuny.cat.market.AuctioneerPolicy
auctioneer
 
Constructor Summary
ThetaShoutEngine()
           
ThetaShoutEngine(double theta)
           
 
Method Summary
 int calculateEquilibriumQuantity()
           
 int calculateMatchingQuantity()
           
protected  int calculateUnorderlyQuantity()
           
protected  int getDemandAboveLowestAsk()
           
 boolean getOrderly()
           
 double getTheta()
           
 java.util.List<Shout> matchShouts()
          overrides the way of pairing up matched bids and asks in the order of monotonically increasing price on both sides, and if orderly is false, try best to pair up most competitive shouts on both sides so that they maintain their profit margins as in the traditional equilibrium matching.
 void setOrderly(boolean orderly)
           
 void setTheta(double theta)
           
 void setup(edu.cuny.config.param.ParameterDatabase parameters, edu.cuny.config.param.Parameter base)
           
 java.lang.String toString()
           
protected  void validateTheta()
           
 
Methods inherited from class edu.cuny.cat.market.matching.LazyMaxVolumeShoutEngine
ascendingAskIterator, askIterator, bidIterator, descendingBidIterator, distributeShouts, distributeShoutsFromHead, distributeShoutsFromTail, getHighestMatchedAsk, getHighestUnmatchedBid, getLowestMatchedBid, getLowestUnmatchedAsk, getMatchedAsks, getMatchedBids, getMatchedVolume, getNumOfMatchedAsks, getNumOfMatchedBids, getNumOfUnmatchedAsks, getNumOfUnmatchedBids, getUnmatchedAsks, getUnmatchedBids, getUnmatchedDemand, getUnmatchedSupply, matchedAskIterator, matchedBidIterator, newShout, prettyPrint, printState, randomizeMatches, removeShout, reset, updateMatchedShouts
 
Methods inherited from class edu.cuny.cat.market.matching.ShoutEngine
getMatchedShouts
 
Methods inherited from class edu.cuny.cat.market.AuctioneerPolicy
eventOccurred, getAuctioneer, initialize, setAuctioneer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

P_THETA

public static final java.lang.String P_THETA
See Also:
Constant Field Values

P_ORDERLY

public static final java.lang.String P_ORDERLY
See Also:
Constant Field Values

P_DEF_BASE

public static final java.lang.String P_DEF_BASE
See Also:
Constant Field Values

DEFAULT_THETA

public static final double DEFAULT_THETA
by default, do maximal volume

See Also:
Constant Field Values

theta

protected double theta
matching quantity coefficient


orderly

protected boolean orderly
whether to match bids and asks in totally ascending order, or favor the most competitive shouts to pair them up as in FourHeapShoutEngine.

Constructor Detail

ThetaShoutEngine

public ThetaShoutEngine()

ThetaShoutEngine

public ThetaShoutEngine(double theta)
Method Detail

setup

public void setup(edu.cuny.config.param.ParameterDatabase parameters,
                  edu.cuny.config.param.Parameter base)
Specified by:
setup in interface edu.cuny.config.param.Parameterizable
Overrides:
setup in class AuctioneerPolicy

validateTheta

protected void validateTheta()

getTheta

public double getTheta()
Returns:
theta

setTheta

public void setTheta(double theta)
Parameters:
theta -

getOrderly

public boolean getOrderly()
Returns:
orderly

setOrderly

public void setOrderly(boolean orderly)
Parameters:
orderly -

getDemandAboveLowestAsk

protected int getDemandAboveLowestAsk()
Returns:
the demand at the price of the lowest ask

calculateEquilibriumQuantity

public int calculateEquilibriumQuantity()
Returns:
the equilibrium quantity

calculateMatchingQuantity

public int calculateMatchingQuantity()
Overrides:
calculateMatchingQuantity in class LazyMaxVolumeShoutEngine
Returns:
the matching quantity given the current supply and demand

calculateUnorderlyQuantity

protected int calculateUnorderlyQuantity()
Returns:
the quantity of goods that can be traded between the most competitive bids and asks while guaranteeing the required trading volume is met.

matchShouts

public java.util.List<Shout> matchShouts()
overrides the way of pairing up matched bids and asks in the order of monotonically increasing price on both sides, and if orderly is false, try best to pair up most competitive shouts on both sides so that they maintain their profit margins as in the traditional equilibrium matching.

Overrides:
matchShouts in class LazyMaxVolumeShoutEngine

toString

public java.lang.String toString()
Overrides:
toString in class LazyMaxVolumeShoutEngine