Home Reference Source Test Repository
import {ZIAgent} from 'market-agents/src/index.js'
public class | source

ZIAgent

Extends:

events~EventEmitterAgentTrader → ZIAgent

Direct Subclass:

UnitAgent

a reimplementation of Gode and Sunder's "Zero Intelligence" robots, as described in the economics research literature.

see

Gode, Dhananjay K., and S. Sunder. [1993]. ‘Allocative efficiency of markets with zero-intelligence traders: Market as a partial substitute for individual rationality.’ Journal of Political Economy, vol. 101, pp.119-137.

Gode, Dhananjay K., and S. Sunder. [1993b]. ‘Lower bounds for efficiency of surplus extraction in double auctions.’ In Friedman, D. and J. Rust (eds). The Double Auction Market: Institutions, Theories, and Evidence, pp. 199-219.

Gode, Dhananjay K., and S. Sunder. [1997a]. ‘What makes markets allocationally efficient?’ Quarterly Journal of Economics, vol. 112 (May), pp.603-630.

Constructor Summary

Public Constructor
public

constructor(options: Object)

creates "Zero Intelligence" robot agent similar to those described in Gode and Sunder (1993)

Method Summary

Public Methods
public

askPrice(marginalCost: number): number | undefined

calculate price this agent is willing to accept as a uniform random number ~ U[marginalCost, maxPrice] inclusive.

public

bidPrice(marginalValue: number): number | undefined

calculate price this agent is willing to pay as a uniform random number ~ U[minPrice, marginalValue] inclusive.

Inherited Summary

From class Agent
public

period: *

public

time, in JS ms since epoch, of agent wake

public

ends current period, causing agent to undertake end-of-period tasks such as production and redemption of units

public

init(newSettings: Object)

initialize an agent to new settings

public

initPeriod(period: number | Object)

re-initialize agent to the beginning of a new simulation period

public

percent of period used

public

guess at number of random Poisson wakes remaining in period

public

produces units in negative inventory with configured costs, usually called automatically at end-of-period.

public

redeem()

redeems units in positive inventory with configured values, usually called automatically at end-of-period.

public

transfer(myTransfers: Object, memo: Object)

increases or decreases agent's inventories of one or more goods and/or money

public

unitCostFunction(good: String, hypotheticalInventory: Object): number

agent's marginal cost of producing next unit

public

unitValueFunction(good: String, hypotheticalInventory: Object): number

agent's marginal value for redeeming next unit

public

wake(info: Object)

wakes agent so it can act, emitting wake, and sets next wakeTime from this.nextWake() unless period.endTime exceeded

From class Trader
public abstract

ask(market: Object, myPrice: number)

send a limit order to sell one unit to the indicated market at myPrice.

public abstract

askPrice(marginalCost: number, market: Object): number | undefined

calculate price this agent is willing to accept.

public abstract

bid(market: Object, myPrice: number)

send a limit order to buy one unit to the indicated market at myPrice.

public abstract

bidPrice(marginalValue: number, market: Object): number | undefined

calculate price this agent is willing to pay.

public

For each market in agent's configured markets, calculates agent's price strategy for buy or sell prices and then sends limit orders for 1 unit at those prices.

Public Constructors

public constructor(options: Object) source

creates "Zero Intelligence" robot agent similar to those described in Gode and Sunder (1993)

Override:

Trader#constructor

Params:

NameTypeAttributeDescription
options Object
  • optional

passed to Trader and Agent constructors()

options.integer boolean
  • optional

true instructs pricing routines to use positive integer prices, false allows positive real number prices

Public Methods

public askPrice(marginalCost: number): number | undefined source

calculate price this agent is willing to accept as a uniform random number ~ U[marginalCost, maxPrice] inclusive. If this.integer is true, the returned price will be an integer.

Override:

Trader#askPrice

Params:

NameTypeAttributeDescription
marginalCost number

the marginal coat of producing the next unit. sets the minimum price for random price generation

Return:

number | undefined

randomized sell price or undefined if marginalCost non-numeric or greater than this.maxPrice

public bidPrice(marginalValue: number): number | undefined source

calculate price this agent is willing to pay as a uniform random number ~ U[minPrice, marginalValue] inclusive. If this.integer is true, the returned price will be an integer.

Override:

Trader#bidPrice

Params:

NameTypeAttributeDescription
marginalValue number

the marginal value of redeeming the next unit. sets the maximum price for random price generation

Return:

number | undefined

randomized buy price or undefined if marginalValue non-numeric or less than this.minPrice