|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectSwarmObjectImpl
BasicSumAgent
StopLossAgent
StopLossAgent inherits from BasicSumAgent and operates in random way, like a random agent. After that, its behavior can be modified by a "stop loss" decision, operating in two possible ways (i) without memory: if the current price, i.e. the last executedPrice (at day t) is >= to (mean price at day t-stopLossInterval) *(1+maxLossRate) <= to (mean price at day t-stopLossInterval) *(1-maxLossRate) and checkingIfShortOrLong=0, the agent buys/sells, at the current price, a quantity of shares between 1 and maxOrderQuantity; (ii) with memory (the short or long position of the agent is taken in account; if the agent has no position, doesn't operate here): if the current price, i.e. the last executedPrice (at day t) is >= to (mean price at day t-stopLossInterval) *(1+maxLossRate) <= to (mean price at day t-stopLossInterval) *(1-maxLossRate) and checkingIfShortOrLong=1, the agent buys if short (shareQuantity<0); sells if long (shareQuantity>0) at the current price, a quantity of shares between 1 and maxOrderQuantity (regardless its shareQuantity value).
Field Summary | |
(package private) int |
checkingIfShortOrLong
These are the variables that the agent checks for the stop-loss strategy. |
(package private) double |
maxLossRate
THis is the maximun rate of loss that the agent will accept before appliying the strategy. |
double[] |
order
This is the vector containing the basic input of an order: the price of the offer, the quantity of shares and the identification number of the agent. |
StopLossRuleMaster |
ruleMaster
This is the RuleMaster of the stop loss agent. |
(package private) int |
stopLossInterval
These are the variables that the agent checks for the stop-loss strategy. |
Constructor Summary | |
StopLossAgent(Zone aZone,
int maxOrderQuantity)
Constructor for a new stop loss agent. |
Method Summary | |
void |
act0()
This method is called in the first phase of the day. |
void |
act1()
This method is called during the simulated day. |
void |
setMaxLossRate$andCheckingIfShortOrLong(double r,
int sl)
This method sets the maxlossrate and the option checking if short or long. |
void |
setRuleMaster(StopLossRuleMaster r)
This method stes the Rule Master. |
void |
setStopLossInterval(int i)
This method sets the stoplossinterval. |
Methods inherited from class BasicSumAgent |
act2, extract, getWealthAtMeanDailyPrice, setAgentProbToActWithMarketPrice, setAsymmetricBuySellProb, setBook, setConfirmationOfExecutedPrice, setMaxOrderQuantity, setNumber, setPrinting |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public double[] order
int stopLossInterval
int checkingIfShortOrLong
double maxLossRate
public StopLossRuleMaster ruleMaster
Constructor Detail |
public StopLossAgent(Zone aZone, int maxOrderQuantity)
Method Detail |
public void setRuleMaster(StopLossRuleMaster r)
public void setStopLossInterval(int i)
public void setMaxLossRate$andCheckingIfShortOrLong(double r, int sl)
public void act0()
act0
in class BasicSumAgent
public void act1()
act1
in class BasicSumAgent
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |