コード例 #1
0
 public static function addInfo()
 {
     $importFile = self::$thisTaskDataPath . '20151200-21Good.List.txt';
     $exportFile = self::$thisTaskDataPath . '20151200-21Good.Table.txt';
     $stockList = parent::ReadList($importFile);
     $stockList = CommonInfo::CodeArray2ReferArray($stockList);
     $stockTable = array();
     $pre = '2015-11-00';
     $start = '2015-12-00';
     $end = '2015-12-21';
     foreach ($stockList as $stkL) {
         $stkT = array();
         $stkT['name'] = '<a target="_blank" href="' . Url::getBasePhp('Stock') . '?code=' . $stkL['code'] . '">' . '<span class="fore-stock-name">' . $stkL['name'] . '</span>' . '<span class="fore-stock-spell displaynone">' . $stkL['spell'] . '</span></a>';
         $stkT['code'] = '<span class="fore-stock-code">' . $stkL['code'] . '</span>';
         //以上为标准的  索引
         $tdd = new ThsDoctorData($stkL['code']);
         $t = $tdd->prepareData() ? $tdd->getDayPeriod($start, $end) : array();
         //total_score
         $stkT['total_score_max'] = LogicOperation::highValue($t, 'total_score');
         $stkT['total_score_min'] = LogicOperation::lowValue($t, 'total_score');
         //message_score
         $stkT['message_score_max'] = LogicOperation::highValue($t, 'message_score');
         $stkT['message_score_min'] = LogicOperation::lowValue($t, 'message_score');
         //trade_score
         $stkT['trade_score_max'] = LogicOperation::highValue($t, 'trade_score');
         $stkT['trade_score_min'] = LogicOperation::lowValue($t, 'trade_score');
         //basic_score
         $stkT['basic_score_max'] = LogicOperation::highValue($t, 'basic_score');
         $stkT['basic_score_min'] = LogicOperation::lowValue($t, 'basic_score');
         //评级买入次数
         $rd = new RateData($stkL['code']);
         $t = $rd->prepareData() ? $rd->getDayPeriod($pre, $end) : array();
         $t = $rd->filterBuy($t);
         $stkT['rate_buy_num'] = $t ? sizeof($t) : 0;
         //龙虎榜次数
         $ld = new LhbData($stkL['code']);
         $t = $ld->prepareData() ? $ld->getDayPeriod($start, $end) : array();
         $stkT['lhb_num'] = $t ? sizeof($t) : 0;
         $stockTable[] = $stkT;
     }
     parent::putTable($exportFile, $stockTable);
 }
コード例 #2
0
 public static function calcMessJump()
 {
     $resultFile = self::$thisTaskDataPath . 'Pick_MessJump.Table.txt';
     $limiter = 10;
     $stockList = Refer::getStock();
     $stockData = array();
     foreach ($stockList as $stkL) {
         //if (--$limiter < 0 ) break;
         $stkT = array();
         $tdd = new ThsDoctorData($stkL['code']);
         if (!$tdd->prepareData()) {
             continue;
         }
         $ths_2 = $tdd->getLastPeriod(1, true, 2);
         if (!$ths_2) {
             continue;
         }
         //var_dump($ths_2);
         $ths_x = $tdd->getLastPeriod(40, true, 10);
         if (!$ths_x) {
             continue;
         }
         //var_dump($ths_x);
         if ($ths_2[1]['message_score'] - $ths_2[0]['message_score'] <= 0) {
             continue;
         }
         $stkT['name'] = '<a target="_blank" href="' . Url::getBasePhp('Chart') . '?code=' . $stkL['code'] . '">' . '<span class="fore-stock-name">' . $stkL['name'] . '</span>' . '<span class="fore-stock-spell displaynone">' . $stkL['spell'] . '</span></a>';
         $stkT['code'] = '<span class="fore-stock-code">' . $stkL['code'] . '</span>';
         //message_score in yesterday and today
         $stkT['mess_score_yesterday'] = $ths_2[0]['message_score'];
         $stkT['mess_score_today'] = $ths_2[1]['message_score'];
         $stkT['mess_score_change'] = $ths_2[1]['message_score'] - $ths_2[0]['message_score'];
         //message_score in 40 days
         $stkT['mess_score_max_40d'] = LogicOperation::highValue($ths_x, 'message_score');
         $stkT['mess_score_min_40d'] = LogicOperation::lowValue($ths_x, 'message_score');
         $stockData[] = $stkT;
     }
     parent::putTable($resultFile, $stockData);
 }
コード例 #3
0
 public static function calcRange($start, $end, $n)
 {
     $resultFile = self::$thisTaskDataPath . $start . '_' . $end . '_' . $n . '_Good.Table.txt';
     $limiter = 2;
     $stockList = Refer::getStock();
     $stockData = array();
     foreach ($stockList as $stkL) {
         //if (--$limiter < 0 ) break;
         $stkT = array('name' => '', 'code' => '', 'MaxRange' => 0, 'DayNum' => 0);
         $stkT['name'] = '<a target="_blank" href="' . Url::getBasePhp('Chart') . '?code=' . $stkL['code'] . '">' . '<span class="fore-stock-name">' . $stkL['name'] . '</span>' . '<span class="fore-stock-spell displaynone">' . $stkL['spell'] . '</span></a>';
         $stkT['code'] = '<span class="fore-stock-code">' . $stkL['code'] . '</span>';
         $dd = new DayData($stkL['code'], 'before');
         if (!$dd->prepareData()) {
             continue;
         }
         $day = $dd->getDayPeriod($start, $end, $n - 1);
         //var_dump($day);
         if (!$day) {
             continue;
         }
         $MaxRange = -2;
         for ($i = 0; $i < $n / 2; $i++) {
             $daySlice = array_slice($day, $i, $n);
             if (!$daySlice) {
                 continue;
             }
             $dMax = LogicOperation::highValue($daySlice, 'close');
             $dMin = $daySlice[0]['close'];
             $dR = ceil(($dMax - $dMin) / $dMin * 100) / 100;
             $MaxRange = $MaxRange < $dR ? $dR : $MaxRange;
         }
         $stkT['MaxRange'] = $MaxRange;
         $stkT['DayNum'] = sizeof($day);
         $tdd = new ThsDoctorData($stkL['code']);
         $t = $tdd->prepareData() ? $tdd->getDayPeriod($start, $end) : array();
         //message_score
         $stkT['message_score_max'] = LogicOperation::highValue($t, 'message_score');
         $stkT['message_score_min'] = LogicOperation::lowValue($t, 'message_score');
         $stkT['message_score_dis'] = $stkT['message_score_max'] - $stkT['message_score_min'];
         //basic_score
         $stkT['basic_score_max'] = LogicOperation::highValue($t, 'basic_score');
         $stkT['basic_score_min'] = LogicOperation::lowValue($t, 'basic_score');
         //total_score
         $stkT['total_score_max'] = LogicOperation::highValue($t, 'total_score');
         $stkT['total_score_min'] = LogicOperation::lowValue($t, 'total_score');
         //var_dump($stkT);
         $stockData[] = $stkT;
     }
     parent::putTable($resultFile, $stockData);
 }