|
|
@@ -130,6 +130,9 @@ impl PredictorNew {
|
|
|
计算价格偏差范围
|
|
|
**/
|
|
|
pub fn calc_deviation_range(&mut self, ira: Decimal) -> Decimal {
|
|
|
+ if self.max_spread == Decimal::ZERO || self.max_spread == Decimal::ZERO{
|
|
|
+ return Decimal::ZERO
|
|
|
+ }
|
|
|
return (self.rl_num - ira) * self.max_spread + ira * self.min_spread;
|
|
|
}
|
|
|
|
|
|
@@ -255,6 +258,9 @@ impl PredictorNew {
|
|
|
}
|
|
|
let ira = self.ira;
|
|
|
let dd = self.calc_deviation_range(ira.clone());
|
|
|
+ if dd == Decimal::ZERO {
|
|
|
+ return Vec::new();
|
|
|
+ }
|
|
|
let gamma = self.calc_gamma(ira.clone(), &std);
|
|
|
let rp = self.calc_rp(&gamma, &std);
|
|
|
let dk = self.calc_dk(&gamma, &std);
|