Exchange v0.2.0 Exchange.Utils View Source
Auxiliary functions for Exchange APP
Link to this section Summary
Functions
Return a empty Exchange.OrderBook
Fetches the completed trades stored by a Exchange.TimeSeries
adapter given a ticker and a id
Fetches the active orders stored by a Exchange.TimeSeries
adapter given a ticker
Function that generates n random orders given a specific ticker
Creates a random order for a given ticker
Creates a expiring limit order for a given ticker
This function places sample buy orders and sell orders in the correct market using the ticker.
Creates a limit order for a given ticker
Creates an Exchange.OrderBook
with sample buy and sell orders
Retrieves the module of an adapter of Exchange.TimeSeries
Link to this section Functions
Specs
empty_order_book() :: Exchange.OrderBook.order_book()
Return a empty Exchange.OrderBook
Specs
Fetches the completed trades stored by a Exchange.TimeSeries
adapter given a ticker and a id
Parameters
- ticker: Market where the fetch should be made
- trader_id: The that a given trade must match
Specs
Fetches the active orders stored by a Exchange.TimeSeries
adapter given a ticker
Parameters
- ticker: Market where the fetch should be made
Specs
generate_random_orders(n :: number(), ticker :: atom()) :: [ Exchange.Order.order() ]
Function that generates n random orders given a specific ticker
Arguments
- ticker: Market where the order should be placed
- n: Number of orders to be generated
Specs
print_order_book(order_book :: Exchange.OrderBook.order_book()) :: :ok
Prints an Exchange.OrderBook
Specs
random_order(ticker :: atom()) :: Exchange.Order.order()
Creates a random order for a given ticker
Arguments
- ticker: Market where the order should be placed
Specs
sample_expiring_order(%{ price: number(), side: atom(), size: number(), exp_time: number(), id: String.t() }) :: Exchange.Order.order()
Creates a expiring limit order for a given ticker
Specs
sample_matching_engine_init(ticker :: atom()) :: :ok
This function places sample buy orders and sell orders in the correct market using the ticker.
Arguments
- ticker: Market where the orders should be placed
Specs
sample_order(map()) :: Exchange.Order.order()
Creates a limit order for a given ticker
Specs
sample_order_book(ticker :: atom()) :: Exchange.OrderBook.order_book()
Creates an Exchange.OrderBook
with sample buy and sell orders
Arguments
- ticker: Market where the order book belongs
Specs
time_series() :: any()
Retrieves the module of an adapter of Exchange.TimeSeries