Description Usage Arguments Details Value
View source: R/order_functions.R
Create an order book based on a continuous, stochastic, double auction.
1 2 3 4 5 6 7 8 9 10 11 12 13 | create_order_book(
start_price,
price_limit,
price_band,
tick_size,
market_sell,
market_buy,
bid_order_ratio,
ask_order_ratio,
cancel_bid,
cancel_ask,
n_events
)
|
start_price |
The starting price of the simulation. |
price_limit |
The maximum value the simulated price can attain. |
price_band |
The size of the interval around the current price within which new orders/prices will be generated. |
tick_size |
The minimum allowable price change. |
market_sell |
The arrival rate of market sell orders. |
market_buy |
The arrival rate of market buy orders. |
bid_order_ratio |
The ratio of limit bid orders to market bid orders. |
ask_order_ratio |
The ratio of limit ask orders to market ask orders. |
cancel_bid |
The cancel rate of limit bid orders. |
cancel_ask |
The cancel rate of limit ask orders. |
n_events |
The total number of trades to simulate. |
Given a starting price, orders (limit and market) are generated at random times using a Poisson distribution. Prices are generated within an interval around the current trading price.
Market orders are filled immediately. If insufficient market depth is available, a market maker will intervene. The market maker charges 5% above/below the current price if it has to intervene.
Limit orders are submitted, and some are cancelled randomly. The ratio of limit
orders to market orders in controlled by bid_order_ratio
and ask_order_ratio
.
A minimum tick size can be specified. Order sizes are randomly generated - the sizes are multiples of a number specified in the config file.
The models assumes that the best bid is lower than the best ask: p_b < p_a. If no orders are present in the book, the next bid, b, will be uniformly chosen in (p - price_bandtick_size) <= b <= p, and the next ask will be placed in p <= a <= (p + price_bandtick_size),
A list containing the full order book, the remaining bid and ask books and the generated price series.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.