示例#1
0
 public function actionSell()
 {
     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);
     }
     $buy = Buy::model()->findByPk(1);
     $bot->startSell($buy, array('test' => 'test'));
 }