-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Read quotes from Yahoo Finance API.
--   
--   Haskell wrapper for the stock APIs provided by Yahoo Finance.
--   
--   <b>UPDATE</b>: It appears that yahoo disabled the quote API used by
--   this pakcage. This package is no longer usable. See <a>this issue</a>.
@package yahoo-finance-api
@version 0.2.0.3


-- | This is an internal module. Use at your own risk.
module Web.Yahoo.Finance.YQL.Internal.Types

-- | Quote data received from YQL.
data Quote
Quote :: Text -> Text -> Text -> Text -> Text -> Text -> Text -> Text -> Text -> Text -> Text -> Text -> Text -> Quote
[quoteAverageDailyVolume] :: Quote -> Text
[quoteChange] :: Quote -> Text
[quoteDaysLow] :: Quote -> Text
[quoteDaysHigh] :: Quote -> Text
[quoteYearLow] :: Quote -> Text
[quoteYearHigh] :: Quote -> Text
[quoteMarketCapitalization] :: Quote -> Text
[quoteLastTradePriceOnly] :: Quote -> Text
[quoteDaysRange] :: Quote -> Text
[quoteName] :: Quote -> Text
[quoteSymbol] :: Quote -> Text
[quoteVolume] :: Quote -> Text
[quoteStockExchange] :: Quote -> Text

-- | Use this type to encode <a>toUrlPiece</a> or <tt>toText</tt>
--   (depending on Servant version) for queries.
newtype StockSymbol
StockSymbol :: Text -> StockSymbol
[unStockSymbol] :: StockSymbol -> Text

-- | Query for yahoo finance api.
data YQLQuery
YQLQuery :: [StockSymbol] -> YQLQuery
[yqlQuery] :: YQLQuery -> [StockSymbol]

-- | Response from a YQL query.
data YQLResponse
YQLResponse :: Int -> UTCTime -> Text -> [Maybe Quote] -> YQLResponse
[responseCount] :: YQLResponse -> Int
[responseCreated] :: YQLResponse -> UTCTime
[responseLang] :: YQLResponse -> Text
[responseQuotes] :: YQLResponse -> [Maybe Quote]
instance GHC.Generics.Generic Web.Yahoo.Finance.YQL.Internal.Types.YQLResponse
instance GHC.Show.Show Web.Yahoo.Finance.YQL.Internal.Types.YQLResponse
instance GHC.Read.Read Web.Yahoo.Finance.YQL.Internal.Types.YQLResponse
instance GHC.Classes.Eq Web.Yahoo.Finance.YQL.Internal.Types.YQLResponse
instance GHC.Generics.Generic Web.Yahoo.Finance.YQL.Internal.Types.Quote
instance GHC.Show.Show Web.Yahoo.Finance.YQL.Internal.Types.Quote
instance GHC.Read.Read Web.Yahoo.Finance.YQL.Internal.Types.Quote
instance GHC.Classes.Eq Web.Yahoo.Finance.YQL.Internal.Types.Quote
instance GHC.Generics.Generic Web.Yahoo.Finance.YQL.Internal.Types.YQLQuery
instance GHC.Show.Show Web.Yahoo.Finance.YQL.Internal.Types.YQLQuery
instance GHC.Classes.Eq Web.Yahoo.Finance.YQL.Internal.Types.YQLQuery
instance GHC.Show.Show Web.Yahoo.Finance.YQL.Internal.Types.StockSymbol
instance GHC.Classes.Ord Web.Yahoo.Finance.YQL.Internal.Types.StockSymbol
instance GHC.Generics.Generic Web.Yahoo.Finance.YQL.Internal.Types.StockSymbol
instance GHC.Classes.Eq Web.Yahoo.Finance.YQL.Internal.Types.StockSymbol
instance Data.Aeson.Types.FromJSON.FromJSON Web.Yahoo.Finance.YQL.Internal.Types.YQLResponse
instance Data.Aeson.Types.FromJSON.FromJSON Web.Yahoo.Finance.YQL.Internal.Types.Quote
instance Web.Internal.HttpApiData.ToHttpApiData Web.Yahoo.Finance.YQL.Internal.Types.YQLQuery
instance Web.Internal.HttpApiData.ToHttpApiData Web.Yahoo.Finance.YQL.Internal.Types.StockSymbol
instance Web.Internal.HttpApiData.ToHttpApiData [Web.Yahoo.Finance.YQL.Internal.Types.StockSymbol]


-- | This is an internal module. Use at your own risk.
module Web.Yahoo.Finance.YQL.Internal.API

-- | Low-level Servant definition of the Yahoo Finance YQL client API.
type YahooFinanceYQLApi = "v1" :> ("public" :> ("yql" :> (QueryParam "q" YQLQuery :> (QueryParam "format" Text :> (QueryParam "env" Text :> (QueryParam "callback" Text :> Get '[JSON] YQLResponse))))))

-- | <a>QueryParam</a> are treated as maybes but Yahoo requires that all
--   the fields be filled except for "callback". Quotes are returned in the
--   order they are queried.
--   
--   format default is "json" env default is
--   "store:/<i>datatables.org</i>alltableswithkeys" The order of arguments
--   varies slightly with each version of Servant.
getQuotesInternal :: Maybe YQLQuery -> Maybe Text -> Maybe Text -> Maybe Text -> ClientM YQLResponse


-- | This module contains methods for accessing the Yahoo Finance YQL APIs.
module Web.Yahoo.Finance.YQL

-- | General client API to access Yahoo financial data. Quotes are returned
--   in the order they are queried.
getQuotes :: YQLQuery -> ClientM YQLResponse

-- | <a>BaseUrl</a> for the Yahoo Finance YQL API. This represents
--   <tt><a>https://finance.yahoo.com</a></tt>.
yahooFinanceJsonBaseUrl :: BaseUrl

-- | Query for yahoo finance api.
data YQLQuery
YQLQuery :: [StockSymbol] -> YQLQuery
[yqlQuery] :: YQLQuery -> [StockSymbol]

-- | Use this type to encode <a>toUrlPiece</a> or <tt>toText</tt>
--   (depending on Servant version) for queries.
newtype StockSymbol
StockSymbol :: Text -> StockSymbol
[unStockSymbol] :: StockSymbol -> Text

-- | Response from a YQL query.
data YQLResponse
YQLResponse :: Int -> UTCTime -> Text -> [Maybe Quote] -> YQLResponse
[responseCount] :: YQLResponse -> Int
[responseCreated] :: YQLResponse -> UTCTime
[responseLang] :: YQLResponse -> Text
[responseQuotes] :: YQLResponse -> [Maybe Quote]

-- | Quote data received from YQL.
data Quote
Quote :: Text -> Text -> Text -> Text -> Text -> Text -> Text -> Text -> Text -> Text -> Text -> Text -> Text -> Quote
[quoteAverageDailyVolume] :: Quote -> Text
[quoteChange] :: Quote -> Text
[quoteDaysLow] :: Quote -> Text
[quoteDaysHigh] :: Quote -> Text
[quoteYearLow] :: Quote -> Text
[quoteYearHigh] :: Quote -> Text
[quoteMarketCapitalization] :: Quote -> Text
[quoteLastTradePriceOnly] :: Quote -> Text
[quoteDaysRange] :: Quote -> Text
[quoteName] :: Quote -> Text
[quoteSymbol] :: Quote -> Text
[quoteVolume] :: Quote -> Text
[quoteStockExchange] :: Quote -> Text
