drm_core/models/
crypto_hourly.rs1use chrono::{DateTime, Utc};
2use serde::{Deserialize, Serialize};
3
4#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5#[serde(rename_all = "lowercase")]
6pub enum MarketDirection {
7 Up,
8 Down,
9}
10
11#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
12#[serde(rename_all = "snake_case")]
13pub enum CryptoMarketType {
14 UpDown,
15 StrikePrice,
16}
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
19pub struct CryptoHourlyMarket {
20 pub token_symbol: String,
21 pub expiry_time: DateTime<Utc>,
22 pub strike_price: Option<f64>,
23 pub direction: Option<MarketDirection>,
24 pub market_type: Option<CryptoMarketType>,
25}
26
27pub fn normalize_token_symbol(token: &str) -> String {
28 match token.to_uppercase().as_str() {
29 "BITCOIN" => "BTC".to_string(),
30 "ETHEREUM" => "ETH".to_string(),
31 "SOLANA" => "SOL".to_string(),
32 other => other.to_string(),
33 }
34}