# `Yfinance.Ticker`
[🔗](https://github.com/akoutmos/yfinance/blob/master/lib/yfinance/ticker.ex#L1)

This module allows you to fetch ticker data from Yahoo! Finance®. At the moment you
can fetch data on the financials of a stock ticker as well as the historical ticker
price. More functions are coming soon!

# `result`

```elixir
@type result() :: {:ok, Explorer.DataFrame.t()} | {:error, term()}
```

# `balance_sheet`

```elixir
@spec balance_sheet(symbol :: String.t(), frequency :: :yearly | :quarterly) ::
  result()
```

Get the balance sheet history for a provided stock symbol. The result is
an `Explorer.DataFrame` struct.

## Examples

    iex> {:ok, data_frame} =
    ...>   Yfinance.Ticker.balance_sheet("aapl", :quarterly)
    iex> %Explorer.DataFrame{} = data_frame

# `balance_sheet!`

```elixir
@spec balance_sheet!(symbol :: String.t(), frequency :: :yearly | :quarterly) ::
  Explorer.DataFrame.t()
```

Same as `balance_sheet/2` except raise on error.

# `cash_flow`

```elixir
@spec cash_flow(symbol :: String.t(), frequency :: :yearly | :quarterly) :: result()
```

Get the cash flow history for a provided stock symbol. The result is
an `Explorer.DataFrame` struct.

## Examples

    iex> {:ok, data_frame} =
    ...>   Yfinance.Ticker.cash_flow("aapl", :quarterly)
    iex> %Explorer.DataFrame{} = data_frame

# `cash_flow!`

```elixir
@spec cash_flow!(symbol :: String.t(), frequency :: :yearly | :quarterly) ::
  Explorer.DataFrame.t()
```

Same as `cash_flow/2` except raise on error.

# `history`

```elixir
@spec history(
  symbol :: String.t(),
  state_date :: Date.t(),
  end_date :: Date.t(),
  opts :: keyword()
) :: result()
```

Get the OHLCV history for a provided stock symbol given a start and end date. The result is
an `Explorer.DataFrame` struct.

## Options

  * `:actions` (`t:boolean/0`) - Whether to include dividends and stock splits.

* `:auto_adjust` (`t:boolean/0`) - Whether to adjust OHLC for splits.

* `:prepost` (`t:boolean/0`) - Whether to include pre/post market data.

## Examples

    iex> {:ok, data_frame} =
    ...>   Yfinance.Ticker.history("aapl", Date.shift(Date.utc_today(), month: -1), Date.utc_today())
    iex> %Explorer.DataFrame{} = data_frame

    iex> {:error, %Yfinance.Error{type: :option_error}} =
    ...>   Yfinance.Ticker.history(
    ...>     "aapl",
    ...>     Date.shift(Date.utc_today(), month: -1),
    ...>     Date.utc_today(),
    ...>     actions: "BAD_INPUT"
    ...>   )

# `history!`

```elixir
@spec history!(
  symbol :: String.t(),
  state_date :: Date.t(),
  end_date :: Date.t(),
  opts :: keyword()
) :: Explorer.DataFrame.t()
```

Same as `history/2` except raise on error.

# `history_max`

```elixir
@spec history_max(
  symbol :: String.t(),
  opts :: keyword()
) :: result()
```

Get the entire OHLCV history for a provided stock symbol. The result is
an `Explorer.DataFrame` struct.

## Options

  * `:actions` (`t:boolean/0`) - Whether to include dividends and stock splits.

* `:auto_adjust` (`t:boolean/0`) - Whether to adjust OHLC for splits.

* `:prepost` (`t:boolean/0`) - Whether to include pre/post market data.

## Examples

    iex> {:ok, data_frame} =
    ...>   Yfinance.Ticker.history_max("aapl")
    iex> %Explorer.DataFrame{} = data_frame

    iex> {:error, %Yfinance.Error{type: :option_error}} =
    ...>   Yfinance.Ticker.history_max(
    ...>     "aapl",
    ...>     actions: "BAD_INPUT"
    ...>   )

# `history_max!`

```elixir
@spec history_max!(
  symbol :: String.t(),
  opts :: keyword()
) :: Explorer.DataFrame.t()
```

Same as `history_max/2` except raise on error.

# `income_statement`

```elixir
@spec income_statement(symbol :: String.t(), frequency :: :yearly | :quarterly) ::
  result()
```

Get the income statement history for a provided stock symbol. The result is
an `Explorer.DataFrame` struct.

## Examples

    iex> {:ok, data_frame} =
    ...>   Yfinance.Ticker.income_statement("aapl", :quarterly)
    iex> %Explorer.DataFrame{} = data_frame

# `income_statement!`

```elixir
@spec income_statement!(symbol :: String.t(), frequency :: :yearly | :quarterly) ::
  Explorer.DataFrame.t()
```

Same as `income_statement/2` except raise on error.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
