本文整理汇总了PHP中Status::setParam方法的典型用法代码示例。如果您正苦于以下问题:PHP Status::setParam方法的具体用法?PHP Status::setParam怎么用?PHP Status::setParam使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Status
的用法示例。
在下文中一共展示了Status::setParam方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionTest
public function actionTest()
{
$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());
// Тест на 10 000 руб.
Status::setParam('balance', 10000);
Status::setParam('balance_btc', 0);
$exs = Exchange::getAllByDt('btc_rur', '2013-12-16', '2014-01-06');
$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>Elapsed time: ' . ($end - $start) / 60 . ' min.<br/>';
echo '<b>Steps count: ' . $cnt . '<br/>';
}
示例2: runTest
/**
* Протестировать бота на старых данных
*/
public function runTest()
{
// Получаем статистику за период
$period_from = date('Y-m-d H:i:s', time() - $this->analize_period);
$exdata = Exchange::getDataFrom($period_from);
// Получаем данные биржи
//$this->balance = 1000;
//$exdata = Exchange::getTestData();
Log::Add(0, 'ПОКУПАЕМ: ');
$this->AnalizeBuy($exdata);
Log::Add(0, 'ПРОДАЕМ: ');
$this->AnalizeSell($exdata);
Status::setParam('balance', $this->balance);
Status::setParam('balance_btc', $this->balance_btc);
if ($this->order_cnt > 0) {
Log::Add(0, 'Баланс (руб.): ' . $this->balance, 1);
Log::Add(0, 'Всего заработано: ' . $this->total_income, 1);
Log::Add(0, 'Остаток btc: ' . round($this->balance_btc, 5), 1);
}
}
示例3: actionOrders
public function actionOrders()
{
if ($_SERVER['HTTP_HOST'] !== 'btcbot.loc') {
return;
}
$btc_rur = Exchange::updatePrices('btc_rur');
$bot = new Bot($btc_rur);
$info = $bot->api->getInfo();
if ($info) {
$bot->setBalance($info['funds']['rur']);
$bot->setBalanceBtc($info['funds']['btc']);
Status::setParam('balance', $info['funds']['rur']);
Status::setParam('balance_btc', $info['funds']['btc']);
Balance::actualize('rur', $bot->balance);
Balance::actualize('btc', $bot->balance_btc);
}
$bot->checkOrders();
}
示例4: run
public function run()
{
$info = $this->api->getInfo();
$start_balance = 0;
$start_balance_btc = 0;
if ($info) {
$this->balance = $info['funds']['rur'];
$this->balance_btc = $info['funds']['btc'];
Status::setParam('balance', $info['funds']['rur']);
Status::setParam('balance_btc', $info['funds']['btc']);
$start_balance = $this->balance;
$start_balance_btc = $this->balance_btc;
Balance::actualize('rur', $this->balance);
Balance::actualize('btc', $this->balance_btc);
}
$this->tomail = array();
$this->NeedBuy();
$this->NeedSell();
$this->checkOrders();
if (sizeof($this->tomail) > 0) {
$this->sendMail();
}
Status::setParam('balance', $this->balance);
Status::setParam('balance_btc', $this->balance_btc);
if ($this->order_cnt > 0) {
Log::Add('Баланс на начало');
Log::Add('Руб: ' . $start_balance, 1);
Log::Add('Btc: ' . $start_balance_btc, 1);
Log::Add('Баланс на конец');
Log::Add('Руб: ' . $this->balance, 1);
Log::Add('Btc: ' . $this->balance_btc, 1);
Log::Add('Всего заработано: ' . $this->total_income, 1);
}
}