pub struct Currency {
pub code: String,
pub id: String,
pub name: Option<String>,
pub active: bool,
pub deposit: bool,
pub withdraw: bool,
pub fee: Option<Decimal>,
pub precision: Option<Decimal>,
pub limits: MinMax,
pub networks: HashMap<String, CurrencyNetwork>,
pub currency_type: Option<String>,
pub info: HashMap<String, Value>,
}Expand description
Currency structure representing a tradable asset
This corresponds to Go’s currency metadata and contains information about a cryptocurrency or fiat currency on an exchange.
Fields§
§code: StringCurrency code (e.g., “BTC”, “USDT”)
id: StringExchange-specific currency ID
name: Option<String>Full currency name
active: boolIs currency active for trading
deposit: boolDeposit enabled
withdraw: boolWithdrawal enabled
fee: Option<Decimal>Trading fee for this currency
precision: Option<Decimal>Precision (decimal places)
limits: MinMaxWithdrawal/deposit limits
networks: HashMap<String, CurrencyNetwork>Available networks for this currency
currency_type: Option<String>Currency type (crypto/fiat)
info: HashMap<String, Value>Raw exchange info
Implementations§
Source§impl Currency
impl Currency
Sourcepub fn new_crypto(code: String, id: String, name: String) -> Currency
pub fn new_crypto(code: String, id: String, name: String) -> Currency
Create a new cryptocurrency
Sourcepub fn can_deposit(&self) -> bool
pub fn can_deposit(&self) -> bool
Check if deposit is enabled
Sourcepub fn can_withdraw(&self) -> bool
pub fn can_withdraw(&self) -> bool
Check if withdrawal is enabled
Sourcepub fn add_network(&mut self, network: CurrencyNetwork)
pub fn add_network(&mut self, network: CurrencyNetwork)
Add a network to this currency
Sourcepub fn get_network(&self, network: &str) -> Option<&CurrencyNetwork>
pub fn get_network(&self, network: &str) -> Option<&CurrencyNetwork>
Get a specific network
Sourcepub fn available_networks(&self) -> Vec<&CurrencyNetwork>
pub fn available_networks(&self) -> Vec<&CurrencyNetwork>
Get all available networks
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Currency
impl<'de> Deserialize<'de> for Currency
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Currency, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Currency, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for Currency
impl Serialize for Currency
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Eq for Currency
impl StructuralPartialEq for Currency
Auto Trait Implementations§
impl Freeze for Currency
impl RefUnwindSafe for Currency
impl Send for Currency
impl Sync for Currency
impl Unpin for Currency
impl UnwindSafe for Currency
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more