|
|
@@ -28,6 +28,7 @@ pub struct AvellanedaStoikov {
|
|
|
pub optimal_bid_price: Decimal, // 买入挂单价
|
|
|
|
|
|
pub inventory: Decimal, // 库存,也就是q
|
|
|
+ pub level: Decimal, // martin
|
|
|
pub sigma_square: Decimal, // σ^2,波动性的平方
|
|
|
pub gamma: Decimal, // γ,库存风险厌恶参数
|
|
|
pub kappa: Decimal, // κ 订单簿 流动性 参数
|
|
|
@@ -89,6 +90,7 @@ impl AvellanedaStoikov {
|
|
|
flow_ratio: Decimal::ONE,
|
|
|
flow_ratio_diff_log: Default::default(),
|
|
|
flow_out_value: Default::default(),
|
|
|
+ level: Default::default(),
|
|
|
};
|
|
|
|
|
|
avellaneda_stoikov
|
|
|
@@ -230,7 +232,7 @@ impl AvellanedaStoikov {
|
|
|
if self.gamma != Decimal::ZERO {
|
|
|
let a = (self.gamma * self.sigma_square * self.t_diff) / Decimal::TWO;
|
|
|
let base_pos_edge = self.gamma * self.sigma_square;
|
|
|
- let pos_edge = self.inventory.abs() * base_pos_edge * (Decimal::ONE + (self.inventory.abs() / dec!(5)));
|
|
|
+ let pos_edge = self.inventory.abs() * base_pos_edge * (Decimal::ONE + (self.inventory.abs() / dec!(45)));
|
|
|
// let ratio_edge = (self.flow_ratio_diff_log.abs() / dec!(0.0003)) * self.gamma * self.sigma_square * self.t_diff;
|
|
|
|
|
|
self.delta_bid = {
|