Async client for the Kite Connect WebSocket API
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: net change calculation

+7 -6
+7 -6
src/models/tick.rs
··· 1 - use std::{time::Duration, ops::Div}; 1 + use std::time::Duration; 2 2 3 - use crate::{Mode, Exchange, OHLC, Depth}; 3 + use crate::{Depth, Exchange, Mode, OHLC}; 4 4 5 - use super::{value, price}; 5 + use super::{price, value}; 6 6 7 7 #[derive(Debug, Clone, Default)] 8 8 /// ··· 50 50 if close_price == 0_f64 { 51 51 return None; 52 52 } else { 53 - Some(((last_price - close_price) * 100.0).div(close_price)) 53 + // Some(((last_price - close_price) * 100.0).div(close_price)) 54 + Some(last_price - close_price) 54 55 } 55 56 } else { 56 57 None ··· 100 101 t.total_sell_qty = value(&bs[16..20]); 101 102 // 28 - 44 bytes : ohlc 102 103 t.ohlc = OHLC::from(&bs[20..36], &t.exchange); 103 - 104 - t.set_change(); 105 104 } 106 105 } 107 106 }; ··· 117 116 } else { 118 117 if let Some(bs) = i.get(44..184) { 119 118 t.mode = Mode::Full; 119 + t.set_change(); 120 + 120 121 // 44 - 48 bytes : last traded timestamp 121 122 t.last_traded_timestamp = 122 123 value(&bs[0..4]).map(|x| Duration::from_secs(x.into()));