bitpanda_api/model/
asset.rs

1//! # Asset
2
3/// Describes the asset class
4#[derive(Debug, PartialEq, Eq, Clone, Copy, Hash, Deserialize)]
5pub enum AssetClass {
6    Commodity,
7    Cryptocurrency,
8    Cryptoindex,
9    Etf,
10    Metal,
11    Stock,
12}
13
14impl ToString for AssetClass {
15    fn to_string(&self) -> String {
16        match self {
17            Self::Commodity => "etc",
18            Self::Cryptocurrency => "cryptocoin",
19            Self::Cryptoindex => "cryptocoin",
20            Self::Etf => "etf",
21            Self::Metal => "metal",
22            Self::Stock => "stock",
23        }
24        .to_string()
25    }
26}
27
28/// A bitpanda asset
29#[derive(Debug, Clone, Hash, Deserialize, PartialEq, Eq)]
30pub struct Asset {
31    pub id: String,
32    /// Identifier used to get the OHLC
33    pub pid: String,
34    pub name: String,
35    pub symbol: String,
36    pub r#type: AssetClass,
37}