edu.cuny.cat.trader.strategy
Class AbstractStrategy
java.lang.Object
java.util.Observable
edu.cuny.cat.trader.strategy.AbstractStrategy
- All Implemented Interfaces:
- AuctionEventListener, Strategy, edu.cuny.obj.Prototypeable, edu.cuny.obj.Resetable, java.io.Serializable, java.lang.Cloneable
- Direct Known Subclasses:
- FixedQuantityStrategyImpl
public abstract class AbstractStrategy
- extends java.util.Observable
- implements java.io.Serializable, Strategy, edu.cuny.obj.Resetable, java.lang.Cloneable
An abstract implementation of the Strategy interface that provides skeleton
functionality for making trading decisions.
- Version:
- $Revision: 1.20 $
- Author:
- Kai Cai
- See Also:
- Serialized Form
Methods inherited from class java.util.Observable |
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
agent
protected AbstractTradingAgent agent
currentShout
protected Shout.MutableShout currentShout
MIN_PRICE_DIFFERENCE
public static final double MIN_PRICE_DIFFERENCE
- the smallest price unit in making a shout.
- See Also:
- Constant Field Values
AbstractStrategy
public AbstractStrategy()
AbstractStrategy
public AbstractStrategy(AbstractTradingAgent agent)
initialize
public void initialize()
reset
public void reset()
- Specified by:
reset
in interface edu.cuny.obj.Resetable
protoClone
public java.lang.Object protoClone()
- Specified by:
protoClone
in interface edu.cuny.obj.Prototypeable
modifyShout
public Shout modifyShout(Shout shout)
- Description copied from interface:
Strategy
- Modify the trader's current shout according to the trading strategy being
implemented.
- Specified by:
modifyShout
in interface Strategy
- Parameters:
shout
- The shout to be updated
- Returns:
- The new shout, or null if no shout is to be placed.
modifyShout
public boolean modifyShout(Shout.MutableShout shout)
- Modify the price and quantity of the given shout according to this
strategy.
- Returns:
- false if no shout is to be placed at this time
eventOccurred
public void eventOccurred(AuctionEvent event)
- Specified by:
eventOccurred
in interface AuctionEventListener
getAgent
public AbstractTradingAgent getAgent()
setAgent
public void setAgent(AbstractTradingAgent agent)
- Specified by:
setAgent
in interface Strategy
requiresAuctionHistory
public boolean requiresAuctionHistory()
- Specified by:
requiresAuctionHistory
in interface Strategy
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object