yahoo-finance-api-0.1.0.0: Read quotes from Yahoo Finance API

Copyright(c) Dennis Gosnell, 2016
LicenseBSD3
Safe HaskellNone
LanguageHaskell2010

Web.Yahoo.Finance.API.JSON

Contents

Description

This module contians methods for accessing the Yahoo Finance webservice APIs.

The getQuote method is mainly used to obtain stock quotes for specific stocks.

Synopsis

Documentation

getQuote :: (HasHttpManager r, MonadError ServantError m, MonadIO m, MonadReader r m) => [StockSymbol] -> m QuoteList Source #

Get stock quotes from Yahoo Finance webservice APIs.

Here is a short example of the usage:

  (manager :: Manager) <- getGlobalManager
  (eitherRes :: Either ServantError QuoteList) <-
      runExceptT $ runReaderT (getQuote ["VGTSX", "GOOG"]) manager
  let (res :: QuoteList) =
          either undefined id eitherRes -- Warning: this is unsafe...
  show $ unQuoteList res
[ Quote
    { quoteChange = "0.050000"
    , quoteChangePercent = "0.350141"
    , quoteDayHigh = "0.000000"
    , quoteDayLow = "0.000000"
    , quoteIssuerName = "Vanguard Total Intl Stock Index Inv"
    , quoteIssuerNameLang = "Vanguard Total Intl Stock Index Inv"
    , quoteName = "Vanguard Total International St"
    , quotePrice = "14.330000"
    , quoteSymbol = "VGTSX"
    , quoteTS = "1467413100"
    , quoteType = "mutualfund"
    , quoteUTCTime = 2016-07-01 22:45:00 UTC
    , quoteVolume = "0"
    , quoteYearHigh = "16.330000"
    , quoteYearLow = "12.760000"
    }
, Quote
    { quoteChange = "7.110046"
    , quoteChangePercent = "1.027315"
    , quoteDayHigh = "700.650024"
    , quoteDayLow = "692.130127"
    , quoteIssuerName = "Alphabet Inc."
    , quoteIssuerNameLang = "Alphabet Inc."
    , quoteName = "Alphabet Inc."
    , quotePrice = "699.210022"
    , quoteSymbol = "GOOG"
    , quoteTS = "1467403200"
    , quoteType = "equity"
    , quoteUTCTime = 2016-07-01 20:00:00 UTC
    , quoteVolume = "1344710"
    , quoteYearHigh = "789.870000"
    , quoteYearLow = "515.180000"
    }
]

getQuoteTrans :: [StockSymbol] -> ReaderT Manager (ExceptT ServantError IO) QuoteList Source #

Similar to getQuotes but using transformers intead of mtl.

Types

newtype QuoteList Source #

Newtype wrapper around a list of Quotes.

Constructors

QuoteList 

Fields