Skip to main content

normalize_coin

Function normalize_coin 

Source
pub fn normalize_coin(coin: &str) -> Cow<'_, str>
Expand description

Normalize a coin symbol by stripping common suffixes and uppercasing.

Removes -PERP, -USDC, and -USD suffixes and converts to uppercase so that e.g. "BTC-PERP" becomes "BTC" and "btc" becomes "BTC".

Returns Cow::Borrowed when the input is already uppercase and has no suffix to strip, avoiding a heap allocation in the common case.