瀏覽代碼

Merge remote-tracking branch 'origin/master'

gepangpang 2 年之前
父節點
當前提交
a19dc0e7aa
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/as_libs.rs

+ 1 - 1
src/as_libs.rs

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