hledger-stockquotes-0.1.2.0: Generate HLedger Price Directives From Daily Stock Quotes.
Safe HaskellNone
LanguageHaskell2010

Hledger.StockQuotes

Description

Helper functions for the hledger-stockquotes application.

Synopsis

Documentation

getCommoditiesAndDateRange :: [Text] -> FilePath -> IO ([CommoditySymbol], Day, Day) Source #

Given a list of Commodities to exclude and a Journal File, return the Commodities in the Journal and the minimum/maximum days from the Journal.

fetchPrices Source #

Arguments

:: Config

AlphaVantage Configuration

-> [CommoditySymbol]

Commodities to Fetch

-> [Text]

Commodities to Classify as Cryptocurrencies

-> Day

Start of Price Range

-> Day

End of Price Range

-> Bool

Rate Limit Requests

-> IO [(CommoditySymbol, [(Day, GenericPrice)])] 

Fetch the Prices for the Commodities from the AlphaVantage API, limiting the returned prices between the given Days.

Note: Fetching errors are currently logged to stderr.

makePriceDirectives :: [(CommoditySymbol, [(Day, GenericPrice)])] -> ByteString Source #

Build the Price Directives for the Daily Prices of the given Commodities.

data GenericPrice Source #

Union type for all the various prices we can return.

getClosePrice :: GenericPrice -> Scientific Source #

Get the day's closing price.