|
|
@@ -17,21 +17,16 @@ use crate::utils;
|
|
|
#[derive(Debug, Clone)]
|
|
|
pub struct Predictor {
|
|
|
pub depth_vec: Vec<Depth>, // 深度队列
|
|
|
- pub volume_vec: Vec<Decimal>, // 交易量队列
|
|
|
- pub trade_long_vec: FixedTimeRangeDeque<Trade>, // 交易队列
|
|
|
- pub trade_short_vec: FixedTimeRangeDeque<Trade>, // 交易队列
|
|
|
- pub trade_fixed_vec: Vec<Trade>, // 交易队列(观察持仓后的资金流)
|
|
|
pub spread_vec: Vec<Decimal>, // 价差队列
|
|
|
pub record_vec: VecDeque<Record>, // 蜡烛队列
|
|
|
|
|
|
+ pub trade_long_vec: FixedTimeRangeDeque<Trade>, // 交易队列
|
|
|
+ pub trade_short_vec: FixedTimeRangeDeque<Trade>, // 交易队列
|
|
|
+
|
|
|
pub mid_price: Decimal, // 中间价
|
|
|
pub ask_price: Decimal, // 卖一价
|
|
|
pub bid_price: Decimal, // 买一价
|
|
|
pub last_price: Decimal, // 最后成交价
|
|
|
- pub trades_volume_short: Decimal, // 过去10秒的成交量总和
|
|
|
- pub trades_volume_short_ema: Decimal, // 过去10秒的成交量总和的ema
|
|
|
- pub spread: Decimal, // 当前价差
|
|
|
- pub spread_ema_1000: Decimal, // 价差的ema,1000级别
|
|
|
|
|
|
pub optimal_ask_price: Decimal, // 卖出挂单价
|
|
|
pub optimal_bid_price: Decimal, // 买入挂单价
|
|
|
@@ -43,26 +38,25 @@ pub struct Predictor {
|
|
|
pub inventory: Decimal, // 库存,也就是q
|
|
|
pub pos_amount: Decimal, // 原始持仓量
|
|
|
pub pos_avg_price: Decimal, // 原始持仓价格
|
|
|
- pub level: Decimal, // martin
|
|
|
|
|
|
pub money_flow: Decimal, // 资金流
|
|
|
|
|
|
pub ask_delta: Decimal, // δa
|
|
|
pub bid_delta: Decimal, // δb
|
|
|
|
|
|
- pub mid_price_time_vec: FixedTimeRangeDeque<Decimal>, // 中间价格队列,
|
|
|
- pub fair_price_time_vec: FixedTimeRangeDeque<Decimal>, // 公平价格队列,
|
|
|
+ pub mid_price_time_vec: FixedTimeRangeDeque<Decimal>, // 中间价格队列
|
|
|
+ pub fair_price_time_vec: FixedTimeRangeDeque<Decimal>, // 公平价格队列
|
|
|
pub fair_price_long_time_vec: FixedTimeRangeDeque<Decimal>, //
|
|
|
- pub fair_price_vec: Vec<Decimal>, // 公平价格列表,233表示做市所,其它表示参考所
|
|
|
- pub price_times_avg_vec: Vec<Decimal>, // 公平所与做市所的价格倍率的平均值
|
|
|
- pub fair_price: Decimal, // 公平价格
|
|
|
+ pub fair_price_vec: Vec<Decimal>, // 公平价格列表
|
|
|
+ pub fair_price_std_vec: Vec<Decimal>, // 公平价格列表,标准化之后的
|
|
|
+ pub price_avg_times_vec: Vec<Decimal>, // 公平所与做市所的价格倍率的平均值
|
|
|
+
|
|
|
pub fair_price_ema_short: Decimal, // 公平价格_ema
|
|
|
pub fair_price_ema_long: Decimal, // 公平价格_ema
|
|
|
pub fair_rate_focus_open: Decimal, // 变化幅度焦点
|
|
|
pub mid_price_focus_open: Decimal, // 观测焦点时的价格
|
|
|
pub fair_rate_focus_close: Decimal, // 变化幅度焦点
|
|
|
- pub fair_price_focus_close: Decimal, // 观测焦点时的价格
|
|
|
- pub fair_price_when_ordering: Decimal, // 下单时的公平价格
|
|
|
+ pub mid_price_focus_close: Decimal, // 观测焦点时的价格
|
|
|
|
|
|
pub is_ready: bool, // 是否已准备好
|
|
|
|
|
|
@@ -139,14 +133,13 @@ impl Predictor {
|
|
|
let predictor = Self {
|
|
|
// 接针版本
|
|
|
depth_vec: vec![Depth::new(); params.ref_exchange.len()],
|
|
|
+ fair_price_std_vec: vec![Decimal::ZERO; params.ref_exchange.len()],
|
|
|
fair_price_vec: vec![Decimal::ZERO; params.ref_exchange.len()],
|
|
|
- volume_vec: vec![Decimal::ZERO; params.ref_exchange.len()],
|
|
|
|
|
|
// 老的队列
|
|
|
spread_vec: vec![],
|
|
|
trade_long_vec: FixedTimeRangeDeque::new(Self::TRADE_LONG_RANGE_MICROS),
|
|
|
trade_short_vec: FixedTimeRangeDeque::new(Self::TRADE_SHORT_RANGE_MICROS),
|
|
|
- trade_fixed_vec: vec![],
|
|
|
profit_point_vec: vec![],
|
|
|
record_vec: VecDeque::new(),
|
|
|
|
|
|
@@ -154,10 +147,6 @@ impl Predictor {
|
|
|
ask_price: Default::default(),
|
|
|
bid_price: Default::default(),
|
|
|
last_price: Default::default(),
|
|
|
- trades_volume_short: Default::default(),
|
|
|
- trades_volume_short_ema: Default::default(),
|
|
|
- spread: Default::default(),
|
|
|
- spread_ema_1000: Default::default(),
|
|
|
optimal_ask_price: Default::default(),
|
|
|
optimal_bid_price: Default::default(),
|
|
|
|
|
|
@@ -168,21 +157,18 @@ impl Predictor {
|
|
|
fair_price_time_vec: FixedTimeRangeDeque::new((params.second_observation_time.to_f64().unwrap() * 1_000_000f64).to_i64().unwrap()),
|
|
|
fair_price_long_time_vec: FixedTimeRangeDeque::new(5 * 60_000_000),
|
|
|
mid_price_time_vec: FixedTimeRangeDeque::new(100_000),
|
|
|
- fair_price: Default::default(),
|
|
|
fair_price_ema_short: Default::default(),
|
|
|
fair_price_ema_long: Default::default(),
|
|
|
fair_rate_focus_open: Default::default(),
|
|
|
mid_price_focus_open: Default::default(),
|
|
|
fair_rate_focus_close: Default::default(),
|
|
|
- fair_price_focus_close: Default::default(),
|
|
|
- fair_price_when_ordering: Default::default(),
|
|
|
+ mid_price_focus_close: Default::default(),
|
|
|
|
|
|
- price_times_avg_vec: Default::default(),
|
|
|
+ price_avg_times_vec: Default::default(),
|
|
|
|
|
|
is_ready: false,
|
|
|
prev_trade_time: Utc::now().timestamp_micros(),
|
|
|
t_diff: Default::default(),
|
|
|
- level: Default::default(),
|
|
|
pos_amount: Default::default(),
|
|
|
money_flow: Default::default(),
|
|
|
profit_point: Default::default(),
|
|
|
@@ -230,12 +216,12 @@ impl Predictor {
|
|
|
self.profit_point = profit_now;
|
|
|
self.profit_point_ema = self.profit_point_ema * dec!(0.99) + self.profit_point * dec!(0.01);
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- self.update_fair_price(depth, index).await;
|
|
|
- self.update_spread();
|
|
|
+ } else {
|
|
|
+ self.update_fair_price(depth, index).await;
|
|
|
+ self.update_spread();
|
|
|
|
|
|
- self.depth_vec[index] = depth.clone();
|
|
|
+ self.depth_vec[index] = depth.clone();
|
|
|
+ }
|
|
|
|
|
|
if self.mid_price.is_zero() {
|
|
|
return;
|
|
|
@@ -246,35 +232,12 @@ impl Predictor {
|
|
|
pub async fn on_trade(&mut self, trade: &Trade, _index: usize) {
|
|
|
self.trade_long_vec.push_back(trade.clone());
|
|
|
self.trade_short_vec.push_back(trade.clone());
|
|
|
- if !self.inventory.is_zero() {
|
|
|
- self.trade_fixed_vec.push(trade.clone());
|
|
|
-
|
|
|
- if self.trade_fixed_vec.len() > 100 {
|
|
|
- let (bought_sum, sold_sum): (Decimal, Decimal) = self.trade_fixed_vec.iter()
|
|
|
- .fold((Decimal::ZERO, Decimal::ZERO), |(buy_sum, sell_sum), item| {
|
|
|
- if item.size > Decimal::ZERO {
|
|
|
- (buy_sum + item.value.abs(), sell_sum)
|
|
|
- } else if item.size < Decimal::ZERO {
|
|
|
- (buy_sum, sell_sum + item.value.abs())
|
|
|
- } else {
|
|
|
- (buy_sum, sell_sum)
|
|
|
- }
|
|
|
- });
|
|
|
- self.money_flow = (bought_sum - sold_sum) / (bought_sum + sold_sum);
|
|
|
- self.money_flow.rescale(4);
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
self.last_price = trade.price;
|
|
|
|
|
|
// self.processor().await;
|
|
|
}
|
|
|
|
|
|
- pub async fn update_level(&mut self) {
|
|
|
- self.level = (Decimal::NEGATIVE_ONE + (Decimal::ONE + dec!(8) * self.inventory.abs()).sqrt().unwrap()) / Decimal::TWO;
|
|
|
- self.level = min(self.level, dec!(6));
|
|
|
- }
|
|
|
-
|
|
|
pub async fn on_ticker(&mut self, _ticker: &Ticker) {}
|
|
|
|
|
|
pub async fn on_record(&mut self, _record: &Record) {}
|
|
|
@@ -308,7 +271,6 @@ impl Predictor {
|
|
|
|
|
|
// 重置资金流计算
|
|
|
if prev_inventory != self.inventory && self.inventory.is_zero() {
|
|
|
- self.trade_fixed_vec.clear();
|
|
|
self.profit_point_vec.clear();
|
|
|
self.profit_point = Decimal::ZERO;
|
|
|
self.profit_point_ema = Decimal::ZERO;
|
|
|
@@ -316,7 +278,6 @@ impl Predictor {
|
|
|
self.money_flow = Decimal::ZERO;
|
|
|
}
|
|
|
|
|
|
- self.update_level().await;
|
|
|
self.processor().await;
|
|
|
}
|
|
|
|
|
|
@@ -344,42 +305,29 @@ impl Predictor {
|
|
|
|
|
|
// https://quant.stackexchange.com/questions/50651/how-to-understand-micro-price-aka-weighted-mid-price
|
|
|
let total = a1.value + b1.value;
|
|
|
- let fair_price = a1.price * b1.value / total + b1.price * a1.value / total;
|
|
|
+ let fp = a1.price * b1.value / total + b1.price * a1.value / total;
|
|
|
// let fair_price = (a1.price + b1.price) / Decimal::TWO;
|
|
|
|
|
|
+ // 生成mid price
|
|
|
self.fair_price_vec[index] = if self.fair_price_vec[index].is_zero() {
|
|
|
- fair_price
|
|
|
+ fp
|
|
|
} else {
|
|
|
- self.fair_price_vec[index] * dec!(0.5) + fair_price * dec!(0.5)
|
|
|
+ self.fair_price_vec[index] * dec!(0.5) + fp * dec!(0.5)
|
|
|
};
|
|
|
self.fair_price_vec[index].rescale(self.mid_price.scale());
|
|
|
- self.volume_vec[index] = a1.size + b1.size;
|
|
|
|
|
|
- // 合成公平价格
|
|
|
- if !self.fair_price_vec[0].is_zero() && !self.fair_price_vec[1].is_zero() {
|
|
|
- self.price_times_avg_vec[index] = if self.price_times_avg_vec[index].is_zero() {
|
|
|
- self.fair_price_vec[1] / self.fair_price_vec[0]
|
|
|
- } else {
|
|
|
- self.price_times_avg_vec[index] * dec!(0.9995) + dec!(0.0005) * self.fair_price_vec[1] / self.fair_price_vec[0]
|
|
|
- };
|
|
|
+ // 求价格倍率
|
|
|
+ self.price_avg_times_vec[index] = if self.price_avg_times_vec[index].is_zero() {
|
|
|
+ self.fair_price_vec[index] / self.mid_price
|
|
|
+ } else {
|
|
|
+ self.price_avg_times_vec[index] * dec!(0.9995) + dec!(0.0005) * self.fair_price_std_vec[1] / self.fair_price_std_vec[0]
|
|
|
+ };
|
|
|
|
|
|
- // 进行价格归一化处理,公平所的价格有可能是带前缀的
|
|
|
- // let fair_price_part0 = self.fair_price_vec[0] * dec!(0.2);
|
|
|
- // let fair_price_part1 = (self.fair_price_vec[1] / self.price_times_avg) * dec!(0.8);
|
|
|
- self.fair_price = self.fair_price_vec[1] / self.price_times_avg_vec[index];
|
|
|
- self.fair_price_time_vec.push_back(self.fair_price);
|
|
|
- self.fair_price_long_time_vec.push_back(self.fair_price);
|
|
|
- self.fair_price_ema_long = if self.fair_price_ema_long.is_zero() {
|
|
|
- self.fair_price
|
|
|
- } else {
|
|
|
- self.fair_price_ema_long * dec!(0.67) + self.fair_price * dec!(0.33)
|
|
|
- };
|
|
|
- self.fair_price_ema_short = if self.fair_price_ema_short.is_zero() {
|
|
|
- self.fair_price
|
|
|
- } else {
|
|
|
- self.fair_price_ema_short * dec!(0.999) + self.fair_price * dec!(0.001)
|
|
|
- };
|
|
|
+ // 合成公平价格
|
|
|
+ self.fair_price_std_vec[index] = self.fair_price_vec[index] / self.price_avg_times_vec[index];
|
|
|
|
|
|
+ // 合成公平价格
|
|
|
+ if !self.fair_price_std_vec[0].is_zero() && !self.fair_price_std_vec[1].is_zero() {
|
|
|
if self.fair_price_time_vec.len() < 2 {
|
|
|
return;
|
|
|
}
|
|
|
@@ -388,20 +336,10 @@ impl Predictor {
|
|
|
rate.rescale(8);
|
|
|
|
|
|
// 重置开仓焦点,条件1
|
|
|
- if !self.fair_rate_focus_open.is_zero() {
|
|
|
- if self.fair_rate_focus_open > Decimal::ZERO && self.spread_ema_1000 < Decimal::ZERO {
|
|
|
- self.fair_rate_focus_open = Decimal::ZERO;
|
|
|
- }
|
|
|
-
|
|
|
- if self.fair_rate_focus_open < Decimal::ZERO && self.spread_ema_1000 > Decimal::ZERO {
|
|
|
- self.fair_rate_focus_open = Decimal::ZERO;
|
|
|
- }
|
|
|
- }
|
|
|
- // 重置开仓焦点,条件2
|
|
|
if !self.fair_rate_focus_open.is_zero() && !self.inventory.is_zero() {
|
|
|
self.fair_rate_focus_open = Decimal::ZERO;
|
|
|
}
|
|
|
- // 重置开仓焦点,条件3
|
|
|
+ // 重置开仓焦点,条件2
|
|
|
if !self.mid_price_focus_open.is_zero() {
|
|
|
let focus_rate = (self.mid_price - self.mid_price_focus_open) / self.mid_price_focus_open;
|
|
|
|
|
|
@@ -416,15 +354,15 @@ impl Predictor {
|
|
|
// 更新程序关注的开仓焦点
|
|
|
if self.fair_rate_focus_open.is_zero() && self.inventory.is_zero() {
|
|
|
// 只有有强度的rate才有资格被称为针,并且差价够大,
|
|
|
- if rate.abs() > self.params.open_activate && self.spread.abs() > self.params.min_spread {
|
|
|
+ if rate.abs() > self.params.open_activate {
|
|
|
// 向上涨,并且fair下穿mid,视为观测阶段开始
|
|
|
- if rate > Decimal::ZERO && self.spread < Decimal::ZERO {
|
|
|
+ if rate > Decimal::ZERO {
|
|
|
self.fair_rate_focus_open = rate;
|
|
|
self.mid_price_focus_open = self.mid_price;
|
|
|
}
|
|
|
|
|
|
// 向下跌,并且fair上穿mid,视为观测阶段开始
|
|
|
- if rate < Decimal::ZERO && self.spread > Decimal::ZERO {
|
|
|
+ if rate < Decimal::ZERO {
|
|
|
self.fair_rate_focus_open = rate;
|
|
|
self.mid_price_focus_open = self.mid_price;
|
|
|
}
|
|
|
@@ -442,7 +380,7 @@ impl Predictor {
|
|
|
}
|
|
|
// 重置平仓焦点,条件2
|
|
|
if !self.fair_rate_focus_close.is_zero() && self.fair_rate_focus_close > dec!(-0.1) {
|
|
|
- let focus_rate = (self.mid_price - self.fair_price_focus_close) / self.fair_price_focus_close;
|
|
|
+ let focus_rate = (self.mid_price - self.mid_price_focus_close) / self.mid_price_focus_close;
|
|
|
|
|
|
if self.fair_rate_focus_close > Decimal::ZERO && focus_rate < Decimal::NEGATIVE_ONE * self.params.close_activate / Decimal::TWO {
|
|
|
self.fair_rate_focus_close = Decimal::ZERO;
|
|
|
@@ -459,10 +397,10 @@ impl Predictor {
|
|
|
if self.inventory > Decimal::ZERO && close_rate > Decimal::ZERO {
|
|
|
if self.profit_point > Decimal::ZERO {
|
|
|
self.fair_rate_focus_close = close_rate;
|
|
|
- self.fair_price_focus_close = self.mid_price;
|
|
|
+ self.mid_price_focus_close = self.mid_price;
|
|
|
} else if self.t_diff.is_zero() {
|
|
|
self.fair_rate_focus_close = close_rate;
|
|
|
- self.fair_price_focus_close = self.mid_price;
|
|
|
+ self.mid_price_focus_close = self.mid_price;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -470,10 +408,10 @@ impl Predictor {
|
|
|
if self.inventory < Decimal::ZERO && close_rate < Decimal::ZERO {
|
|
|
if self.profit_point > Decimal::ZERO {
|
|
|
self.fair_rate_focus_close = close_rate;
|
|
|
- self.fair_price_focus_close = self.fair_price;
|
|
|
+ self.mid_price_focus_close = self.mid_price;
|
|
|
} else if self.t_diff.is_zero() {
|
|
|
self.fair_rate_focus_close = close_rate;
|
|
|
- self.fair_price_focus_close = self.fair_price;
|
|
|
+ self.mid_price_focus_close = self.mid_price;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -498,10 +436,10 @@ impl Predictor {
|
|
|
|
|
|
if (prev_profit_point >= Decimal::ZERO && profit_point < Decimal::ZERO) || (prev_profit_point > Decimal::ZERO && profit_point <= Decimal::ZERO) {
|
|
|
self.fair_rate_focus_close = dec!(-0.12);
|
|
|
- self.fair_price_focus_close = self.mid_price;
|
|
|
+ self.mid_price_focus_close = self.mid_price;
|
|
|
|
|
|
info!("----------------------------------------");
|
|
|
- info!("止损逻辑2, 在价格{}处,成本价{},价值={}, p={}。", self.fair_price_focus_close, self.pos_avg_price, self.pos_avg_price*self.pos_amount, self.profit_point);
|
|
|
+ info!("止损逻辑2, 在价格{}处,成本价{},价值={}, p={}。", self.mid_price_focus_close, self.pos_avg_price, self.pos_avg_price*self.pos_amount, self.profit_point);
|
|
|
info!("----------------------------------------");
|
|
|
}
|
|
|
}
|
|
|
@@ -516,25 +454,25 @@ impl Predictor {
|
|
|
}
|
|
|
|
|
|
pub fn update_spread(&mut self) {
|
|
|
- if self.mid_price.is_zero() || self.fair_price.is_zero() {
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- self.spread = (self.fair_price - self.mid_price) / self.mid_price;
|
|
|
- // self.spread.rescale(8);
|
|
|
- self.spread_vec.push(self.spread);
|
|
|
-
|
|
|
- self.spread_ema_1000 = if self.spread_ema_1000.is_zero() {
|
|
|
- self.spread
|
|
|
- } else {
|
|
|
- self.spread_ema_1000 * dec!(0.999) + self.spread * dec!(0.001)
|
|
|
- };
|
|
|
- // self.spread_sma_1000.rescale(8);
|
|
|
- // self.spread_sma_1000_time_vec.push_back(self.spread_ema_1000);
|
|
|
-
|
|
|
- while self.spread_vec.len() > 1_000 {
|
|
|
- self.spread_vec.remove(0);
|
|
|
- }
|
|
|
+ // if self.mid_price.is_zero() || self.fair_price.is_zero() {
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // self.spread = (self.fair_price - self.mid_price) / self.mid_price;
|
|
|
+ // // self.spread.rescale(8);
|
|
|
+ // self.spread_vec.push(self.spread);
|
|
|
+ //
|
|
|
+ // self.spread_ema_1000 = if self.spread_ema_1000.is_zero() {
|
|
|
+ // self.spread
|
|
|
+ // } else {
|
|
|
+ // self.spread_ema_1000 * dec!(0.999) + self.spread * dec!(0.001)
|
|
|
+ // };
|
|
|
+ // // self.spread_sma_1000.rescale(8);
|
|
|
+ // // self.spread_sma_1000_time_vec.push_back(self.spread_ema_1000);
|
|
|
+ //
|
|
|
+ // while self.spread_vec.len() > 1_000 {
|
|
|
+ // self.spread_vec.remove(0);
|
|
|
+ // }
|
|
|
}
|
|
|
|
|
|
pub fn update_delta(&mut self) {
|
|
|
@@ -542,7 +480,7 @@ impl Predictor {
|
|
|
// -1表示市价成交(委托对手盘的价格,但不一定能市价成交),这里再想想吧,经常委托出去没成交,明显比别人慢了
|
|
|
// 0是买一/卖一成交
|
|
|
|
|
|
- if self.fair_price.is_zero() {
|
|
|
+ if self.mid_price.is_zero() {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
@@ -628,9 +566,9 @@ impl Predictor {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- if self.fair_price == Decimal::ZERO {
|
|
|
- return;
|
|
|
- }
|
|
|
+ // if self.fair_price == Decimal::ZERO {
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
|
|
|
if self.ask_price == Decimal::ZERO {
|
|
|
return;
|
|
|
@@ -655,13 +593,6 @@ impl Predictor {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- self.trades_volume_short = self.trade_short_vec.deque.iter().map(|item| item.value).sum();
|
|
|
- self.trades_volume_short_ema = if self.trades_volume_short_ema.is_zero() {
|
|
|
- self.trades_volume_short
|
|
|
- } else {
|
|
|
- self.trades_volume_short_ema * dec!(0.9995) + self.trades_volume_short * dec!(0.0005)
|
|
|
- };
|
|
|
-
|
|
|
self.update_t_diff();
|
|
|
self.update_delta();
|
|
|
self.update_optimal_ask_and_bid();
|
|
|
@@ -676,15 +607,15 @@ impl Predictor {
|
|
|
|
|
|
// let cci_arc = self.cci_arc.clone();
|
|
|
let now = Decimal::from_i64(Utc::now().timestamp_millis()).unwrap();
|
|
|
- let mid_price = self.mid_price;
|
|
|
+ let mid_price = self.fair_price_std_vec[0] - self.mid_price;
|
|
|
let ask_price = self.ask_price;
|
|
|
let bid_price = self.bid_price;
|
|
|
let last_price = self.last_price;
|
|
|
- let fair_price = self.fair_price;
|
|
|
+ let fair_price = self.fair_price_std_vec[1] - self.mid_price;
|
|
|
|
|
|
let spread = self.mid_price;
|
|
|
- let spread_max = self.fair_price_vec[1];
|
|
|
- let spread_min = self.fair_price_vec[0];
|
|
|
+ let spread_min = self.fair_price_std_vec[0];
|
|
|
+ let spread_max = self.fair_price_std_vec[1];
|
|
|
// let spread = self.price_times_avg;
|
|
|
// let spread_max = self.fair_price_vec[1] / self.fair_price_vec[0];
|
|
|
// let spread_min = self.fair_price / self.mid_price;
|