pregao v0.1.0 Pregao.Bdi.IndexSummary

A struct that contains the activity summary of a stock index

It contains the following fields:

  • :id - the unique identifier of the index
  • :name - the name of the index
  • :prices - index price information for the trading day:

    • :open - the opening price
    • :high - the highest price
    • :low - the lowest price
    • :close - the closing price
    • :average - the average price
    • :settlement - the price used as reference for settlement of derivatives
    • :vwap - the volume-weighted average price
  • :ticker_stats - statistics about the tickers that compose the index:

    • :up - number of tickers on the index that closed with a higher price
    • :down - number of tickers on the index that closed with a lower price
    • :flat - number of tickers on the index that closed with the same price
    • :flat - total number of tickers on the index
  • :pct_changes - index price percent change information:

    • :open - percent change from the opening price
    • :last - percent change from the previous trading day
    • :week - percent change in a week
    • :month - percent change in a month
    • :year - percent change in a year
    • :wtd - percent change since the start of the week
    • :mtd - percent change since the start of the month
    • :ytd - percent change since the start of the year
  • :volume - volume information:

    • :shares - number of shares traded
    • :trades - number of trades
    • :price - amount of money traded (in currency units)

Summary

Functions

Parses a Pregao.Bdi.IndexSummary struct from a raw string

Types

t()
t :: %Pregao.Bdi.IndexSummary{id: Integer, name: String, pct_changes: Map, prices: Map, ticker_stats: Map, volume: Map, ytd_range: Map}

Functions

parse(arg)
parse(String.t) :: Pregao.Bdi.Header

Parses a Pregao.Bdi.IndexSummary struct from a raw string.

Examples:

# Skips to the first line on the BDI file containing an index # (starts with “01”) and parses the index summary, # then print out the index prices iex> File.stream!(“./test/fixtures/bdi0930”) …> |> Stream.drop_while(fn (l) -> !String.starts_with?(l, “01”) end) …> |> Enum.at(0) …> |> Pregao.Bdi.IndexSummary.parse() …> |> Map.get(:prices) %{average: 58683, close: 58367, high: 58900, low: 58271, open: 58349, settlement: 58770, vwap: 58599}