|
|
@@ -232,7 +232,11 @@ pub fn generate_msv_by_trades(mut trades: Vec<Trade>, mills_back: Decimal, simpl
|
|
|
let rst_size = if (max_size == Decimal::ZERO || min_size == Decimal::ONE_THOUSAND * Decimal::ONE_THOUSAND) && final_depth_data.len() > 0 {
|
|
|
final_depth_data.last().unwrap()[1]
|
|
|
} else {
|
|
|
- (max_size + min_size) / Decimal::TWO
|
|
|
+ if (max_size == Decimal::ZERO || min_size == Decimal::ONE_THOUSAND * Decimal::ONE_THOUSAND) && simple_depths.len() > 0 {
|
|
|
+ simple_depths[0].size
|
|
|
+ } else {
|
|
|
+ (max_size + min_size) / Decimal::TWO
|
|
|
+ }
|
|
|
};
|
|
|
// 简易的深度数据处理
|
|
|
final_depth_data.push(vec![index_timestamp, rst_size]);
|
|
|
@@ -291,6 +295,8 @@ pub fn parse_json_to_simple_depths(depths_json: Value) -> Vec<SimpleDepth> {
|
|
|
let depth: SimpleDepth = SimpleDepth {
|
|
|
time: Decimal::from_str(depth_json["time"].as_str().unwrap()).unwrap(),
|
|
|
size: Decimal::from_str(depth_json["size"].as_str().unwrap()).unwrap(),
|
|
|
+ a1: Decimal::from_str(depth_json["a1"].as_str().unwrap()).unwrap(),
|
|
|
+ b1: Decimal::from_str(depth_json["b1"].as_str().unwrap()).unwrap(),
|
|
|
};
|
|
|
|
|
|
rst.insert(0, depth)
|