hledger-stockquotes 0.1.2.0 → 0.1.2.1
raw patch · 4 files changed
+19/−13 lines, 4 filesdep ~hledger-libdep ~textPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: hledger-lib, text
API changes (from Hackage documentation)
Files
- CHANGELOG.md +5/−0
- README.md +1/−1
- hledger-stockquotes.cabal +4/−6
- src/Hledger/StockQuotes.hs +9/−6
CHANGELOG.md view
@@ -3,6 +3,11 @@ ## master +## v0.1.2.1++* Fix breaking changes in `hledger-lib` v1.26.++ ## v0.1.2.0 * Add support for fetching cryptocurrency prices with the `-c` flag and
README.md view
@@ -1,6 +1,6 @@ # hledger-stockquotes -[](https://travis-ci.org/prikhi/hledger-stockquotes)+[](https://github.com/prikhi/hledger-stockquotes/actions/workflows/main.yml) `hledger-stockquotes` is a CLI addon for [hledger](https://hledger.org) that reads a journal file and pulls the historical prices for commodities from
hledger-stockquotes.cabal view
@@ -3,11 +3,9 @@ -- This file has been generated from package.yaml by hpack version 0.34.4. -- -- see: https://github.com/sol/hpack------ hash: aa47c22c727d8989eac0b986130271d3066dd141a5237566d7c9a0e13db0a0b6 name: hledger-stockquotes-version: 0.1.2.0+version: 0.1.2.1 synopsis: Generate HLedger Price Directives From Daily Stock Quotes. description: @hledger-stockquotes@ is an addon for <https://hledger.org/ hledger> that reads your journal file, pulls the historical stock prices for commodities,@@ -49,11 +47,11 @@ src ghc-options: -Wall -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints -O2 build-depends:- aeson ==1.*+ aeson >=1 && <3 , base >=4.7 && <5 , bytestring <1 , containers <1- , hledger-lib <2+ , hledger-lib >=1.26 && <2 , req ==3.* , safe >=0.3.5 && <1 , scientific <1@@ -71,7 +69,7 @@ app ghc-options: -Wall -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints -O2 -threaded -rtsopts -with-rtsopts "-N -T" build-depends:- aeson ==1.*+ aeson >=1 && <3 , base >=4.7 && <5 , bytestring <1 , cmdargs >=0.6 && <1
src/Hledger/StockQuotes.hs view
@@ -13,8 +13,7 @@ , makePriceDirectives , GenericPrice(..) , getClosePrice- )-where+ ) where import Control.Concurrent ( threadDelay ) import Control.Exception ( SomeException@@ -63,7 +62,9 @@ getCommoditiesAndDateRange :: [T.Text] -> FilePath -> IO ([CommoditySymbol], Day, Day) getCommoditiesAndDateRange excluded journalPath = do- journal <- either error id <$> readJournalFile definputopts journalPath+ journal <- fmap (either error id) . runExceptT $ readJournalFile+ definputopts+ journalPath currentTime <- getCurrentTime let commodities = filter (`notElem` excluded)@@ -107,7 +108,8 @@ then fmap catMaybes $ rateLimitActions $ map fetch genericAction else catMaybes <$> mapM fetch genericAction where- fetch :: AlphaRequest -> IO (Maybe (CommoditySymbol, [(Day, GenericPrice)]))+ fetch+ :: AlphaRequest -> IO (Maybe (CommoditySymbol, [(Day, GenericPrice)])) fetch req = do (symbol, label, resp) <- case req of FetchStock symbol ->@@ -166,7 +168,7 @@ Stock Prices { pClose } -> pClose Crypto CryptoPrices { cpClose } -> cpClose --- | Perform the actions at a rate of 5 per second, then return all the+-- | Perform the actions at a rate of 5 per minute, then return all the -- results. -- -- Note: Will log waiting times to stdout.@@ -192,7 +194,8 @@ :: [(CommoditySymbol, [(Day, GenericPrice)])] -> LBS.ByteString makePriceDirectives = (<> "\n") . LBS.intercalate "\n\n" . map makeDirectives where- makeDirectives :: (CommoditySymbol, [(Day, GenericPrice)]) -> LBS.ByteString+ makeDirectives+ :: (CommoditySymbol, [(Day, GenericPrice)]) -> LBS.ByteString makeDirectives (symbol, prices) = LBS.intercalate "\n" $ ("; " <> LBS.fromStrict (encodeUtf8 symbol))