Class: MidpointAgent

MidpointAgent()

MidpointAgent - An agent that bids/asks halfway between the current bid and current ask. When there is no current bid or current ask, the agent bids minPrice or asks maxPrice.

Constructor

new MidpointAgent()

Source:

Classes

MidpointAgent

Methods

askPrice(marginalCost, market) → {number|undefined}

Calculate price this agent is willing to accept. The returned price is either the max price, the midpoint of the bid/ask, or undefined. Undefined (no ask) is returned if the propsed price is less than the marginalCost parameter this.integer==true causes midpoint prices to be rounded up to the next integer before comparison with marginalValue
Parameters:
Name Type Description
marginalCost number the marginal cost of producing the next unit. sets the minimum price for allowable bidding
market Object The market for which a bid is being prepared. An object with currentBidPrice() and currentAskPrice() methods.
Source:
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 either the min price, the midpoint of the bid/ask, or undefined. Undefined (no bid) is returned if the propsed price would exceed the marginalValue parameter this.integer==true causes midpoint prices to be rounded up to the next integer before comparison with marginalValue
Parameters:
Name Type Description
marginalValue number the marginal value of redeeming the next unit. sets the maximum price for allowable bidding
market Object The market for which a bid is being prepared. An object with currentBidPrice() and currentAskPrice() methods.
Source:
Returns:
agent's buy price or undefined
Type
number | undefined