Safe Haskell | None |
---|---|
Language | Haskell2010 |
Helper functions for the hledger-stockquotes
application.
Synopsis
- getCommoditiesAndDateRange :: [Text] -> FilePath -> IO ([CommoditySymbol], Day, Day)
- fetchPrices :: Config -> [CommoditySymbol] -> Day -> Day -> Bool -> IO [(CommoditySymbol, [(Day, Prices)])]
- rateLimitActions :: [IO a] -> IO [a]
- makePriceDirectives :: [(CommoditySymbol, [(Day, Prices)])] -> ByteString
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 :: Config -> [CommoditySymbol] -> Day -> Day -> Bool -> IO [(CommoditySymbol, [(Day, Prices)])] Source #
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 stdout.
rateLimitActions :: [IO a] -> IO [a] Source #
Perform the actions at a rate of 5 per second, then return all the results.
Note: Will log waiting times to stdout.
makePriceDirectives :: [(CommoditySymbol, [(Day, Prices)])] -> ByteString Source #
Build the Price Directives for the Daily Prices of the given Commodities.