yahoo_finanza v0.1.0 YahooFinanza.Quote

The YahooFinanza Quote Module implements the GenServer Behavior and is a Supervised Worker. This module provides methods to get the quote for a single symbol or multiple symbols.

Methods

fetch_quote/1
fetch_quotes/1

Summary

Functions

The fetch_quote/1 method accepts a string containing a symbol and returns a quote as a Map or an error if a invalid symbol was given

The fetch_quotes/1 method accepts a list of strings containing a symbol and returns the quotes as a list of Maps. If an invalid symbol is in the list, it will be ignored

Functions

fetch_quote(symbol)

The fetch_quote/1 method accepts a string containing a symbol and returns a quote as a Map or an error if a invalid symbol was given.

Examples

iex> YahooFinanza.Quote.fetch_quote "AAPL"

{:ok, %{"Symbol" => "AAPL", "Ask" => "119.5", ...}}

iex> YahooFinanza.Quote.fetch_quote "i don't exist"

{:error, "invalid symbol"}
fetch_quotes(symbols)

The fetch_quotes/1 method accepts a list of strings containing a symbol and returns the quotes as a list of Maps. If an invalid symbol is in the list, it will be ignored.

Example

iex> YahooFinanza.Quote.fetch_quote ["AAPL", "FB", "I don't exist"]

{:ok, [%{"Symbol" => "AAPL", "Ask" => "119.5", ...}, %{"Symbol" => "FB", "Ask" => "130.5", ...} }
start_link()