Market
Extends:
Market with contingent order features, such as stop orders, one-cancels-other orders and one-sends-other orders
Constructor Summary
Public Constructor | ||
public |
constructor(options: Object) Market constructor |
Member Summary
Public Members | ||
public |
container for books and book settings |
|
public |
list of all books |
|
public |
inbox for pre-orders from internal processes such as stops and triggers. |
|
public |
lastTrade: * |
Method Summary
Public Methods | ||
public |
clear() clears or resets market to initial "new" condition, clearing active list, books, and trash |
|
public |
market current Ask Price |
|
public |
market current Bid Price |
|
public |
last trade price, if any. |
|
public |
process order from the top of the inbox, returning inbox length |
|
public |
submit order to the Market's inbox for eventual processing |
Public Constructors
public constructor(options: Object) source
Market constructor
Params:
Name | Type | Attribute | Description |
options | Object | Options affecting market behavior. Also passed to marekt-engine constructor. Accessible later in this.o |
|
options.buyImprove | number |
|
If positive, indicates entry in buy book new buy order must beat to be acceptable. 0=off. 1= new buy must beat book highest buy. 2=must beat 2nd best book,etc. |
options.sellImprove | number |
|
If positive, indicates entry in sell book new sell order must beat to be acceptable. 0=off. 1= new sell must be lower than lowest previous sell order on book. |
options.resetAfterEachTrade | boolean |
|
If true, calls .clear() after each trade, clearing the market books and active trade list. |
options.buySellBookLimit | number |
|
If positive, after each trade keeps at most buySellBookLimit orders in the buy book, and buySellBookLimit orders in the sell book, deleting other orders. |
options.bookfixed | boolean |
|
If true, books are fixed size and scan active list after each trade. If false, books are accordian-style that can shrink 50% before re-scanning old orders. |
options.booklimit | number |
|
Indicates maximum and initial size, in orders, of order book for each category (buy,sell,buystop,sellstop). |
Listen:
bump |
triggering book update with .cleanup() when orders are bumped off due to cancellation/expiration |
before-order |
triggering check of .improvementRule() to check new orders against .buyImprove/.sellImprove |
order |
to detect trades between orders, and when trades are found, calling market-engine inherited .trade() method |
trade |
triggering one-sends-other orders via .tradeTrigger() to be pushed to .inbox |
trade-cleanup |
triggering stop orders to .inbox, rescanning order books and applying post-trade book size limits |
stops |
to push buy/sell orders resulting from stops to .inbox |
Public Members
public inbox: Array<number[]> source
inbox for pre-orders from internal processes such as stops and triggers. new orders should also be pushed here.
public lastTrade: * source
Public Methods
public clear() source
clears or resets market to initial "new" condition, clearing active list, books, and trash