net.sourceforge.jasa.agent.strategy
Class MDPStrategy

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.AdaptiveStrategyImpl
                      extended by net.sourceforge.jasa.agent.strategy.DiscreteLearnerStrategy
                          extended by net.sourceforge.jasa.agent.strategy.MDPStrategy
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, AdaptiveStrategy, FixedQuantityStrategy, TradingStrategy, MarketEventListener

public class MDPStrategy
extends DiscreteLearnerStrategy
implements java.io.Serializable

A trading strategy that uses an MDP learning algorithm, such as the Q-learning algorithm, to adapt its trading behaviour in successive market rounds. The current market-quote is hashed to produce an integer state value.

 

Field Summary
protected  double askBinStart
           
protected  double askBinWidth
           
protected  double bidBinStart
           
protected  double bidBinWidth
           
protected  boolean firstShout
           
protected  MDPLearner learner
           
protected  int quoteBins
           
 
Fields inherited from class net.sourceforge.jasa.agent.strategy.DiscreteLearnerStrategy
markupScale
 
Fields inherited from class net.sourceforge.jasa.agent.strategy.AbstractTradingStrategy
auction, tradeDirectionPolicy
 
Constructor Summary
MDPStrategy()
           
MDPStrategy(AbstractTradingAgent agent, double askBinStart, double askBinWidth, double bidBinStart, double bidBinWidth)
           
 
Method Summary
 int act()
          Generate an action from the learning algorithm.
 int auctionState(Market auction)
          Hash the market quote to produce a state value for the learning algorithm.
 Learner getLearner()
           
 void learn(Market auction)
          Perform learning.
 void reset()
           
 void setLearner(Learner learner)
           
 java.lang.String toString()
           
 
Methods inherited from class net.sourceforge.jasa.agent.strategy.DiscreteLearnerStrategy
eventOccurred, getMarkupScale, initialise, modifyShout, onRoundFinished, setMarkupScale, subscribeToEvents
 
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, setAgent, setTradeDirectionPolicy
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.sourceforge.jasa.agent.TradingStrategy
determineQuantity, isBuy, modifyOrder, setAgent, subscribeToEvents
 

Field Detail

learner

protected MDPLearner learner

bidBinStart

protected double bidBinStart

bidBinWidth

protected double bidBinWidth

askBinStart

protected double askBinStart

askBinWidth

protected double askBinWidth

quoteBins

protected int quoteBins

firstShout

protected boolean firstShout
Constructor Detail

MDPStrategy

public MDPStrategy(AbstractTradingAgent agent,
                   double askBinStart,
                   double askBinWidth,
                   double bidBinStart,
                   double bidBinWidth)

MDPStrategy

public MDPStrategy()
Method Detail

act

public int act()
Description copied from class: DiscreteLearnerStrategy
Generate an action from the learning algorithm.

Specified by:
act in class DiscreteLearnerStrategy

learn

public void learn(Market auction)
Description copied from class: DiscreteLearnerStrategy
Perform learning.

Specified by:
learn in class DiscreteLearnerStrategy

auctionState

public int auctionState(Market auction)
Hash the market quote to produce a state value for the learning algorithm.


reset

public void reset()
Overrides:
reset in class AbstractTradingStrategy

getLearner

public Learner getLearner()
Specified by:
getLearner in interface AdaptiveStrategy

setLearner

public void setLearner(Learner learner)
Specified by:
setLearner in interface AdaptiveStrategy

toString

public java.lang.String toString()