net.sourceforge.jasa.agent.strategy
Class MomentumStrategy

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

public abstract class MomentumStrategy
extends FixedDirectionStrategy
implements java.io.Serializable

 

Field Summary
protected  AbstractContinousDistribution absolutePerterbationDistribution
           
protected  double currentPrice
           
protected  AbstractContinousDistribution initialMarginDistribution
           
protected  Order lastShout
           
protected  boolean lastShoutAccepted
           
protected  MimicryLearner learner
           
protected  RandomEngine prng
           
protected  AbstractContinousDistribution relativePerterbationDistribution
           
protected  double scaling
          A parameter used to scale the randomly drawn price adjustment perturbation values.
protected  double trAskPrice
           
protected  double trBidPrice
           
protected  double trPrice
           
 
Fields inherited from class net.sourceforge.jasa.agent.strategy.AbstractTradingStrategy
auction, tradeDirectionPolicy
 
Constructor Summary
MomentumStrategy()
           
MomentumStrategy(AbstractTradingAgent agent, RandomEngine prng)
           
 
Method Summary
protected abstract  void adjustMargin()
           
protected  void adjustMargin(double targetMargin)
           
 void afterPropertiesSet()
           
protected  double calculatePrice(double margin)
           
 void eventOccurred(SimEvent event)
           
 double getCurrentPrice()
           
 AbstractContinousDistribution getInitialMarginDistribution()
           
 Order getLastShout()
           
 Learner getLearner()
           
 RandomEngine getPrng()
           
 double getScaling()
           
 double getTrAskPrice()
           
 double getTrBidPrice()
           
 double getTrPrice()
           
 void initialise()
           
 boolean isLastShoutAccepted()
           
 boolean modifyShout(Order shout)
           
protected  void onAgentPolled(AgentPolledEvent event)
           
 void onMarketOpen(MarketOpenEvent event)
           
protected  void onOrderPlaced(OrderPlacedEvent event)
           
 void onRoundClosed(Market auction)
           
protected  void onTransactionExecuted(TransactionExecutedEvent event)
           
protected  double perterb(double price)
           
 void setInitialMarginDistribution(AbstractContinousDistribution initialMarginDistribution)
           
 void setLearner(Learner learner)
           
 void setLearner(MimicryLearner learner)
           
 void setMargin(double margin)
           
 void setPrng(RandomEngine prng)
          
Methods inherited from class net.sourceforge.jasa.agent.strategy.FixedDirectionStrategy
isBuy, isSell, setBuy
 
Methods inherited from class net.sourceforge.jasa.agent.strategy.FixedQuantityStrategyImpl
determineQuantity, getQuantity, setQuantity
 
Methods inherited from class net.sourceforge.jasa.agent.strategy.AbstractTradingStrategy
clone, getAgent, getTradeDirectionPolicy, isBuy, modifyOrder, protoClone, reset, setAgent, setTradeDirectionPolicy
 
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
isBuy, modifyOrder, setAgent
 

Field Detail

learner

protected MimicryLearner learner

currentPrice

protected double currentPrice

lastShout

protected Order lastShout

scaling

protected double scaling
A parameter used to scale the randomly drawn price adjustment perturbation values.


lastShoutAccepted

protected boolean lastShoutAccepted

trPrice

protected double trPrice

trBidPrice

protected double trBidPrice

trAskPrice

protected double trAskPrice

initialMarginDistribution

protected AbstractContinousDistribution initialMarginDistribution

relativePerterbationDistribution

protected AbstractContinousDistribution relativePerterbationDistribution

absolutePerterbationDistribution

protected AbstractContinousDistribution absolutePerterbationDistribution

prng

protected RandomEngine prng
Constructor Detail

MomentumStrategy

public MomentumStrategy(AbstractTradingAgent agent,
                        RandomEngine prng)

MomentumStrategy

public MomentumStrategy()
Method Detail

initialise

public void initialise()
Specified by:
initialise in interface TradingStrategy
Overrides:
initialise in class AbstractTradingStrategy

modifyShout

public boolean modifyShout(Order shout)
Overrides:
modifyShout in class FixedDirectionStrategy

subscribeToEvents

public void subscribeToEvents(EventScheduler scheduler)
Specified by:
subscribeToEvents in interface TradingStrategy

eventOccurred

public void eventOccurred(SimEvent event)

onMarketOpen

public void onMarketOpen(MarketOpenEvent event)

onAgentPolled

protected void onAgentPolled(AgentPolledEvent event)

onOrderPlaced

protected void onOrderPlaced(OrderPlacedEvent event)

onTransactionExecuted

protected void onTransactionExecuted(TransactionExecutedEvent event)

onRoundClosed

public void onRoundClosed(Market auction)

setLearner

public void setLearner(Learner learner)

getLearner

public Learner getLearner()

setMargin

public void setMargin(double margin)

getCurrentPrice

public double getCurrentPrice()

getLastShout

public Order getLastShout()

isLastShoutAccepted

public boolean isLastShoutAccepted()

setScaling

public void setScaling(double scaling)

getScaling

public double getScaling()

getTrAskPrice

public double getTrAskPrice()

getTrBidPrice

public double getTrBidPrice()

getTrPrice

public double getTrPrice()

getPrng

public RandomEngine getPrng()

setPrng


setLearner

public void setLearner(MimicryLearner learner)

getInitialMarginDistribution

public AbstractContinousDistribution getInitialMarginDistribution()

setInitialMarginDistribution

public void setInitialMarginDistribution(AbstractContinousDistribution initialMarginDistribution)

afterPropertiesSet

public void afterPropertiesSet()
                        throws java.lang.Exception
Throws:
java.lang.Exception

calculatePrice

protected double calculatePrice(double margin)

targetMargin

protected double targetMargin(double targetPrice)

adjustMargin

protected void adjustMargin(double targetMargin)

perterb

protected double perterb(double price)

adjustMargin

protected abstract void adjustMargin()