| 
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.cuny.cat.stat.HistoricalReport
public class HistoricalReport
A report that keeps a historical record of the shouts in the market that lead to the last N transactions. This logger is used to keep historical data that is used by various different trading strategies, especially GD.
 Since GDStrategy uses this report to
 compute the number of shouts above or below a certain price, which leads to
 slow simulation, SortedView and IncreasingQueryAccelerator are introduced to
 speed up GDStrategy's queries based on the pattern of prices of concern.
 
Parameters
| base  .memorysize int > 0 (5 by default)  | 
 (the length of most recent history to be recorded) | 
Default Base
| historical_report | 
GDStrategy, 
Serialized Form| Nested Class Summary | |
|---|---|
 class | 
HistoricalReport.IncreasingQueryAccelerator
a class to speed up queries from GDStrategy regarding the number of shouts above or below a certain price.  | 
 class | 
HistoricalReport.ShoutComparator
 | 
 class | 
HistoricalReport.SortedView
a class providing sorted lists of shouts.  | 
| Field Summary | |
|---|---|
protected  HistoricalReport.IncreasingQueryAccelerator | 
accelerator
the object that helps to save time in querying about shouts in the history.  | 
protected  java.util.LinkedList<Shout> | 
asks
asks in the order they arrive.  | 
protected  java.util.LinkedList<Shout> | 
bids
bids in the order they arrive.  | 
protected  int | 
currentMemoryCell
 | 
static int | 
DEFAULT_MEMORYSIZE
the default size of the memory to contain shouts in terms of the number of transactions covered.  | 
protected  double | 
highestBidPrice
 | 
protected  Shout | 
highestUnmatchedBid
 | 
protected  boolean | 
isDebugging
flag used to control whether to do additional debugging.  | 
protected static org.apache.log4j.Logger | 
logger
 | 
protected  double | 
lowestAskPrice
 | 
protected  Shout | 
lowestUnmatchedAsk
 | 
protected  java.util.Set<Shout> | 
matchedShouts
shouts in the memory that have been matched.  | 
protected  int[] | 
memoryAsks
records the numbers of asks placed between transactions in the memory, each entry for the interval between two subsequent transactions.  | 
protected  int[] | 
memoryBids
records the numbers of bids placed between transactions in the memory, each entry for the interval between two subsequent transactions.  | 
protected  int | 
memorySize
the size of the memory to contain shouts in terms of the number of transactions covered.  | 
protected  java.util.Observable | 
observableProxy
used to make this report observable so that accelerator can reset. | 
static java.lang.String | 
P_DEBUG
 | 
static java.lang.String | 
P_DEF_BASE
 | 
static java.lang.String | 
P_MEMORYSIZE
 | 
static java.lang.String | 
P_ROUNDRESET
 | 
protected  boolean | 
roundReset
flag used to control whether to clear the record of matched shouts each round  | 
protected  java.util.Map<java.lang.String,Shout> | 
shoutMap
a mapping from shout IDs to those shouts in the memory.  | 
protected  org.apache.commons.collections15.bag.TreeBag<Shout> | 
sortedShouts
shouts sorted based on price and id if prices are equal.  | 
protected  java.lang.String | 
traderId
the ID of the GD trader that uses this report; for debugging purpose only  | 
| Fields inherited from interface edu.cuny.cat.stat.GameReport | 
|---|
ACCEPTED, ASK, BID, CONVERGENCE_COEFFICIENT, EFFICIENCY, EQUILIBRIUM, FEE, Formatter, GLOBAL, MARKETSHARE, MAX, MEAN, MIN, PLACED, PRICE, PROFIT, PROFIT_DISPERSION, QUANTITY, SCORE, SHOUT, SPECIALIST, STDEV, TOTAL, TRADER, TRANSACTION, TRANSACTIONRATE, VALUE | 
| Constructor Summary | |
|---|---|
HistoricalReport()
 | 
|
| Method Summary | |
|---|---|
 void | 
addObserver(java.util.Observer o)
 | 
protected  void | 
addToSortedShouts(Shout shout)
 | 
 void | 
checkConsistency()
 | 
 void | 
deleteObserver(java.util.Observer o)
 | 
 void | 
disableIncreasingQueryAccelerator()
 | 
 void | 
eventOccurred(AuctionEvent event)
 | 
 java.util.List<Shout> | 
getAsks()
 | 
 java.util.List<Shout> | 
getBids()
 | 
 double | 
getHighestAcceptedAskPrice()
 | 
 double | 
getHighestBidPrice()
 | 
 double | 
getHighestUnacceptedBidPrice()
 | 
 HistoricalReport.IncreasingQueryAccelerator | 
getIncreasingQueryAccelerator()
 | 
 double | 
getLowestAcceptedBidPrice()
 | 
 double | 
getLowestAskPrice()
 | 
 double | 
getLowestUnacceptedAskPrice()
 | 
protected  Shout | 
getMappedShout(java.lang.String shoutId)
 | 
 java.util.Set<Shout> | 
getMatchedShouts()
 | 
 int | 
getMemorySize()
 | 
 int | 
getNumberOfAsks(double price,
                boolean matched)
 | 
 int | 
getNumberOfBids(double price,
                boolean matched)
 | 
 int | 
getNumberOfShouts(java.util.List<Shout> shouts,
                  double price,
                  boolean matched)
 | 
 org.apache.commons.collections15.bag.TreeBag<Shout> | 
getSortedShouts()
 | 
 java.util.Map<edu.cuny.stat.ReportVariable,?> | 
getVariables()
 | 
 void | 
initialize()
 | 
 boolean | 
isDebugging()
 | 
protected  boolean | 
isMatched(Shout shout)
 | 
protected  void | 
markMatchedShout(Shout matched)
 | 
protected  java.lang.String | 
prettyString(java.util.LinkedList<Shout> shouts,
             int[] counts)
 | 
protected  java.lang.String | 
prettyString(java.util.LinkedList<Shout> shouts,
             int index,
             int length)
 | 
protected  java.lang.String | 
prettyString(Shout shout)
 | 
protected  void | 
printShortState()
prints out the current state of this report in a concise way.  | 
protected  void | 
printState()
prints out the current state of this report.  | 
 void | 
produceUserOutput()
 | 
protected  void | 
removeNShouts(int n,
              java.util.LinkedList<Shout> shouts)
 | 
 void | 
reset()
 | 
protected  void | 
roundClosed(RoundClosedEvent event)
 | 
 void | 
setDebugging(boolean isDebugging)
 | 
 void | 
setMemorySize(int memorySize)
 | 
 void | 
setup(edu.cuny.config.param.ParameterDatabase parameters,
      edu.cuny.config.param.Parameter base)
 | 
 java.util.Iterator<Shout> | 
sortedShoutIterator()
 | 
 java.lang.String | 
toString()
 | 
protected  void | 
updateShoutLog(ShoutPostedEvent event)
updates the log of shouts when a shout is posted in the market.  | 
protected  void | 
updateTransPriceLog(TransactionPostedEvent event)
updates the log of transactions and shouts when a transaction is made in the market.  | 
| Methods inherited from class java.lang.Object | 
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Field Detail | 
|---|
protected static org.apache.log4j.Logger logger
public static final java.lang.String P_DEF_BASE
public static final java.lang.String P_MEMORYSIZE
public static final java.lang.String P_ROUNDRESET
public static final java.lang.String P_DEBUG
public static final int DEFAULT_MEMORYSIZE
protected java.util.LinkedList<Shout> asks
protected java.util.LinkedList<Shout> bids
protected org.apache.commons.collections15.bag.TreeBag<Shout> sortedShouts
protected java.util.Set<Shout> matchedShouts
protected java.util.Map<java.lang.String,Shout> shoutMap
protected int memorySize
protected int currentMemoryCell
protected int[] memoryBids
protected int[] memoryAsks
protected double lowestAskPrice
protected double highestBidPrice
protected Shout highestUnmatchedBid
protected Shout lowestUnmatchedAsk
protected HistoricalReport.IncreasingQueryAccelerator accelerator
protected java.util.Observable observableProxy
accelerator can reset.
protected boolean roundReset
protected boolean isDebugging
protected java.lang.String traderId
| Constructor Detail | 
|---|
public HistoricalReport()
| Method Detail | 
|---|
public void addObserver(java.util.Observer o)
public void deleteObserver(java.util.Observer o)
public void setup(edu.cuny.config.param.ParameterDatabase parameters,
                  edu.cuny.config.param.Parameter base)
public void initialize()
public void reset()
reset in interface edu.cuny.obj.Resetablepublic void setMemorySize(int memorySize)
public int getMemorySize()
public boolean isDebugging()
public void setDebugging(boolean isDebugging)
public void checkConsistency()
protected void removeNShouts(int n,
                             java.util.LinkedList<Shout> shouts)
protected void markMatchedShout(Shout matched)
protected java.lang.String prettyString(java.util.LinkedList<Shout> shouts,
                                        int index,
                                        int length)
shouts - index - length - 
protected java.lang.String prettyString(java.util.LinkedList<Shout> shouts,
                                        int[] counts)
shouts - counts - 
protected java.lang.String prettyString(Shout shout)
shout - 
protected void printState()
protected void printShortState()
protected void updateTransPriceLog(TransactionPostedEvent event)
event - protected void updateShoutLog(ShoutPostedEvent event)
event - protected void roundClosed(RoundClosedEvent event)
protected Shout getMappedShout(java.lang.String shoutId)
protected boolean isMatched(Shout shout)
protected void addToSortedShouts(Shout shout)
public void eventOccurred(AuctionEvent event)
eventOccurred in interface AuctionEventListenerpublic double getHighestBidPrice()
public double getLowestAskPrice()
public double getHighestUnacceptedBidPrice()
public double getLowestAcceptedBidPrice()
public double getLowestUnacceptedAskPrice()
public double getHighestAcceptedAskPrice()
public java.util.List<Shout> getBids()
public java.util.List<Shout> getAsks()
public java.util.Set<Shout> getMatchedShouts()
public org.apache.commons.collections15.bag.TreeBag<Shout> getSortedShouts()
public int getNumberOfAsks(double price,
                           boolean matched)
public int getNumberOfBids(double price,
                           boolean matched)
public java.util.Iterator<Shout> sortedShoutIterator()
public int getNumberOfShouts(java.util.List<Shout> shouts,
                             double price,
                             boolean matched)
shouts - the list of shouts to be considered for the countingprice - the sign of price controls whether higher shouts or lower shouts
          are needed; if it is positive, higher shouts are counted;
          otherwise lower shouts.matched - whether only matched shouts are counted or not
public void produceUserOutput()
produceUserOutput in interface edu.cuny.stat.Report<AuctionEvent>public java.util.Map<edu.cuny.stat.ReportVariable,?> getVariables()
public java.lang.String toString()
toString in class java.lang.Objectpublic HistoricalReport.IncreasingQueryAccelerator getIncreasingQueryAccelerator()
public void disableIncreasingQueryAccelerator()
  | 
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||