net.sourceforge.jasa.agent
Class SimpleTradingAgent

java.lang.Object
  extended by AbstractAgent
      extended by net.sourceforge.jasa.agent.AbstractTradingAgent
          extended by net.sourceforge.jasa.agent.SimpleTradingAgent
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, TradingAgent, MarketEventListener

public class SimpleTradingAgent
extends AbstractTradingAgent

Agents of this type have a fixed volume, and they trade units equal to their volume in each round of the market.

 

Field Summary
 
Fields inherited from class net.sourceforge.jasa.agent.AbstractTradingAgent
account, currentOrder, group, initialFunds, initialStock, lastOrderFilled, lastPayoff, markets, stock, totalPayoff, utilityFunction, valuer
 
Constructor Summary
SimpleTradingAgent()
           
SimpleTradingAgent(double privateValue, boolean isSeller, TradingStrategy strategy, EventScheduler scheduler)
           
SimpleTradingAgent(double privateValue, EventScheduler scheduler)
           
SimpleTradingAgent(EventScheduler scheduler)
           
SimpleTradingAgent(int stock, double funds, double privateValue, EventScheduler scheduler)
           
SimpleTradingAgent(int stock, double funds, double privateValue, TradingStrategy strategy, EventScheduler scheduler)
           
SimpleTradingAgent(int stock, double funds, EventScheduler scheduler)
           
 
Method Summary
 boolean acceptDeal(Market auction, double price, int quantity)
           
 boolean active()
          Determine whether or not this trader is active.
 double calculateProfit(Market auction, int quantity, double price)
           
 double getLastPayoff()
          Return the profit made in the most recent market round.
 void onAgentArrival(Market auction, AgentArrivalEvent event)
          Place an order in the market as determined by the agent's strategy.
 void onEndOfDay(MarketEvent event)
           
 java.lang.String toString()
           
 
Methods inherited from class net.sourceforge.jasa.agent.AbstractTradingAgent
calculatePayoff, clone, determineQuantity, equilibriumProfits, equilibriumProfitsEachDay, eventOccurred, getAccount, getCommodityHolding, getCurrentOrder, getFunds, getGroup, getMarket, getMarkets, getPayoff, getStock, getTotalPayoff, getTradingStrategy, getUtilityFunction, getValuation, getValuationPolicy, getVolume, giveFunds, initialise, isBuyer, isInteracted, isSeller, lastOrderFilled, onAgentArrival, onMarketClosed, onMarketOpen, orderFilled, pay, protoClone, register, reset, setGroup, setMarket, setMarkets, setPrivateValue, setUtilityFunction, setValuationPolicy, subscribeToEvents
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleTradingAgent

public SimpleTradingAgent(int stock,
                          double funds,
                          double privateValue,
                          EventScheduler scheduler)

SimpleTradingAgent

public SimpleTradingAgent(int stock,
                          double funds,
                          double privateValue,
                          TradingStrategy strategy,
                          EventScheduler scheduler)

SimpleTradingAgent

public SimpleTradingAgent(int stock,
                          double funds,
                          EventScheduler scheduler)

SimpleTradingAgent

public SimpleTradingAgent(double privateValue,
                          boolean isSeller,
                          TradingStrategy strategy,
                          EventScheduler scheduler)

SimpleTradingAgent

public SimpleTradingAgent(double privateValue,
                          EventScheduler scheduler)

SimpleTradingAgent

public SimpleTradingAgent(EventScheduler scheduler)

SimpleTradingAgent

public SimpleTradingAgent()
Method Detail

onAgentArrival

public void onAgentArrival(Market auction,
                           AgentArrivalEvent event)
Description copied from class: AbstractTradingAgent
Place an order in the market as determined by the agent's strategy.

Overrides:
onAgentArrival in class AbstractTradingAgent

acceptDeal

public boolean acceptDeal(Market auction,
                          double price,
                          int quantity)

getLastPayoff

public double getLastPayoff()
Description copied from class: AbstractTradingAgent
Return the profit made in the most recent market round. This can be used as, e.g. input to a re-inforcement learning algorithm.

Overrides:
getLastPayoff in class AbstractTradingAgent

active

public boolean active()
Description copied from class: AbstractTradingAgent
Determine whether or not this trader is active. Inactive traders do not place shouts in the market, but do carry on learning through their strategy.

Specified by:
active in class AbstractTradingAgent
Returns:
true if the trader is active.

onEndOfDay

public void onEndOfDay(MarketEvent event)
Overrides:
onEndOfDay in class AbstractTradingAgent

toString

public java.lang.String toString()

calculateProfit

public double calculateProfit(Market auction,
                              int quantity,
                              double price)
Specified by:
calculateProfit in interface TradingAgent
Overrides:
calculateProfit in class AbstractTradingAgent