Browse Source

修改bug

chenbo 4 years ago
parent
commit
853ebfb204
1 changed files with 12 additions and 1 deletions
  1. 12 1
      lib/input_sina_detail.class.php

+ 12 - 1
lib/input_sina_detail.class.php

@@ -42,6 +42,17 @@ class Input_sina_detail
         return $arr2;
     }
 
+    //深市返回的成交量以个为单位,需转换为以手为单位
+    static private function getAmountForIndexDayK($code, $amount)
+    {
+        $newAmount = $amount;
+        $index = Index::getInfoByCode($code);
+        if ($index['exchange'] == STOCK_EXCHANGE_SZ) {
+            $newAmount = round($amount / 100);
+        }
+        return $newAmount;
+    }
+
     //获取index_day_k
     static public function getIndexDayK($indexList)
     {
@@ -65,7 +76,7 @@ class Input_sina_detail
             $data['close_price'] = floatval($item[3]);                       //当前价,15点之后就是收盘价
             $data['highest_price'] = floatval($item[4]);                     //最高价
             $data['lowest_price'] = floatval($item[5]);                      //最低价
-            $data['amount'] =  (int)($item[8]);                              //成交量,以手为单位
+            $data['amount'] = self::getAmountForIndexDayK($data['code'], (int)($item[8]));                              //成交量,以手为单位
             $data['value'] = (int)($item[9]);                                //成交金额,以万为单位
 
             $data['increase_ratio'] = 0;                                     //涨跌幅