本文整理汇总了PHP中Task::putTable方法的典型用法代码示例。如果您正苦于以下问题:PHP Task::putTable方法的具体用法?PHP Task::putTable怎么用?PHP Task::putTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Task
的用法示例。
在下文中一共展示了Task::putTable方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: calcDdeNum
public static function calcDdeNum($start, $end)
{
$resultFile = self::$thisTaskDataPath . $start . '_' . $end . '_DdeNum.Table.txt';
$i = 2;
$stockList = Refer::getStock();
$stockData = array();
foreach ($stockList as $stkL) {
//if (--$i < 0 ) break;
$stkT = array('name' => '', 'code' => '', 'DdxNum' => 0, 'DdxPer' => 0, 'DdzNum' => 0, 'DdzPer' => 0, 'TddzNum' => 0, 'TddzPer' => 0, 'TotalNum' => 0, 'TotalPer' => 0, 'DayNum' => 0);
$stkT['name'] = '<a target="_blank" href="' . Url::getPhpUri('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 DdeData($stkL['code']);
if (!$dd->prepareData()) {
continue;
}
$dde = $dd->getDayPeriod($start, $end, 1);
//var_dump($dde);
if (!$dde) {
continue;
}
foreach ($dde as $d) {
//echo $d['ddx']. '(';
//echo ($d['ddx'] > 0). ')';
if ($d['ddx'] > 0) {
$stkT['DdxNum']++;
}
if ($d['ddz'] > 0) {
$stkT['DdzNum']++;
}
if ($d['tddz'] > 0) {
$stkT['TddzNum']++;
}
}
$stkT['DayNum'] = sizeof($dde);
$stkT['DdxPer'] = ceil($stkT['DdxNum'] / $stkT['DayNum'] * 10000) / 10000;
$stkT['DdzPer'] = ceil($stkT['DdzNum'] / $stkT['DayNum'] * 10000) / 10000;
$stkT['TddzPer'] = ceil($stkT['TddzNum'] / $stkT['DayNum'] * 10000) / 10000;
$stkT['TotalNum'] = $stkT['DdxNum'] + $stkT['TddzNum'] + $stkT['TddzNum'];
$stkT['TotalPer'] = ceil($stkT['TotalNum'] / $stkT['DayNum'] / 3 * 10000) / 10000;
//var_dump($stkT);
$stockData[] = $stkT;
}
parent::putTable($resultFile, $stockData);
}
示例2: calcMessJump
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: calcV2P
public static function calcV2P($start, $end)
{
$resultFile = self::$thisTaskDataPath . $start . '_' . $end . '_Vol2Price.Table.txt';
$limiter = 200;
$stockList = Refer::getStock();
$stockData = array();
foreach ($stockList as $stkL) {
//if (--$limiter < 0 ) break;
$stkT = array();
$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, 3);
if (!$day) {
continue;
}
//var_dump($day);
$s_day = 0;
$s_V2P = 0;
for ($i = 2; $i < count($day); $i++) {
//处理当日涨跌停
$is_zt = ($day[$i]["high"] - $day[$i - 1]["close"]) / $day[$i - 1]["close"];
$is_dt = ($day[$i - 1]["close"] - $day[$i]["low"]) / $day[$i - 1]["close"];
$valid_vol = $day[$i]["volume"] / $day[$i - 1]["volume"];
//涨跌停 并且 量小于0.3 不参与计算
if (($is_zt > 1.09 || $is_dt < 0.9) && $valid_vol < 0.3) {
continue;
}
//处理前日涨跌停
$is_zt = ($day[$i - 1]["high"] - $day[$i - 2]["close"]) / $day[$i - 2]["close"];
$is_dt = ($day[$i - 2]["close"] - $day[$i - 1]["low"]) / $day[$i - 2]["close"];
$valid_vol = $day[$i - 1]["volume"] / $day[$i - 2]["volume"];
//涨跌停 并且 量小于0.3 不参与计算
if (($is_zt > 1.09 || $is_dt < 0.9) && $valid_vol < 0.3) {
continue;
}
//处理量太小不值得计算
$k1 = ($day[$i]["volume"] - $day[$i - 1]["volume"]) / $day[$i - 1]["volume"] * 100;
$k2 = ($day[$i]["volume"] - $day[$i - 2]["volume"]) / $day[$i - 2]["volume"] * 100;
if (abs($k1) < 20 && abs($k2) < 20) {
continue;
}
//计算V2P公式
//计算量相关
$q2 = ($day[$i]["volume"] - $day[$i - 1]["volume"]) / $day[$i - 1]["volume"] * 100;
if ($q2 < -100) {
$q2 = -100;
}
if ($q2 > 100) {
$q2 = 100;
}
//计算价格相关
$chg = $day[$i]["chg"] * 100;
$q1 = $chg;
if ($chg > 60) {
$q1 = 16;
}
if ($chg <= 60 && $chg > 30) {
$q1 = ($chg - 30) / 15 + 13;
}
if ($chg <= 30 && $chg > 10) {
$q1 = ($chg - 10) / 7 + 10;
}
if ($chg < -60) {
$q1 = -16;
}
if ($chg >= -60 && $chg < -30) {
$q1 = ($chg + 30) / 15 - 13;
}
if ($chg >= -30 && $chg < -10) {
$q1 = ($chg + 10) / 7 - 10;
}
$q1 = $q1 > 0 ? ceil($q1 + 100) : ceil($q1 - 100);
$V2P = $q1 * $q2;
if ($chg <= 10 && $chg >= -10) {
$V2P = abs(110 * $q2);
}
// 统计
$s_day++;
$s_V2P += $V2P;
}
$stkT['Vol2Price'] = $s_day ? ceil($s_V2P / $s_day) : 0;
$stkT['ValidDayNum'] = $s_day;
$stkT['TotalDayNum'] = count($day);
$stockData[] = $stkT;
}
parent::putTable($resultFile, $stockData);
}
示例4: calcRange
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);
}
示例5: addInfo
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);
}