瀏覽代碼

LPM值很小时不计算omega, sortino, kappa

Joey 6 月之前
父節點
當前提交
bb7ebccb41
共有 1 個文件被更改,包括 6 次插入1 次删除
  1. 6 1
      modules/indicatorCalculator.dos

+ 6 - 1
modules/indicatorCalculator.dos

@@ -171,7 +171,7 @@ def cal_basic_performance(entity_info, ret, trailing_month) {
  * 
  */
 def cal_LPM(ret, risk_free, trailing_month) {
-    
+
     t = SELECT *, cumcount(entity_id) AS cnt FROM ret WHERE ret > -1 CONTEXT BY entity_id;
 
     if(trailing_month == 'incep') {
@@ -226,6 +226,11 @@ def cal_omega_sortino_kappa(ret, risk_free, trailing_month) {
 
     lpm = cal_LPM(ret, risk_free, trailing_month);
 
+    // 去掉一些 lpm 值太小的无意义数据
+    UPDATE lpm SET lpm1 = NULL WHERE lpm1.round(4) == 0;
+    UPDATE lpm SET lpm2 = NULL WHERE lpm2.round(4) == 0;
+    UPDATE lpm SET lpm3 = NULL WHERE lpm3.round(4) == 0;
+
     if(trailing_month == 'incep') {
 
         tb = SELECT t.entity_id, t.end_date,