edu.cuny.cat.trader.strategy
Class MomentumStrategy
java.lang.Object
java.util.Observable
edu.cuny.cat.trader.strategy.AbstractStrategy
edu.cuny.cat.trader.strategy.FixedQuantityStrategyImpl
edu.cuny.cat.trader.strategy.AdaptiveStrategyImpl
edu.cuny.cat.trader.strategy.MomentumStrategy
- All Implemented Interfaces:
- AuctionEventListener, AdaptiveStrategy, FixedQuantityStrategy, Strategy, edu.cuny.config.param.Parameterizable, edu.cuny.obj.Prototypeable, edu.cuny.obj.Resetable, java.io.Serializable, java.lang.Cloneable
- Direct Known Subclasses:
- PriestVanTolStrategy, ZIPStrategy, ZIQStrategy
public abstract class MomentumStrategy
- extends AdaptiveStrategyImpl
- implements java.io.Serializable
A trading strategy that learns to adapt the price to offer. It uses a
MimicryLearner
to learn a profit margin, which
together with the trader's private value determines the price to offer.
It also brings randomness to some extent by perturbing the price to be
offered.
Parameters
base.scaling
double >= 0 (by default 0.05) |
(the maximum of perturbation on price) |
base.learner
name of class, implementing
MimicryLearner |
(the learning algorithm to adapt price) |
Default Base
- Version:
- $Revision: 1.25 $
- Author:
- Steve Phelps
- 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 |
Methods inherited from interface edu.cuny.obj.Prototypeable |
protoClone |
Methods inherited from interface edu.cuny.obj.Resetable |
reset |
learner
protected edu.cuny.ai.learning.MimicryLearner learner
currentPrice
protected double currentPrice
lastShout
protected Shout lastShout
scaling
protected double scaling
- A parameter used to scale the randomly drawn price adjustment perturbation
values.
lastShoutAccepted
protected boolean lastShoutAccepted
lastShoutPrice
protected double lastShoutPrice
initialMarginDistribution
protected cern.jet.random.AbstractContinousDistribution initialMarginDistribution
relativePerterbationDistribution
protected cern.jet.random.AbstractContinousDistribution relativePerterbationDistribution
absolutePerterbationDistribution
protected cern.jet.random.AbstractContinousDistribution absolutePerterbationDistribution
P_DEF_BASE
public static final java.lang.String P_DEF_BASE
- See Also:
- Constant Field Values
P_SCALING
public static final java.lang.String P_SCALING
- See Also:
- Constant Field Values
P_LEARNER
public static final java.lang.String P_LEARNER
- See Also:
- Constant Field Values
MomentumStrategy
public MomentumStrategy()
MomentumStrategy
public MomentumStrategy(AbstractTradingAgent agent)
setup
public void setup(edu.cuny.config.param.ParameterDatabase parameters,
edu.cuny.config.param.Parameter base)
- Specified by:
setup
in interface edu.cuny.config.param.Parameterizable
- Overrides:
setup
in class FixedQuantityStrategyImpl
modifyShout
public boolean modifyShout(Shout.MutableShout shout)
- Description copied from class:
AbstractStrategy
- Modify the price and quantity of the given shout according to this
strategy.
- Overrides:
modifyShout
in class FixedQuantityStrategyImpl
- Returns:
- false if no shout is to be placed at this time
requiresAuctionHistory
public boolean requiresAuctionHistory()
- Specified by:
requiresAuctionHistory
in interface Strategy
- Overrides:
requiresAuctionHistory
in class AbstractStrategy
eventOccurred
public void eventOccurred(AuctionEvent event)
- Specified by:
eventOccurred
in interface AuctionEventListener
- Overrides:
eventOccurred
in class AdaptiveStrategyImpl
initMargin
protected void initMargin()
processLastShout
protected void processLastShout(Shout lastShout)
shoutPosted
protected void shoutPosted(ShoutPostedEvent event)
transactionPosted
protected void transactionPosted(TransactionPostedEvent event)
processDayClosed
protected void processDayClosed()
- if there is a shout placed as the last activity, since no more shout or
transaction is coming, this last shout needs to be processed just as other
shouts with following shouts were done.
setLearner
public void setLearner(edu.cuny.ai.learning.Learner learner)
- Specified by:
setLearner
in interface AdaptiveStrategy
getLearner
public edu.cuny.ai.learning.Learner getLearner()
- Specified by:
getLearner
in interface AdaptiveStrategy
setMargin
public void setMargin(double margin)
getCurrentPrice
public double getCurrentPrice()
getLastShout
public Shout getLastShout()
isLastShoutAccepted
public boolean isLastShoutAccepted()
setScaling
public void setScaling(double scaling)
getScaling
public double getScaling()
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()
toString
public java.lang.String toString()
- Overrides:
toString
in class FixedQuantityStrategyImpl