pub fn py_get_exchange_rate(
from_currency: &str,
to_currency: &str,
price_type: PriceType,
quotes_bid: HashMap<String, f64>,
quotes_ask: HashMap<String, f64>,
) -> PyResult<Option<f64>>
Expand description
Calculates the exchange rate between two currencies using provided bid and ask quotes.
§Errors
Returns an error if:
price_type
is equal toLast
orMark
(cannot calculate from quotes).quotes_bid
orquotes_ask
is empty.quotes_bid
andquotes_ask
lengths are not equal.- The bid or ask side of a pair is missing.