Skip to content

Instantly share code, notes, and snippets.

@eldritchideen
Last active August 29, 2015 14:23
Show Gist options
  • Save eldritchideen/87d33626bd85ebefbf24 to your computer and use it in GitHub Desktop.
Save eldritchideen/87d33626bd85ebefbf24 to your computer and use it in GitHub Desktop.
Get current list of shares making new highs
defmodule Stocks do
def get_new_highs do
HTTPoison.start
resp = HTTPoison.get!("http://www.smh.com.au/business/markets/52-week-highs?page=-1",[], [proxy: "http://proxy.cat.com:80"])
data = Floki.find(resp.body, "#content section table tbody tr th a")
Enum.map(data, fn({_,_,[code]}) -> code end)
end
end
defmodule Stocks.Mixfile do
use Mix.Project
def project do
[app: :stocks,
version: "0.0.1",
elixir: "~> 1.0",
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
deps: deps]
end
# Configuration for the OTP application
#
# Type `mix help compile.app` for more information
def application do
[applications: [:logger]]
end
# Dependencies can be Hex packages:
#
# {:mydep, "~> 0.3.0"}
#
# Or git/path repositories:
#
# {:mydep, git: "https://github.com/elixir-lang/mydep.git", tag: "0.1.0"}
#
# Type `mix help deps` for more examples and options
defp deps do
[
{:floki, "~> 0.3"},
{:httpoison, "~> 0.7"}
]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment