|
|
@@ -239,14 +239,14 @@ pub fn generate_msv_by_trades(mut trades: Vec<Trade>, mills_back: Decimal, simpl
|
|
|
// ==================== 预期利润逻辑计算 ====================
|
|
|
// 首先计算未来一段时间的价格与现在的距离
|
|
|
let mut future_rate = Decimal::ONE_HUNDRED * (future_ref_price - last_price) / last_price;
|
|
|
- future_rate = min(future_rate, rate.abs());
|
|
|
future_rate.rescale(2);
|
|
|
// 根据具体向上波动还是向下波动来计算预期最大利润
|
|
|
- let epr = if rate > Decimal::ZERO {
|
|
|
+ let mut epr = if rate > Decimal::ZERO {
|
|
|
-future_rate
|
|
|
} else {
|
|
|
future_rate
|
|
|
};
|
|
|
+ epr = min(epr, rate.abs());
|
|
|
|
|
|
// 去重,以及保留最大的波动率
|
|
|
if msv_data.len() > 0 {
|