Raxol.Payments.Prices.Static (Raxol Payments v0.2.0)

Copy Markdown View Source

A price_fn backed by a fixed symbol -> USD map, for tests and for runs where the operator supplies prices out of band.

price_fn = Raxol.Payments.Prices.Static.price_fn(%{"ETH" => "1700", "POL" => "0.07"})
price_fn.("ETH")     #=> Decimal.new("1700")
price_fn.("UNKNOWN") #=> nil

Summary

Functions

Build a (symbol -> Decimal.t() | nil) from a symbol -> price map.

Functions

price_fn(prices)

@spec price_fn(%{required(String.t()) => Decimal.t() | number() | String.t()}) ::
  (String.t() ->
     Decimal.t() | nil)

Build a (symbol -> Decimal.t() | nil) from a symbol -> price map.