Ejemplo n.º 1
0
 function StatsHistory($trade, $start, $end, $regex_replace)
 {
     $this->trade = $trade;
     $this->history_file = empty($trade) ? DIR_DATA . '/history' : (is_system_trade($trade) ? DIR_SYSTEM_STATS : DIR_TRADE_STATS) . "/{$trade}-history";
     $this->_read_stats($start, $end, $regex_replace);
 }
Ejemplo n.º 2
0
function trade_reset($trades)
{
    require_once 'dirdb.php';
    if (!is_array($trades)) {
        $trades = array($trades);
    }
    foreach ($trades as $trade) {
        $is_sys_trade = is_system_trade($trade);
        $dir = $is_sys_trade ? DIR_SYSTEM_STATS : DIR_TRADE_STATS;
        // Clear stats file
        $packed_record = trade_packed_record();
        $fp = fopen("{$dir}/{$trade}", 'w');
        for ($i = 0; $i < HOURS_PER_DAY + MINUTES_PER_DAY; $i++) {
            fwrite($fp, $packed_record, RECORD_SIZE_STATS);
        }
        fclose($fp);
        @chmod("{$dir}/{$trade}", 0666);
        // Clear log files
        file_write("{$dir}/{$trade}-clicks");
        file_write("{$dir}/{$trade}-history");
        file_write("{$dir}/{$trade}-in");
        file_write("{$dir}/{$trade}-out");
        // Reset the autostop timestamp
        if (!$is_sys_trade) {
            $db = new TradeDB();
            $db->Update($trade, array('timestamp_autostop' => time()));
        }
    }
}