You are here

function QuantData::dates in Quant 7

Build the date array for charts to fill plotted data on

Parameters

$start: A timestamp representing the day to begin

$steps: The number of steps (days/months) to go back

$interval: A numeric value representing the step size in seconds

$format: The date format to be used in date()

Return value

An array keyed with the date formatted by format. All values are initially set to 0.

2 calls to QuantData::dates()
QuantData::generateDataMultiple in plugins/QuantData.inc
Generate chart data for a multiple data point over a time period
QuantData::generateDataSingle in plugins/QuantData.inc
Generate chart data for a singular data point across a time period

File

plugins/QuantData.inc, line 154

Class

QuantData
QuantData class used to process and format the data returned by the Quant query

Code

function dates($start, $steps, $interval, $format) {
  $dates = array();
  for ($i = 0; $i < $steps; $i++) {
    $dates[date($format, $start)] = 0;
    $start -= $interval;

    // Backtrack a period
  }
  return $dates;
}