commodities-0.2.0.1: Library for working with commoditized amounts and price histories

Safe Haskell None Haskell98

Ledger.Commodity.History

Synopsis

# Documentation

Arguments

 :: Commodity Source commodity -> Commodity Target commodity -> UTCTime Look for conversions on or before this -> CommodityMap Set of commodities to search -> Maybe (UTCTime, Rational)

Lookup a price conversion from the source commodity to the target, using data from the given time or earlier. Result is Nothing if no conversion can be found, or else the best conversion ratio plus the time of the oldest link.

Add a price conversion in the form of a ratio between two commodities at a specific point in time.

Arguments

 :: (Ord c, Num c) => (Key -> IntMap c) The graph we are searching through, given as a function from vertices to their neighbours. -> (Key -> c) Heuristic distance to the (nearest) goal. This should never overestimate the distance, or else the path found may not be minimal. -> (Key -> Bool) The goal, specified as a boolean predicate on vertices. -> Key The vertex to start searching from. -> Maybe [Key] An optimal path, if any path exists. This excludes the starting vertex.

This function computes an optimal (minimal distance) path through a graph in a best-first fashion, starting from a given starting point.

Arguments

 :: (Monad m, Ord c, Num c) => (Key -> m (IntMap c)) The graph we are searching through, given as a function from vertices to their neighbours. -> (Key -> m c) Heuristic distance to the (nearest) goal. This should never overestimate the distance, or else the path found may not be minimal. -> (Key -> m Bool) The goal, specified as a boolean predicate on vertices. -> m Key The vertex to start searching from. -> m (Maybe [Key]) An optimal path, if any path exists. This excludes the starting vertex.

This function computes an optimal (minimal distance) path through a graph in a best-first fashion, starting from a given starting point.