stooq-api-0.4.2.0: A simple wrapper around stooq.pl API for downloading market data.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Web.Data.Stooq.API

Description

Here's a simple wrapper around API offered by Stooq.pl. It's capable of returning the latest price for the given instrument. For more information about tickers available, visit the service. Keep in mind that in some situations their ticker convention is different to what's known e.g. from Yahoo Finance e.g.

xxxx.UK: London Stock Exchange (LSE)

xxxx.US: NYSE (OTC market not available, so a lot of ADRs like OGZPY or SBRCY can't be fetched)

xxxx.DE: Deutsche Börse

xxxx.JP: Tokyo Stock Exchange

xxxx: (no exchange code after full stop) Warsaw Stock Exchange (GPW)

Use:

>>> fetch "SPY.US"
Just [StooqPrice {symbol = StooqSymbol "SPY.US", time = ..., ...}]
Synopsis

Documentation

data StooqPrice Source #

A type representing market price data returned by Stooq.

Constructors

StooqPrice 

Instances

Instances details
Show StooqPrice Source # 
Instance details

Defined in Web.Data.Stooq.API

fetchPrice :: StooqSymbol -> IO (Either String [StooqPrice]) Source #

Sends a request for the specified ticker and returns its latest price. Returns Nothing if the response is invalid (this is most likely due to using a non-existent ticker).

fetchPrices :: [StooqSymbol] -> IO (Either String [StooqPrice]) Source #

Sends a request for multiple tickers at once. The function makes only a single HTTP call.

fetch :: String -> IO (Either String [StooqPrice]) Source #

A shorthand around "fetchPrice" that allows to call the function using a plain String, without converting it to a StooqSymbol first.