uk.ac.liv.auction.stats
Class HistoricalDataReport

java.lang.Object
  extended byuk.ac.liv.auction.stats.AbstractAuctionReport
      extended byuk.ac.liv.auction.stats.HistoricalDataReport
All Implemented Interfaces:
AuctionEventListener, AuctionReport, Parameterizable, Resetable, java.io.Serializable

public class HistoricalDataReport
extends AbstractAuctionReport
implements java.io.Serializable, Resetable

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.

Version:
$Revision: 1.6 $
Author:
Steve Phelps
See Also:
Serialized Form

Field Summary
protected  java.util.HashSet acceptedShouts
           
protected  java.util.LinkedList asks
           
protected  java.util.LinkedList bids
           
protected  int currentMemoryCell
           
protected  double highestBidPrice
           
protected  double lowestAskPrice
           
protected  int[] memoryAsks
           
protected  int[] memoryBids
           
protected  int memorySize
           
protected  org.apache.commons.collections.bag.TreeBag sortedShouts
           
 
Fields inherited from class uk.ac.liv.auction.stats.AbstractAuctionReport
auction
 
Constructor Summary
HistoricalDataReport()
           
 
Method Summary
 boolean accepted(Shout shout)
           
 void addToSortedShouts(Shout shout)
           
 void eventOccurred(AuctionEvent event)
           
 void finalReport()
           
 java.util.List getAsks()
           
 java.util.List getBids()
           
 double getHighestBidPrice()
           
 double getLowestAskPrice()
           
 int getNumberOfAsks(double price, boolean accepted)
           
 int getNumberOfBids(double price, boolean accepted)
           
 int getNumberOfShouts(java.util.List shouts, double price, boolean accepted)
           
 int getNumberOfTrades()
           
 java.util.Map getVariables()
          Returns a Map of all of the variables that are produced in the report.
 void initialise()
           
protected  void initialisePriceRanges()
           
protected  void markMatched(java.util.List shouts)
           
 void produceUserOutput()
          Produce the final report for the user.
 void reset()
          Reinitialise our state to the original settings.
 void roundClosed(AuctionEvent event)
           
 void setup(ec.util.ParameterDatabase parameters, ec.util.Parameter base)
          Initialise this object from a parameter database.
 java.util.Iterator sortedShoutIterator()
           
 java.lang.String toString()
           
 void updateShoutLog(ShoutPlacedEvent event)
           
 void updateTransPriceLog(TransactionExecutedEvent event)
           
 
Methods inherited from class uk.ac.liv.auction.stats.AbstractAuctionReport
setAuction
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

asks

protected java.util.LinkedList asks

bids

protected java.util.LinkedList bids

sortedShouts

protected org.apache.commons.collections.bag.TreeBag sortedShouts

acceptedShouts

protected java.util.HashSet acceptedShouts

memorySize

protected int memorySize

currentMemoryCell

protected int currentMemoryCell

memoryBids

protected int[] memoryBids

memoryAsks

protected int[] memoryAsks

lowestAskPrice

protected double lowestAskPrice

highestBidPrice

protected double highestBidPrice
Constructor Detail

HistoricalDataReport

public HistoricalDataReport()
Method Detail

setup

public void setup(ec.util.ParameterDatabase parameters,
                  ec.util.Parameter base)
Description copied from interface: Parameterizable
Initialise this object from a parameter database.

Specified by:
setup in interface Parameterizable

updateTransPriceLog

public void updateTransPriceLog(TransactionExecutedEvent event)

initialise

public void initialise()

reset

public void reset()
Description copied from interface: Resetable
Reinitialise our state to the original settings.

Specified by:
reset in interface Resetable

updateShoutLog

public void updateShoutLog(ShoutPlacedEvent event)

roundClosed

public void roundClosed(AuctionEvent event)

eventOccurred

public void eventOccurred(AuctionEvent event)
Specified by:
eventOccurred in interface AuctionEventListener

getNumberOfTrades

public int getNumberOfTrades()

getHighestBidPrice

public double getHighestBidPrice()

getLowestAskPrice

public double getLowestAskPrice()

getBids

public java.util.List getBids()

getAsks

public java.util.List getAsks()

accepted

public boolean accepted(Shout shout)

getNumberOfAsks

public int getNumberOfAsks(double price,
                           boolean accepted)

getNumberOfBids

public int getNumberOfBids(double price,
                           boolean accepted)

sortedShoutIterator

public java.util.Iterator sortedShoutIterator()

addToSortedShouts

public void addToSortedShouts(Shout shout)

getNumberOfShouts

public int getNumberOfShouts(java.util.List shouts,
                             double price,
                             boolean accepted)

produceUserOutput

public void produceUserOutput()
Description copied from interface: AuctionReport
Produce the final report for the user. Implementors can do whatever they see fit, for example by writing a report on stdout, or they may choose to do nothing.

Specified by:
produceUserOutput in interface AuctionReport

getVariables

public java.util.Map getVariables()
Description copied from interface: AuctionReport
Returns a Map of all of the variables that are produced in the report. The Map maps variables, represented by objects of type ReportVariable, onto values, which may be of any class. If no variables are produced by this report then an empty Map is returned.

Specified by:
getVariables in interface AuctionReport
See Also:
ReportVariable

initialisePriceRanges

protected void initialisePriceRanges()

markMatched

protected void markMatched(java.util.List shouts)

finalReport

public void finalReport()

toString

public java.lang.String toString()