diff --git a/src/main.rs b/src/main.rs index 77a5a3a..f0ede97 100644 --- a/src/main.rs +++ b/src/main.rs @@ -75,8 +75,7 @@ async fn main() -> Result<()> { let px: f64 = event.px.parse().unwrap_or(0.0); let usd_val = sz * px; - // Calculate Level and Determine Order Type using NotionRowData helpers - let level_str = NotionRowData::calculate_level(usd_val); + // Determine Order Type using NotionRowData helper let order_type_str = NotionRowData::determine_order_type(event.crossed); info!( @@ -85,7 +84,6 @@ async fn main() -> Result<()> { px = %event.px, sz = %event.sz, usd_val = %format!("{:.2}", usd_val), - level = %level_str, order_type = %order_type_str, oid = event.oid, "Captured position open event, writing to Notion..." @@ -102,7 +100,6 @@ async fn main() -> Result<()> { time: event.time, order_id: event.oid, check: false, - level: level_str, order_type: order_type_str, }; diff --git a/src/notion.rs b/src/notion.rs index 553e6f3..8413abf 100644 --- a/src/notion.rs +++ b/src/notion.rs @@ -161,20 +161,7 @@ impl NotionWriter { }, ); - // 9. Level (Select column) - properties.insert( - "Level".to_string(), - PageProperty::Select { - id: None, - select: Some(SelectPropertyValue { - id: None, - name: Some(data.level), - color: None, - }), - }, - ); - - // 10. Order Type (Select column) + // 9. Order Type (Select column) properties.insert( "Order Type".to_string(), PageProperty::Select { diff --git a/src/structs.rs b/src/structs.rs index 64ce9af..2a6d0c4 100644 --- a/src/structs.rs +++ b/src/structs.rs @@ -39,24 +39,10 @@ pub struct NotionRowData { pub time: u64, // Unix timestamp in milliseconds pub order_id: u64, // Hyperliquid order ID (oid) pub check: bool, // false - pub level: String, // e.g. "0", "1", "2" pub order_type: String, // "MARKET" or "LIMIT" } impl NotionRowData { - /// Calculate Level from USD value: - /// level 0 = 2.5$, level 1 = 5$, level 2 = 10$, and so on (scaling logarithmically by factor of 2) - pub fn calculate_level(usd_val: f64) -> String { - if usd_val <= 0.0 { - "0".to_string() - } else { - let ratio = usd_val / 2.5; - let lvl = ratio.log2().round() as i32; - let lvl = lvl.max(0); - lvl.to_string() - } - } - /// Determine Order Type from the crossed flag: /// crossed == true represents MARKET (taker), crossed == false represents LIMIT (maker) pub fn determine_order_type(crossed: bool) -> String { @@ -72,36 +58,6 @@ impl NotionRowData { mod tests { use super::*; - #[test] - fn test_calculate_level() { - // Test base cases specified by user - assert_eq!(NotionRowData::calculate_level(2.5), "0"); - assert_eq!(NotionRowData::calculate_level(5.0), "1"); - assert_eq!(NotionRowData::calculate_level(10.0), "2"); - - // Test boundary limits (midpoints between levels) - // Midpoint of 2.5 and 5.0 is geometric mean sqrt(2.5 * 5.0) = ~3.535 - // log2(3.5 / 2.5) = log2(1.4) = ~0.485 (rounds to 0) -> level 0 - // log2(3.6 / 2.5) = log2(1.44) = ~0.526 (rounds to 1) -> level 1 - assert_eq!(NotionRowData::calculate_level(3.5), "0"); - assert_eq!(NotionRowData::calculate_level(3.6), "1"); - - // Midpoint of 5.0 and 10.0 is geometric mean sqrt(5 * 10) = ~7.07 - // log2(7.0 / 2.5) = log2(2.8) = ~1.485 (rounds to 1) -> level 1 - // log2(7.1 / 2.5) = log2(2.84) = ~1.506 (rounds to 2) -> level 2 - assert_eq!(NotionRowData::calculate_level(7.0), "1"); - assert_eq!(NotionRowData::calculate_level(7.1), "2"); - - // Test edge cases - assert_eq!(NotionRowData::calculate_level(0.0), "0"); - assert_eq!(NotionRowData::calculate_level(-5.5), "0"); - assert_eq!(NotionRowData::calculate_level(1.0), "0"); - - // Test higher levels - assert_eq!(NotionRowData::calculate_level(20.0), "3"); - assert_eq!(NotionRowData::calculate_level(40.0), "4"); - } - #[test] fn test_determine_order_type() { assert_eq!(NotionRowData::determine_order_type(true), "MARKET");