Constructor
new UnitAgent(optionsopt)
creates "Unit" robot agent similar to those described in Brewer(2008)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
options |
Object |
<optional> |
passed to Trader and Agent constructors() |
Classes
Methods
askPrice(marginalCost, market) → {number|undefined}
Calculate price this agent is willing to accept.
The returned price is within one price unit of the previous market trade price, or uses the ZIAgent random algorithm if there is no previous market trade price.
Undefined (no ask) is returned if the propsed price would be lower than the marginalCost parameter
If this.integer is true, the returned price will be an integer.
Parameters:
Name | Type | Description |
---|---|---|
marginalCost |
number | the marginal cost of producing the next unit. sets the minimum price for allowable random price generation |
market |
Object | The market for which a bid is being prepared. An object with lastTradePrice() method. |
Returns:
agent's buy price or undefined
- Type
- number | undefined
bidPrice(marginalValue, market) → {number|undefined}
Calculate price this agent is willing to pay.
The returned price is within one price unit of the previous market trade price, or uses the ZIAgent random algorithm if there is no previous market trade price.
Undefined (no bid) is returned if the propsed price would exceed the marginalValue parameter
If this.integer is true, the returned price will be an integer.
Parameters:
Name | Type | Description |
---|---|---|
marginalValue |
number | the marginal value of redeeming the next unit. sets the maximum price for allowable random price generation |
market |
Object | The market for which a bid is being prepared. An object with lastTradePrice() method. |
Returns:
agent's buy price or undefined
- Type
- number | undefined
randomDelta() → {number}
calculates random change from previous transaction price
Returns:
a uniform random number on [-1,1]; or, if this.integer is set, picked randomly from the set {-1,0,1}
- Type
- number