- Inherits From:
- SwarmObject
- Declared In:
- Specialist.h
Synopsis:
typedef enum
{
SP_RE = 0,
SP_SLOPE = 1,
SP_ETA = 2
} SpecialistType;
double maxprice;
double minprice;
double eta;
double minexcess;
double rea;
double reb;
double bidfrac;
double offerfrac;
int maxiterations;
double volume;
double taupdecay;
double taupnew;
SpecialistType sptype;
maxprice Ceiling on stock price minprice Floor under stock price eta Used in adjusting price to balance supply/demand minexcess excess demand must be smaller than this if the price adjustment process is to stop rea rational expectations benchmark reb trialprice = rea*dividend + reb bidfrac used in completing trades: volume/bidtotal offerfrac used in completing trades: volume/offertotal maxiterations maximum passes while adjusting trade conditions volume volume of trades conducted taupdecay The agent's profit is calculated as an exponentially weighted moving average. This coefficient weights old inputs in the EWMA taupnew Used in calculating exponentially weighted moving average; taupnew = -expm1(-1.0/aTaup); taupdecay = 1.0 - taupnew; sptype an enumerated type indicating the sort of Specialist is being used, valued 0, 1, or 2
- - setMaxPrice:
- - setMinPrice:
- - setTaup:
- - setSPtype:
- - setMaxIterations:
- - setMinExcess:
- - setETA:
- - setREA:
- - setREB:
- - performTrading:Market:
- - getVolume
- - completeTrades:Market:
- completeTrades:agentList Market:worldForSpec
Updates the agents cash and position to consummate the trades previously negotiated in -performTrading, with rationing if necessary.
Makes the actual trades at the last trial price (which is now the market price), by adjusting the agents' holdings and cash. The actual purchase/sale my be less than that requested if rationing is imposed by the specialist -- usually one of "bidfrac" and "offerfrac" will be less than 1.0.
This could easiliy be done by the agents themselves, but we let the specialist do it for efficiency.
- (double)getVolume
Returns the volume of trade to anybody that wants, such as the observer or output objects
- (double)performTrading:(id)agentList Market:(id)worldForSpec
This is the core method that sets a succession of trial prices and asks the agents for their bids or offer at each, generally adjusting the price towards reducing |bids - offers|. * It gets bids and offers from the agents and * adjuss the price. Returns the final trading price, which becomes * the next market price. Various methods are implemented, but all * have the structure: 1. Set a trial price
2. Send each agent a -getDemandAndSlope:forPrice: message and accumulate the total number of bids and offers at that price.
3. [In some cases] go to 1.
4. Return the last trial price.
- setETA:(double)ETA
No method description.
- setMaxIterations:(int)someIterations
Set the maximum number of interations to be done while looking for a market clearing price
- setMaxPrice:(double)maximumPrice
No method description.
- setMinExcess:(double)minimumExcess
No method description.
- setMinPrice:(double)minimumPrice
No method description.
- setREA:(double)REA
No method description.
- setREB:(double)REB
No method description.
- setSPtype:(int)i
The specialist can be set to type 0, 1, or 2. If this variable is set to any other value, the model will set the Specialist to type 1 and give a warning in the terminal
- setTaup:(double)aTaup
No method description.