Skip to content

Instantly share code, notes, and snippets.

@dmitry-a-morozov
Created December 7, 2014 04:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmitry-a-morozov/11a5afee5edc8e7952dc to your computer and use it in GitHub Desktop.
Save dmitry-a-morozov/11a5afee5edc8e7952dc to your computer and use it in GitHub Desktop.
module Symbology
open System
let yahoo symbol =
use wc = new Net.WebClient()
let yahoo = "http://download.finance.yahoo.com/d"
let uri = sprintf "%s/quotes.csv?s&f=nl1" yahoo symbol
wc.DownloadString(uri)
.Split([| "\n\r" |], StringSplitOptions.RemoveEmptyEntries)
|> Array.map (fun line ->
let xs = line.Split(',')
let name, price = xs.[0], xs.[1]
if price = "0.00" then None else Some name
)
|> Seq.exactlyOne
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment