ExMarket v0.2.0 Exmarket View Source
Documentation for Exmarket.
Link to this section Summary
Functions
Takes a variable list of stock symbols and returns a map with the symbols and prices.
Takes the stock symbol (ticker) as input and returns the real-time value of the stock.
Returns the USD value of a crypto currency asset
Returns the current state of the GenServer. Previous calls to get_price(stock)
are cached and returned as a map.
Resets the current state held in the GenServer back to an empty map ## Examples
Link to this section Functions
batch_quote(list) View Source
Takes a variable list of stock symbols and returns a map with the symbols and prices.
Examples
iex> Exmarket.batch_quote(["aapl", "tsla"]) %{"aapl" => 207.48, "tsla" => 263.9}
get_price(symbol) View Source
Takes the stock symbol (ticker) as input and returns the real-time value of the stock.
Examples
iex> Exmarket.get_price("aapl")
"204.53"
get_quote(pair) View Source
Returns the USD value of a crypto currency asset
Examples
iex> Exmarket.get_quote("btc") "5460.97"
get_state() View Source
Returns the current state of the GenServer. Previous calls to get_price(stock)
are cached and returned as a map.
Examples
iex> Exmarket.get_state()
%{"aapl" => 207.48, "fb" => 183.78, "mfst" => 0.065, "tsla" => 263.9}
reset_state() View Source
Resets the current state held in the GenServer back to an empty map ## Examples
iex> Exmarket.reset_state()
:ok