edu.cuny.cat.market.pricing
Class NPricingPolicy
java.lang.Object
edu.cuny.cat.market.AuctioneerPolicy
edu.cuny.cat.market.pricing.PricingPolicy
edu.cuny.cat.market.pricing.NPricingPolicy
- All Implemented Interfaces:
- AuctionEventListener, edu.cuny.config.param.Parameterizable, edu.cuny.obj.Resetable
public class NPricingPolicy
- extends PricingPolicy
A discriminatory pricing policy that uses the average of the last n
pair of bid and ask prices leading to transactions as the clearing price. In
case of the price falls out of the range between the current bid and ask, the
nearest boundary is used.
Parameters
base .n
int >= 1 (10 by default) |
(the number of latest successful shout pairs used to determine
next clearing price) |
Default Base
- Version:
- $Revision: 1.8 $
- Author:
- Jinzhong Niu
Field Summary |
static int |
DEFAULT_N
|
protected int |
n
|
static java.lang.String |
P_DEF_BASE
|
static java.lang.String |
P_N
|
protected edu.cuny.struct.FixedLengthQueue |
queue
|
Method Summary |
double |
determineClearingPrice(Shout bid,
Shout ask,
MarketQuote clearingQuote)
|
void |
initialize()
initializes after parameters are set via either setters, constructors, or
parameter files. |
void |
reset()
resets the state to be the same as the policy is created and initialized. |
void |
setup(edu.cuny.config.param.ParameterDatabase parameters,
edu.cuny.config.param.Parameter base)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
P_N
public static final java.lang.String P_N
- See Also:
- Constant Field Values
P_DEF_BASE
public static final java.lang.String P_DEF_BASE
- See Also:
- Constant Field Values
DEFAULT_N
public static final int DEFAULT_N
- See Also:
- Constant Field Values
n
protected int n
queue
protected edu.cuny.struct.FixedLengthQueue queue
NPricingPolicy
public NPricingPolicy()
NPricingPolicy
public NPricingPolicy(int n)
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
initialize
public void initialize()
- Description copied from class:
AuctioneerPolicy
- initializes after parameters are set via either setters, constructors, or
parameter files.
- Overrides:
initialize
in class AuctioneerPolicy
reset
public void reset()
- Description copied from class:
AuctioneerPolicy
- resets the state to be the same as the policy is created and initialized.
- Specified by:
reset
in interface edu.cuny.obj.Resetable
- Overrides:
reset
in class AuctioneerPolicy
determineClearingPrice
public double determineClearingPrice(Shout bid,
Shout ask,
MarketQuote clearingQuote)
- Specified by:
determineClearingPrice
in class PricingPolicy
toString
public java.lang.String toString()
- Overrides:
toString
in class AuctioneerPolicy