case 'highcharts': $dataorg = "highchart"; break; default: $dataorg = "json"; break; } debug_print("data organization: " . $dataorg . "<Br/>"); } else { $dataorg = "json"; } //select the time range of the company if (isset($_GET['timerange']) || $isCmd) { $tempTime = isset($_GET['timerange']) ? $_GET['timerange'] : $cmdTimerange; //$tempTime = $_GET['timerange']; getTimeRange($tempTime); } else { debug_print("alternative date setting...<Br>"); if (isset($_GET['start'])) { $fromDate = $_GET['start']; } else { //default start date is 2 weeks or 15 days ago $fromDate = date_create(date("Y-m-d")); date_sub($fromDate, date_interval_create_from_date_string("15 days")); $fromDate = date_format($fromDate, "Y-m-d"); } if (isset($_GET['end'])) { $toDate = $_GET['end']; } else { //default end date is current date $toDate = date_format(date_create(date("Y-m-d")), "Y-m-d");
$toDate = date_create(date("Y-m-d")); $fromDate = date_create(date("Y-m-d")); date_sub($fromDate, date_interval_create_from_date_string($deltaTime)); $fromDate = date_format($fromDate, "Y-m-d"); $toDate = date_format($toDate, "Y-m-d"); } function getDateDiffFromPresent($signalDate) { $now = time(); // or your date as well $your_date = strtotime($signalDate); $datediff = $now - $your_date; return floor($datediff / (60 * 60 * 24)); } //get the time range getTimeRange($delta); //generate stock quotes $companyList = readStockQuotes($mysql_host, $mysql_database, $mysql_user, $mysql_password); //echo json_encode($companyList) . "<Br><Br>"; $latestSignals = []; $ctr = 0; foreach ($companyList as $company) { // echo "$company:<Br>"; $latest = 0; switch ($type) { case "smac": // echo " smac<Br>"; $latest = getSMACombined($company, $fromDate, $toDate, $dataorg, 20, 50, 120, $ensig, $mysql_host, $mysql_database, $mysql_user, $mysql_password); break; case "bb3": // echo " bb3<Br>";