|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectAbstractAgent
net.sourceforge.jasa.agent.AbstractTradingAgent
public abstract class AbstractTradingAgent
An abstract class representing a simple agent trading in a round-robin market. Traders of this type deal in a single commodity for which they have a well-defined valuation.
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Field Summary | |
---|---|
protected Account |
account
The amount of money this agent posseses. |
protected Order |
currentOrder
The current position for this trader. |
protected AgentGroup |
group
The grouping that this agent belongs to. |
protected double |
initialFunds
The initial amount of money for this agent |
protected int |
initialStock
The initial stock of this agent |
protected boolean |
lastOrderFilled
Did the last order we place in the market result in a transaction? |
protected double |
lastPayoff
The profit made in the last round. |
protected java.util.Set<Market> |
markets
|
protected Inventory |
stock
The inventory of the agent. |
protected double |
totalPayoff
The total profits to date |
protected UtilityFunction |
utilityFunction
The utility function of this agent. |
protected ValuationPolicy |
valuer
The valuer for this agent. |
Constructor Summary | |
---|---|
AbstractTradingAgent(EventScheduler scheduler)
|
|
AbstractTradingAgent(int stock,
double funds,
double privateValue,
EventScheduler scheduler)
|
|
AbstractTradingAgent(int stock,
double funds,
double privateValue,
TradingStrategy strategy,
EventScheduler scheduler)
|
|
AbstractTradingAgent(int stock,
double funds,
EventScheduler scheduler)
|
Method Summary | |
---|---|
abstract boolean |
active()
Determine whether or not this trader is active. |
double |
calculatePayoff(Market auction,
int quantity,
double price)
|
double |
calculateProfit(Market auction,
int quantity,
double price)
|
protected java.lang.Object |
clone()
|
int |
determineQuantity(Market auction)
|
double |
equilibriumProfits(Market auction,
double equilibriumPrice,
int quantity)
Calculate the hypothetical surplus this agent will receive if the market had cleared uniformly at the specified equilibrium price and quantity. |
double |
equilibriumProfitsEachDay(Market auction,
double equilibriumPrice,
int quantity)
|
void |
eventOccurred(SimEvent ev)
|
Account |
getAccount()
|
Inventory |
getCommodityHolding()
|
Order |
getCurrentOrder()
|
double |
getFunds()
|
AgentGroup |
getGroup()
|
double |
getLastPayoff()
Return the profit made in the most recent market round. |
Market |
getMarket()
|
java.util.Collection<Market> |
getMarkets()
|
double |
getPayoff()
|
int |
getStock()
|
double |
getTotalPayoff()
|
TradingStrategy |
getTradingStrategy()
|
UtilityFunction |
getUtilityFunction()
|
double |
getValuation(Market auction)
|
ValuationPolicy |
getValuationPolicy()
|
int |
getVolume(Market auction)
|
void |
giveFunds(AbstractTradingAgent recipient,
double amount)
|
void |
initialise()
|
boolean |
isBuyer(Market auction)
|
boolean |
isInteracted()
|
boolean |
isSeller(Market auction)
|
boolean |
lastOrderFilled()
|
void |
onAgentArrival(AgentArrivalEvent event)
|
void |
onAgentArrival(Market market,
AgentArrivalEvent event)
Place an order in the market as determined by the agent's strategy. |
void |
onEndOfDay(MarketEvent event)
|
void |
onMarketClosed(MarketEvent event)
|
void |
onMarketOpen(MarketEvent event)
|
void |
orderFilled(Market auction,
Order shout,
double price,
int quantity)
|
void |
pay(double amount)
This method is invoked by a buyer on a seller when it wishes to transfer funds. |
java.lang.Object |
protoClone()
|
boolean |
register(Market market)
|
void |
reset()
|
void |
setGroup(AgentGroup group)
|
void |
setMarket(Market market)
|
void |
setMarkets(java.util.Collection<Market> markets)
|
void |
setPrivateValue(double privateValue)
|
void |
setUtilityFunction(UtilityFunction utilityFunction)
|
void |
setValuationPolicy(ValuationPolicy valuer)
|
void |
subscribeToEvents()
|
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Inventory stock
protected int initialStock
protected Account account
protected double initialFunds
protected ValuationPolicy valuer
protected UtilityFunction utilityFunction
protected double lastPayoff
protected double totalPayoff
protected boolean lastOrderFilled
protected Order currentOrder
protected AgentGroup group
protected java.util.Set<Market> markets
Constructor Detail |
---|
public AbstractTradingAgent(int stock, double funds, double privateValue, EventScheduler scheduler)
stock
- The quantity of stock for this trader.funds
- The amount of money for this trader.privateValue
- The private value of the commodity traded by this trader.isSeller
- Whether or not this trader is a seller.public AbstractTradingAgent(int stock, double funds, double privateValue, TradingStrategy strategy, EventScheduler scheduler)
public AbstractTradingAgent(int stock, double funds, EventScheduler scheduler)
public AbstractTradingAgent(EventScheduler scheduler)
Method Detail |
---|
public TradingStrategy getTradingStrategy()
public void onAgentArrival(Market market, AgentArrivalEvent event)
public void subscribeToEvents()
public void eventOccurred(SimEvent ev)
public void onEndOfDay(MarketEvent event)
public void onMarketOpen(MarketEvent event)
public void onMarketClosed(MarketEvent event)
public Order getCurrentOrder()
public Account getAccount()
getAccount
in interface TradingAgent
public void giveFunds(AbstractTradingAgent recipient, double amount)
public void pay(double amount)
amount
- The total amount of money to give to the sellerpublic double getFunds()
public int getStock()
public void initialise()
public void reset()
public double getValuation(Market auction)
getValuation
in interface TradingAgent
public void setPrivateValue(double privateValue)
public double getLastPayoff()
public double getTotalPayoff()
public int determineQuantity(Market auction)
public java.lang.Object protoClone()
public double calculatePayoff(Market auction, int quantity, double price)
public void orderFilled(Market auction, Order shout, double price, int quantity)
orderFilled
in interface TradingAgent
public boolean lastOrderFilled()
public ValuationPolicy getValuationPolicy()
public void setValuationPolicy(ValuationPolicy valuer)
public UtilityFunction getUtilityFunction()
getUtilityFunction
in interface TradingAgent
public void setUtilityFunction(UtilityFunction utilityFunction)
setUtilityFunction
in interface TradingAgent
public AgentGroup getGroup()
public void setGroup(AgentGroup group)
public Inventory getCommodityHolding()
getCommodityHolding
in interface TradingAgent
public java.util.Collection<Market> getMarkets()
public void setMarkets(java.util.Collection<Market> markets)
public void setMarket(Market market)
public Market getMarket()
public boolean register(Market market)
register
in interface TradingAgent
public double equilibriumProfitsEachDay(Market auction, double equilibriumPrice, int quantity)
protected java.lang.Object clone() throws java.lang.CloneNotSupportedException
java.lang.CloneNotSupportedException
public double getPayoff()
public void onAgentArrival(AgentArrivalEvent event)
public boolean isInteracted()
public int getVolume(Market auction)
public boolean isBuyer(Market auction)
public boolean isSeller(Market auction)
public double calculateProfit(Market auction, int quantity, double price)
calculateProfit
in interface TradingAgent
public double equilibriumProfits(Market auction, double equilibriumPrice, int quantity)
public abstract boolean active()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |