net.sourceforge.jasa.agent.strategy
Class ForecastTradeDirectionPolicy

java.lang.Object
  extended by net.sourceforge.jasa.agent.strategy.ForecastTradeDirectionPolicy
All Implemented Interfaces:
TradeDirectionPolicy

public class ForecastTradeDirectionPolicy
extends java.lang.Object
implements TradeDirectionPolicy

Decide whether to long or short based on whether the agents' valuation for the asset is greater than the current price. If there is no difference between the actual price and the forecast then choose a direction randomly.

 

Field Summary
protected  RandomEngine prng
           
 
Constructor Summary
ForecastTradeDirectionPolicy()
           
 
Method Summary
 boolean decideDirection(double currentPrice, double forecastedPrice)
           
 RandomEngine getPrng()
           
 boolean isBuy(Market market, TradingAgent agent)
          Decide whether to go long long (buy) or short (sell).
 void setPrng(RandomEngine prng)
          
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

prng

protected RandomEngine prng
Constructor Detail

ForecastTradeDirectionPolicy

public ForecastTradeDirectionPolicy()
Method Detail

isBuy

public boolean isBuy(Market market,
                     TradingAgent agent)
Description copied from interface: TradeDirectionPolicy
Decide whether to go long long (buy) or short (sell).

Specified by:
isBuy in interface TradeDirectionPolicy
Parameters:
market - The market in which to make a trading decision
Returns:
true for a long position or false for a short position

decideDirection

public boolean decideDirection(double currentPrice,
                               double forecastedPrice)

getPrng

public RandomEngine getPrng()

setPrng