Safe Haskell | None |
---|---|
Language | Haskell2010 |
Helper functions for the hledger-stockquotes
application.
Synopsis
- getCommoditiesAndDateRange :: [Text] -> FilePath -> IO ([CommoditySymbol], Day, Day)
- fetchPrices :: Config -> [CommoditySymbol] -> [Text] -> Day -> Day -> Bool -> IO [(CommoditySymbol, [(Day, GenericPrice)])]
- makePriceDirectives :: [(CommoditySymbol, [(Day, GenericPrice)])] -> ByteString
- data GenericPrice
- getClosePrice :: GenericPrice -> Scientific
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.
:: 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.