Exchange v0.2.5 Exchange View Source

The best Elixir Exchange supporting limit and market orders. Restful API and fancy dashboard supported soon!

Link to this section Summary

Functions

Cancels an order on the Exchange

Returns the trade with trade_id

Returns all the completed trades

Returns a list of completed trades where the trader is one of the participants

Returns the sum of all active sell order's size

Returns the highest price of all buy orders

Returns the sum of all active buy order's size

Returns the lastest price from a side of an Exchange

Returns the lastest size from a side of an Exchange

Returns the lowest price of all sell orders

Returns a list of all active orders

Returns an order by id.

Returns a list of active orders placed by the trader

Places an order on the Exchange

Returns the difference between the lowest sell order and the highest buy order

Returns the number of active buy orders

Returns the number of active sell orders

Link to this section Functions

Link to this function

cancel_order(order_id, ticker)

View Source

Specs

cancel_order(order_id :: String.t(), ticker :: atom()) :: atom()

Cancels an order on the Exchange

Parameters

  • order_id: String that represents the id of the order to cancel
  • ticker: Atom that represents on which market the order should be canceled
Link to this function

completed_trade_by_trade_id(ticker, trade_id)

View Source

Specs

completed_trade_by_trade_id(ticker :: atom(), trade_id :: String.t()) ::
  Exchange.Trade.t()

Returns the trade with trade_id

Parameters

  • ticker: Atom that represents on which market the query should made
  • trade_id: Id of the requested trade
Link to this function

completed_trades(ticker)

View Source

Specs

completed_trades(ticker :: atom()) :: list()

Returns all the completed trades

Parameters

  • ticker: Atom that represents on which market the query should made
Link to this function

completed_trades_by_id(ticker, trader_id)

View Source

Specs

completed_trades_by_id(ticker :: atom(), trader_id :: String.t() | atom()) :: [
  Exchange.Trade
]

Returns a list of completed trades where the trader is one of the participants

Parameters

  • ticker: Atom that represents on which market the query should be made
  • trader_id: String that represents the id of the trader
Link to this function

highest_ask_volume(ticker)

View Source

Specs

highest_ask_volume(ticker :: atom()) :: {atom(), number()}

Returns the sum of all active sell order's size

Parameters

  • ticker: Atom that represents on which market the query should be placed
Link to this function

highest_bid_price(ticker)

View Source

Specs

highest_bid_price(ticker :: atom()) :: {atom(), Money}

Returns the highest price of all buy orders

Parameters

  • ticker: Atom that represents on which market the query should be placed
Link to this function

highest_bid_volume(ticker)

View Source

Specs

highest_bid_volume(ticker :: atom()) :: {atom(), number()}

Returns the sum of all active buy order's size

Parameters

  • ticker: Atom that represents on which market the query should be placed
Link to this function

last_price(ticker, side)

View Source

Specs

last_price(ticker :: atom(), side :: atom()) :: {atom(), number()}

Returns the lastest price from a side of an Exchange

Parameters

  • ticker: Exchange identifier
  • side: Atom to decide which side of the book is used

Specs

last_size(ticker :: atom(), ticker :: atom()) :: {atom(), number()}

Returns the lastest size from a side of an Exchange

Parameters

  • ticker: Exchange identifier
  • side: Atom to decide which side of the book is used
Link to this function

lowest_ask_price(ticker)

View Source

Specs

lowest_ask_price(ticker :: atom()) :: {atom(), Money}

Returns the lowest price of all sell orders

Parameters

  • ticker: Atom that represents on which market the query should be placed

Specs

open_orders(ticker :: atom()) :: {atom(), list()}

Returns a list of all active orders

Parameters

  • ticker: Atom that represents on which market the query should be placed
Link to this function

open_orders_by_id(ticker, order_id)

View Source

Specs

open_orders_by_id(ticker :: atom(), order_id :: String.t()) ::
  {atom(), Exchange.Order.order()}

Returns an order by id.

Parameters

  • ticker: Atom that represents on which market the query should be placed
  • order_id: String that represents the id of the order to cancel
Link to this function

open_orders_by_trader(ticker, trader_id)

View Source

Specs

open_orders_by_trader(ticker :: atom(), trader_id :: String.t()) ::
  {atom(), list()}

Returns a list of active orders placed by the trader

Parameters

  • ticker: Atom that represents on which market the query should be made
  • trader_id: String that represents the id of the traderd
Link to this function

place_order(order_params, ticker)

View Source

Specs

place_order(order_params :: map(), ticker :: atom()) ::
  atom() | {atom(), String.t()}

Places an order on the Exchange

Parameters

  • order_params: Map that represents the parameters of the order to be placed
  • ticker: Atom that represents on which market the order should be placed

Specs

spread(ticker :: atom()) :: {atom(), Money}

Returns the difference between the lowest sell order and the highest buy order

Parameters

  • ticker: Atom that represents on which market the order should be canceled
Link to this function

total_buy_orders(ticker)

View Source

Specs

total_buy_orders(ticker :: atom()) :: {atom(), number()}

Returns the number of active buy orders

Parameters

  • ticker: Atom that represents on which market the query should made
Link to this function

total_sell_orders(ticker)

View Source

Specs

total_sell_orders(ticker :: atom()) :: {atom(), number()}

Returns the number of active sell orders

Parameters

  • ticker: Atom that represents on which market the query should made