Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lazer/sdk/rust/protocol/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pyth-lazer-protocol"
version = "0.20.1"
version = "0.20.2"
edition = "2021"
description = "Pyth Lazer SDK - protocol types."
license = "Apache-2.0"
Expand Down
33 changes: 33 additions & 0 deletions lazer/sdk/rust/protocol/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ pub use crate::{
symbol_state::SymbolState,
};

#[derive(
Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize, From, Into,
)]
pub struct AssetId(pub u32);

#[derive(
Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize, From, Into,
)]
Expand Down Expand Up @@ -84,6 +89,34 @@ pub enum PriceFeedProperty {
// More fields may be added later.
}

#[derive(Debug, Clone, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub enum AssetClass {
Crypto,
Fx,
Equity,
Metal,
Rates,
Nav,
Commodity,
FundingRate,
}

impl AssetClass {
pub fn as_str(&self) -> &'static str {
match self {
AssetClass::Crypto => "crypto",
AssetClass::Fx => "fx",
AssetClass::Equity => "equity",
AssetClass::Metal => "metal",
AssetClass::Rates => "rates",
AssetClass::Nav => "nav",
AssetClass::Commodity => "commodity",
AssetClass::FundingRate => "funding-rate",
}
}
}

// Operation and coefficient for converting value to mantissa.
enum ExponentFactor {
// mantissa = value * factor
Expand Down