|
|
@@ -190,6 +190,7 @@ pub fn generate_msv_by_trades(mut trades: Vec<Trade>, mills_back: Decimal, simpl
|
|
|
} else {
|
|
|
Decimal::ZERO
|
|
|
};
|
|
|
+ let mid_price = (a1_first + b1_first) / Decimal::TWO;
|
|
|
|
|
|
let mut index_timestamp = Decimal::from_i64(start_time).unwrap();
|
|
|
let last_timestamp = Decimal::from_i64(end_time).unwrap();
|
|
|
@@ -268,8 +269,8 @@ pub fn generate_msv_by_trades(mut trades: Vec<Trade>, mills_back: Decimal, simpl
|
|
|
} else {
|
|
|
let depth = &simple_depths[max_spread_index];
|
|
|
|
|
|
- final_a1s_data.push(vec![index_timestamp, depth.a1 - a1_first]);
|
|
|
- final_b1s_data.push(vec![index_timestamp, depth.b1 - b1_first]);
|
|
|
+ final_a1s_data.push(vec![index_timestamp, depth.a1 - mid_price]);
|
|
|
+ final_b1s_data.push(vec![index_timestamp, depth.b1 - mid_price]);
|
|
|
}
|
|
|
} else {
|
|
|
final_a1s_data.push(vec![index_timestamp, Decimal::ZERO]);
|