public function actionRun() { // Пересчитываем рейтинги $key = 'cron.bot.run.btc_rur'; if (Yii::app()->cache->get($key) === false) { Yii::app()->cache->set($key, true, 60 * 3); // Запускаем бота для анализа и сделок $btc_rur = Exchange::updatePrices('btc_rur'); $bot = new Bot($btc_rur); $bot->run(); } }
public function actionTest() { if ($_SERVER['HTTP_HOST'] !== 'btcbot.loc') { return; } $start = time(); Yii::app()->cache->flush(); Yii::app()->db->createCommand()->truncateTable(Buy::model()->tableName()); Yii::app()->db->createCommand()->truncateTable(Sell::model()->tableName()); Yii::app()->db->createCommand()->truncateTable(Order::model()->tableName()); Yii::app()->db->createCommand()->truncateTable(Balance::model()->tableName()); Status::setParam('balance', 5000); Status::setParam('balance_btc', 0); $exs = Exchange::getAll(); $cnt = 0; foreach ($exs as $exchange) { $obj = new stdClass(); $obj->dtm = $exchange['dt']; $obj->buy = $exchange['buy']; $obj->sell = $exchange['sell']; $cnt++; $bot = new Bot($obj); $bot->run(); } $end = time(); echo '<b>Время выполнения: ' . ($end - $start) / 60 . ' мин.<br/>'; echo '<b>Сделано шагов: ' . $cnt . '<br/>'; //$this->render('index'); }
<?php // configure cron tu run every 10 minutes require "src/init.php"; // actualizar base de datos con listado de frases update_quotes_into_database(QUOTES_PATH); // run bot $bot = new Bot(); $bot->run(); // Marketing: // - social networks: twitter, facebook, pinterest, google+ // - blog /* fuentes de visitas: social networks: twitter, facebook, pinterest, google+, listas de correo sitios con alto page rank: buscar sitios con PR que acepten comentarios diarios: elcomercio.pe, */