|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectAbstractSimulation
net.sourceforge.jasa.market.MarketSimulation
public class MarketSimulation
A simulation of an order-driven market.
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
| Field Summary | |
|---|---|
protected Account |
account
Records the surplus of the mechanism if it is not budget-balanced. |
protected int |
age
|
protected Auctioneer |
auctioneer
The auctioneer for this market. |
protected boolean |
closed
Is the market currently closed. |
protected TimingCondition |
closingCondition
|
protected int |
day
The current trading day (period) |
protected TimingCondition |
dayEndingCondition
|
protected boolean |
endOfRound
|
static java.lang.String |
ERROR_SHOUTSVISIBLE
|
protected double |
initialPrice
The initial price in the market. |
protected double |
lastTransactionPrice
The price of the most recent transaction. |
protected int |
round
The current "round". |
| Constructor Summary | |
|---|---|
MarketSimulation()
|
|
MarketSimulation(SimulationController controller)
|
|
| Method Summary | |
|---|---|
protected void |
activate(TradingAgent agent)
|
void |
begin()
Begin the simulation. |
void |
beginRound()
|
protected void |
checkEndOfDay()
|
void |
clear(Order ask,
Order bid,
double transactionPrice)
Match a buy order with a sell order at the specified price and inform both parties of the resulting transaction. |
void |
clear(Order ask,
Order bid,
double buyerCharge,
double sellerPayment,
int quantity)
Match a buy order with a sell order and inform both parties of the resulting transaction. |
void |
close()
Close the market. |
boolean |
closed()
Returns true if the market is closed. |
void |
end()
End the simulation. |
protected void |
endDay()
Terminate the current trading period (day) |
void |
endRound()
End the current simulation tick. |
int |
getAge()
|
TimingCondition |
getAuctionClosingCondition(java.lang.Class conditionClass)
|
Auctioneer |
getAuctioneer()
Return the current auctioneer for this market. |
double |
getCurrentPrice()
Return the current price. |
int |
getDay()
|
TimingCondition |
getDayEndingCondition(java.lang.Class conditionClass)
|
double |
getInitialPrice()
|
Order |
getLastAsk()
Get the most recent ask (sell order) placed in the market. |
Order |
getLastBid()
Get the most recent bid (buy order) placed in the market. |
Order |
getLastOrder()
Return the most recent order placed in the market. |
double |
getLastTransactionPrice()
Return the price of the most transaction that occurred in the market. |
int |
getLengthOfDay()
Return the duration in ticks of a single trading day. |
int |
getMaximumDays()
Return the maximum number of trading days in the simulation. |
int |
getMaximumRounds()
Get the absolute duration of the entire simulation in ticks. |
int |
getNumberOfRegisteredTraders()
Return the total number of traders registered in the market. |
int |
getNumberOfTraders()
Return the number of traders currently active in the market. |
MarketQuote |
getQuote()
|
int |
getRemainingTime()
Return the time remaining before the market closes. |
int |
getRound()
Get the current round number |
SimulationTime |
getSimulationTime()
|
protected TimingCondition |
getTimingCondition(TimingCondition cond,
java.lang.Class conditionClass)
|
java.util.Iterator<Agent> |
getTraderIterator()
|
Population |
getTraders()
|
void |
informAuctionClosed()
|
void |
informAuctionOpen()
|
void |
informEndOfDay()
|
void |
informRoundClosed()
|
void |
informRoundClosing()
|
void |
informRoundOpening()
|
void |
initialise()
|
void |
initialiseCounters()
|
boolean |
isClosed()
Check whether the market is open. |
boolean |
orderAccepted(Order shout)
Determines whether or not the given shout was matched in the current round of trading. |
void |
placeOrder(Order order)
Submit a new order to the market. |
void |
printState()
Report the state of the market. |
void |
register(TradingAgent trader)
|
void |
remove(AbstractTradingAgent abstractTradingAgent)
|
void |
remove(TradingAgent trader)
Remove a trader from the market. |
void |
removeOrder(Order shout)
Remove an order from the market. |
void |
reset()
|
void |
run()
Run the simulation. |
void |
runSingleRound()
|
void |
setAuctionClosingCondition(TimingCondition cond)
|
void |
setAuctioneer(Auctioneer auctioneer)
Configure the Auctioneer for this market. |
void |
setDayEndingCondition(TimingCondition cond)
|
void |
setInitialPrice(double initialPrice)
Set the price which will be used at the opening of the market. |
void |
setLastTransactionPrice(double lastTransactionPrice)
|
void |
setLengthOfDay(int lengthOfDay)
Configure the maximum duration of a trading day in ticks. |
void |
setMaximumDays(int maximumDays)
Configure the maximum number of days in the simulation. |
void |
setMaximumRounds(int maximumRounds)
Configure the absolute duration of the entire simulation in ticks. |
void |
step()
Step through a single tick of the simulation. |
void |
terminate()
|
boolean |
transactionsOccurred()
Determines whether or not any transactions have occured in the current round of trading. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface net.sourceforge.jasa.market.Market |
|---|
getPopulation |
| Field Detail |
|---|
protected Auctioneer auctioneer
protected boolean closed
protected int round
protected int age
protected Account account
protected int day
protected TimingCondition closingCondition
protected TimingCondition dayEndingCondition
protected boolean endOfRound
protected double lastTransactionPrice
protected double initialPrice
public static final java.lang.String ERROR_SHOUTSVISIBLE
| Constructor Detail |
|---|
public MarketSimulation(SimulationController controller)
public MarketSimulation()
| Method Detail |
|---|
public void initialiseCounters()
public void initialise()
public void reset()
public void informAuctionClosed()
public void informEndOfDay()
public void informAuctionOpen()
public void informRoundOpening()
public void beginRound()
public int getRound()
getRound in interface Marketpublic int getAge()
getAge in interface Marketpublic int getDay()
getDay in interface Marketpublic Auctioneer getAuctioneer()
Market
getAuctioneer in interface Market
public Order getLastBid()
throws ShoutsNotVisibleException
ShoutsNotVisibleException
public Order getLastAsk()
throws ShoutsNotVisibleException
ShoutsNotVisibleExceptionpublic void run()
public void begin()
public void end()
public void step()
public void endRound()
public boolean isClosed()
public void runSingleRound()
public void informRoundClosing()
public void informRoundClosed()
protected void checkEndOfDay()
public void close()
close in interface Marketprotected void endDay()
public int getRemainingTime()
getRemainingTime in interface Marketpublic int getLengthOfDay()
public void setLengthOfDay(int lengthOfDay)
lengthOfDay - public int getMaximumDays()
public void setMaximumRounds(int maximumRounds)
maximumRounds - public int getMaximumRounds()
public void setMaximumDays(int maximumDays)
maximumDays -
protected TimingCondition getTimingCondition(TimingCondition cond,
java.lang.Class conditionClass)
public TimingCondition getAuctionClosingCondition(java.lang.Class conditionClass)
public TimingCondition getDayEndingCondition(java.lang.Class conditionClass)
public void setAuctionClosingCondition(TimingCondition cond)
public void setDayEndingCondition(TimingCondition cond)
public SimulationTime getSimulationTime()
public void clear(Order ask,
Order bid,
double transactionPrice)
clear in interface MarkettransactionPrice - The price of the transaction.
public void clear(Order ask,
Order bid,
double buyerCharge,
double sellerPayment,
int quantity)
clear in interface MarketbuyerCharge - The price that the buyer must pay.sellerPayment - The price that the seller must pay.quantity - The volume of the transaction.ask - The sell order involved in the transactionbid - The buy order involved in the transaction.
public boolean orderAccepted(Order shout)
throws ShoutsNotVisibleException
orderAccepted in interface MarketShoutsNotVisibleException
public boolean transactionsOccurred()
throws ShoutsNotVisibleException
transactionsOccurred in interface MarketShoutsNotVisibleExceptionpublic void remove(TradingAgent trader)
public int getNumberOfTraders()
getNumberOfTraders in interface Marketpublic int getNumberOfRegisteredTraders()
protected void activate(TradingAgent agent)
public Population getTraders()
public void setAuctioneer(Auctioneer auctioneer)
auctioneer - public boolean closed()
Market
closed in interface Market
public Order getLastOrder()
throws ShoutsNotVisibleException
Market
getLastOrder in interface MarketShoutsNotVisibleExceptionpublic MarketQuote getQuote()
getQuote in interface QuoteProviderpublic void removeOrder(Order shout)
Market
removeOrder in interface Market
public void placeOrder(Order order)
throws AuctionException
placeOrder in interface Marketshout - The new shout in the market.
AuctionExceptionpublic void printState()
Market
printState in interface Marketpublic void register(TradingAgent trader)
public java.util.Iterator<Agent> getTraderIterator()
getTraderIterator in interface Marketpublic double getLastTransactionPrice()
Market
getLastTransactionPrice in interface Marketpublic void setLastTransactionPrice(double lastTransactionPrice)
public double getCurrentPrice()
Market
getCurrentPrice in interface Marketpublic void remove(AbstractTradingAgent abstractTradingAgent)
remove in interface Marketpublic double getInitialPrice()
public void setInitialPrice(double initialPrice)
initialPrice - The initial price.public void terminate()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||