Specialist


Inherits From:
SwarmObject
Declared In:
Specialist.h


Class Description

One instance of this class is used to manage the trading and set the stock price. It also manages the market-level parameters.


Defined Types

Synopsis:

typedef enum
{    
    SP_RE = 0,
    SP_SLOPE = 1,
    SP_ETA = 2
} SpecialistType;


Instance Variables

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;

maxpriceCeiling on stock price
minpriceFloor under stock price
etaUsed in adjusting price to balance supply/demand
minexcessexcess demand must be smaller than this if the price adjustment process is to stop
rearational expectations benchmark
rebtrialprice = rea*dividend + reb
bidfracused in completing trades: volume/bidtotal
offerfracused in completing trades: volume/offertotal
maxiterationsmaximum passes while adjusting trade conditions
volumevolume of trades conducted
taupdecayThe agent's profit is calculated as an exponentially weighted moving average. This coefficient weights old inputs in the EWMA
taupnewUsed in calculating exponentially weighted moving average; taupnew = -expm1(-1.0/aTaup); taupdecay = 1.0 - taupnew;
sptypean enumerated type indicating the sort of Specialist is being used, valued 0, 1, or 2


Method Types

- setMaxPrice:
- setMinPrice:
- setTaup:
- setSPtype:
- setMaxIterations:
- setMinExcess:
- setETA:
- setREA:
- setREB:
- performTrading:Market:
- getVolume
- completeTrades:Market:

Instance Methods

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.


getVolume

- (double)getVolume

Returns the volume of trade to anybody that wants, such as the observer or output objects


performTrading:Market:

- (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:

- setETA:(double)ETA

No method description.


setMaxIterations:

- setMaxIterations:(int)someIterations

Set the maximum number of interations to be done while looking for a market clearing price


setMaxPrice:

- setMaxPrice:(double)maximumPrice

No method description.


setMinExcess:

- setMinExcess:(double)minimumExcess

No method description.


setMinPrice:

- setMinPrice:(double)minimumPrice

No method description.


setREA:

- setREA:(double)REA

No method description.


setREB:

- setREB:(double)REB

No method description.


setSPtype:

- 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:

- setTaup:(double)aTaup

No method description.


Version 1.1 Copyright ©2001. All Rights Reserved.