@@ -17,6 +17,7 @@ use pyo3::pyclass;
1717 Debug , Deserialize , Serialize , Clone , Copy , PartialEq , Eq , TryFromPrimitive , IntoPrimitive ,
1818) ]
1919pub enum Vendors {
20+ Internal = 0 ,
2021 Databento = 1 ,
2122 Yfinance = 2 ,
2223}
@@ -32,6 +33,7 @@ impl TryFrom<i8> for Vendors {
3233
3334 fn try_from ( value : i8 ) -> Result < Self > {
3435 match value {
36+ 0 => Ok ( Vendors :: Internal ) ,
3537 1 => Ok ( Vendors :: Databento ) ,
3638 2 => Ok ( Vendors :: Yfinance ) ,
3739 _ => Err ( Error :: CustomError ( "Invalid value for Vendor" . into ( ) ) ) ,
@@ -42,6 +44,7 @@ impl TryFrom<i8> for Vendors {
4244impl Vendors {
4345 pub const fn as_str ( & self ) -> & ' static str {
4446 match self {
47+ Vendors :: Internal => "internal" ,
4548 Vendors :: Databento => "databento" ,
4649 Vendors :: Yfinance => "yfinance" ,
4750 }
@@ -53,6 +56,7 @@ impl FromStr for Vendors {
5356
5457 fn from_str ( value : & str ) -> Result < Self > {
5558 match value {
59+ "internal" => Ok ( Vendors :: Internal ) ,
5660 "databento" => Ok ( Vendors :: Databento ) ,
5761 "yfinance" => Ok ( Vendors :: Yfinance ) ,
5862 _ => Err ( Error :: CustomError ( format ! (
@@ -65,6 +69,7 @@ impl FromStr for Vendors {
6569impl fmt:: Display for Vendors {
6670 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
6771 match self {
72+ Vendors :: Internal => write ! ( f, "internal" ) ,
6873 Vendors :: Databento => write ! ( f, "databento" ) ,
6974 Vendors :: Yfinance => write ! ( f, "yfinance" ) ,
7075 }
@@ -73,20 +78,23 @@ impl fmt::Display for Vendors {
7378
7479#[ derive( Debug , Clone , Copy , PartialEq , Eq ) ]
7580pub enum VendorData {
81+ Internal ,
7682 Databento ( DatabentoData ) ,
7783 Yfinance ( YfinanceData ) ,
7884}
7985
8086impl VendorData {
8187 pub fn encode ( & self ) -> u64 {
8288 match & self {
89+ VendorData :: Internal => return 0 ,
8390 VendorData :: Databento ( data) => return data. encode ( ) ,
8491 VendorData :: Yfinance ( data) => return data. encode ( ) ,
8592 }
8693 }
8794
8895 pub fn decode ( raw : u64 , vendor : & Vendors ) -> Self {
8996 match vendor {
97+ Vendors :: Internal => return VendorData :: Internal ,
9098 Vendors :: Databento => return VendorData :: Databento ( DatabentoData :: decode ( raw) ) ,
9199 Vendors :: Yfinance => return VendorData :: Yfinance ( YfinanceData :: decode ( raw) ) ,
92100 }
0 commit comments