|
|
@@ -78,7 +78,7 @@ pub fn calc_theta(gamma: f64, std: f64, kappa: f64, ira: f64) -> f64 {
|
|
|
// 给定ira、当前库存、最大库存、买入价格、下单数量小数位数,计算合理下单数量
|
|
|
// 下单数量要与ira(风险系数)、quantity(库存)成反比
|
|
|
pub fn calc_order_amount(ira_max: f64, ira: f64, quantity: f64, quantity_max: f64, bid_price: f64, amount_decimal_places: usize) -> f64 {
|
|
|
- let eta = (ira_max / (ira + 1.0)) / (quantity * 2);
|
|
|
+ let eta = (ira_max / (ira + 1.0)) / (quantity * 2.0);
|
|
|
let order_value = (-quantity_max * eta).abs();
|
|
|
let order_amount = order_value / bid_price;
|
|
|
|