@@ -1,6 +1,6 @@ | |||||
[package] | [package] | ||||
name = "markets" | name = "markets" | ||||
version = "0.1.0" | |||||
version = "0.2.0" | |||||
authors = ["Jonathan Strong <jstrong@tioscapital.com>"] | authors = ["Jonathan Strong <jstrong@tioscapital.com>"] | ||||
edition = "2018" | edition = "2018" | ||||
@@ -10,5 +10,10 @@ edition = "2018" | |||||
serde = { version = "1", features = ["derive"] } | serde = { version = "1", features = ["derive"] } | ||||
chrono = { version = "0.4", features = ["serde"] } | chrono = { version = "0.4", features = ["serde"] } | ||||
chrono-tz = "0.4" | chrono-tz = "0.4" | ||||
uuid = { version = "0.7.0", features = ["serde", "v4", "slog"] } | |||||
#uuid = { version = "0.7.0", features = ["serde", "v4", "slog"] } | |||||
hashbrown = { version = "0.6.3", default_features = false, features = ["serde", "ahash"] } | hashbrown = { version = "0.6.3", default_features = false, features = ["serde", "ahash"] } | ||||
#decimal = { git = "https://git.mmcxi.com/mm/decimal", branch = "v2.3.x" } | |||||
#decimal-macros = { git = "https://git.mmcxi.com/mm/decimal-macros", rev = "v0.2.1", optional = true } | |||||
[features] | |||||
unstable = [] |
@@ -0,0 +1,46 @@ | |||||
use serde::{Serialize, Deserialize}; | |||||
use chrono_tz::Tz; | |||||
use chrono_tz::US::{Eastern, Central, Pacific}; | |||||
use chrono_tz::Etc::GMTPlus5; | |||||
use Market::*; | |||||
#[derive(Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash)] | |||||
#[repr(u8)] | |||||
pub enum Market { | |||||
Pjm = 1, | |||||
Miso = 2, | |||||
Caiso = 3, | |||||
Ercot = 4, | |||||
Spp = 5, | |||||
Nyiso = 6, | |||||
Iso = 7, | |||||
} | |||||
impl Market { | |||||
pub fn time_zone(&self) -> Tz { | |||||
match self { | |||||
Pjm => Eastern, | |||||
Miso => GMTPlus5, | |||||
Caiso => Pacific, | |||||
Ercot => Central, | |||||
Spp => Central, | |||||
Nyiso => Eastern, | |||||
Iso => Eastern, | |||||
} | |||||
} | |||||
pub fn as_str(&self) -> &'static str { | |||||
match self { | |||||
Pjm => "pjm", | |||||
Miso => "miso", | |||||
Caiso => "caiso", | |||||
Ercot => "ercot", | |||||
Spp => "spp", | |||||
Nyiso => "nyiso", | |||||
Iso => "isone", | |||||
} | |||||
} | |||||
} | |||||
@@ -1,52 +1,8 @@ | |||||
use serde::{Serialize, Deserialize}; | |||||
use chrono_tz::Tz; | |||||
use chrono_tz::US::{Eastern, Central, Pacific}; | |||||
use chrono_tz::Etc::GMTPlus5; | |||||
#![cfg_attr(all(test, feature = "unstable"), feature(test))] | |||||
use Market::*; | |||||
#[cfg(all(test, feature = "unstable"))] | |||||
extern crate test; | |||||
#[derive(Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash)] | |||||
#[repr(u8)] | |||||
pub enum Market { | |||||
Pjm = 1, | |||||
Miso = 2, | |||||
Caiso = 3, | |||||
Ercot = 4, | |||||
Spp = 5, | |||||
Nyiso = 6, | |||||
Iso = 7, | |||||
} | |||||
impl Market { | |||||
pub fn time_zone(&self) -> Tz { | |||||
match self { | |||||
Pjm => Eastern, | |||||
Miso => GMTPlus5, | |||||
Caiso => Pacific, | |||||
Ercot => Central, | |||||
Spp => Central, | |||||
Nyiso => Eastern, | |||||
Iso => Eastern, | |||||
} | |||||
} | |||||
pub fn as_str(&self) -> &'static str { | |||||
match self { | |||||
Pjm => "pjm", | |||||
Miso => "miso", | |||||
Caiso => "caiso", | |||||
Ercot => "ercot", | |||||
Spp => "spp", | |||||
Nyiso => "nyiso", | |||||
Iso => "isone", | |||||
} | |||||
} | |||||
} | |||||
#[cfg(test)] | |||||
mod tests { | |||||
#[test] | |||||
fn it_works() { | |||||
assert_eq!(2 + 2, 4); | |||||
} | |||||
} | |||||
pub mod iso; | |||||
//#[macro_use] | |||||
pub mod crypto; |