net.sourceforge.jasa.agent.strategy
Class AbstractTradingStrategy

java.lang.Object
  extended by AbstractStrategy
      extended by net.sourceforge.jasa.agent.strategy.AbstractTradingStrategy
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, TradingStrategy, MarketEventListener
Direct Known Subclasses:
FixedQuantityStrategyImpl

public abstract class AbstractTradingStrategy
extends AbstractStrategy
implements java.io.Serializable, TradingStrategy, java.lang.Cloneable

An abstract implementation of the Strategy interface that provides skeleton functionality for making trading decisions.

 

Field Summary
protected  Market auction
           
protected  TradeDirectionPolicy tradeDirectionPolicy
           
 
Constructor Summary
AbstractTradingStrategy()
           
AbstractTradingStrategy(AbstractTradingAgent agent)
           
 
Method Summary
 java.lang.Object clone()
           
 AbstractTradingAgent getAgent()
           
 TradeDirectionPolicy getTradeDirectionPolicy()
           
 void initialise()
           
 boolean isBuy(Market market)
           
 Order modifyOrder(Order currentShout, Market auction)
          Modify the price and quantity of the given shout according to this strategy.
 boolean modifyShout(Order shout)
           
 java.lang.Object protoClone()
           
 void reset()
           
 void setAgent(AbstractTradingAgent agent)
           
 void setTradeDirectionPolicy(TradeDirectionPolicy tradeDirectionPolicy)
          
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sourceforge.jasa.agent.TradingStrategy
determineQuantity, subscribeToEvents
 

Field Detail

auction

protected Market auction

tradeDirectionPolicy

protected TradeDirectionPolicy tradeDirectionPolicy
Constructor Detail

AbstractTradingStrategy

public AbstractTradingStrategy()

AbstractTradingStrategy

public AbstractTradingStrategy(AbstractTradingAgent agent)
Method Detail

reset

public void reset()

protoClone

public java.lang.Object protoClone()

modifyOrder

public Order modifyOrder(Order currentShout,
                         Market auction)
Modify the price and quantity of the given shout according to this strategy.

Specified by:
modifyOrder in interface TradingStrategy
Parameters:
currentShout - The shout to be updated
Returns:
false if no shout is to be placed at this time

modifyShout

public boolean modifyShout(Order shout)

initialise

public void initialise()
Specified by:
initialise in interface TradingStrategy

getAgent

public AbstractTradingAgent getAgent()

setAgent

public void setAgent(AbstractTradingAgent agent)
Specified by:
setAgent in interface TradingStrategy

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Throws:
java.lang.CloneNotSupportedException

isBuy

public boolean isBuy(Market market)
Specified by:
isBuy in interface TradingStrategy

getTradeDirectionPolicy

public TradeDirectionPolicy getTradeDirectionPolicy()

setTradeDirectionPolicy