MCPcopy Create free account
hub / github.com/Open-Quant/openquant / trade_sign

Function trade_sign

crates/openquant/src/data_structures.rs:239–247  ·  view source on GitHub ↗
(price: f64, prev_price: f64, prev_sign: i8)

Source from the content-addressed store, hash-verified

237 let (first, last) = (&trades[0], &trades[trades.len() - 1]);
238 let open = first.price;
239 let close = last.price;
240 let start_timestamp = first.timestamp;
241 let timestamp = last.timestamp;
242 let (high, low) = trades.iter().fold((f64::NEG_INFINITY, f64::INFINITY), |(h, l), trade| {
243 (h.max(trade.price), l.min(trade.price))
244 });
245 let (volume, dollar_value) = trades.iter().fold((0.0, 0.0), |(v, d), trade| {
246 let next_v = v + trade.volume;
247 let next_d = d + trade.price * trade.volume;
248 (next_v, next_d)
249 });
250

Callers 2

run_barsFunction · 0.85
imbalance_barsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected