Exchange v0.2.0 Exchange.MatchingEngine View Source
This is the core of the Exchange The matching engine is responsible for matching the orders on the order book
Link to this section Summary
Functions
Returns the current minimum asking price
Returns the current highest asking volume
Returns the current maximum biding price
Returns the current maximum biding price
Cancels an order and removes it from the Order Book
Returns a specification to start this module under a supervisor.
Callback implementation for GenServer.init/1
.
Returns the open order from a order_id
Returns the list of open orders
Returns the list of open orders from a trader
Returns the current Order Book
Places a limit order on the matching engine identified by the ticker. If there is a match the order is fullfilled otherwise it enters the orderbook queue at the chosen price point
Places an order on the matching engine identified by the ticker.
Places a marketable limit order on the matching engine identified by the ticker. The price of this order's price point is set with the min price (ask_min) if it is a buy order or with the max price(bid_max) if it is a sell order. If there is a match the order is fullfilled otherwise it enters the orderbook queue at the chosen price point
Returns the current Spread
Returns the number of open sell orders
Returns the number of open buy orders
Link to this section Types
Specs
ticker() :: atom()
Link to this section Functions
Specs
Returns the current minimum asking price
Specs
Returns the current highest asking volume
Specs
Returns the current maximum biding price
Specs
Returns the current maximum biding price
Specs
Cancels an order and removes it from the Order Book
Returns a specification to start this module under a supervisor.
See Supervisor
.
Callback implementation for GenServer.init/1
.
Specs
Returns the open order from a order_id
Specs
Returns the list of open orders
Specs
Returns the list of open orders from a trader
Specs
order_book_entries(ticker()) :: {atom(), Exchange.OrderBook.order_book()}
Returns the current Order Book
Specs
place_limit_order(ticker(), Exchange.Order.order()) :: atom()
Places a limit order on the matching engine identified by the ticker. If there is a match the order is fullfilled otherwise it enters the orderbook queue at the chosen price point
Specs
place_market_order(ticker(), Exchange.Order.order()) :: atom()
Places an order on the matching engine identified by the ticker.
The market order is set with the highest max_price for buying or the min_price for selling If there is sufficient liquidity on the order book the order is fullfilled otherwise the remaining unfulfilled order is put on the orderbook with the max/min price set
Specs
place_marketable_limit_order(ticker(), Exchange.Order.order()) :: atom()
Places a marketable limit order on the matching engine identified by the ticker. The price of this order's price point is set with the min price (ask_min) if it is a buy order or with the max price(bid_max) if it is a sell order. If there is a match the order is fullfilled otherwise it enters the orderbook queue at the chosen price point
Specs
Returns the current Spread
Specs
Returns the number of open sell orders
Specs
Returns the number of open buy orders