Commit dc60edee authored by shajiaiming's avatar shajiaiming

new coin tiker

parent 21b6c06c
...@@ -60,17 +60,19 @@ class ExchangeBusiness ...@@ -60,17 +60,19 @@ class ExchangeBusiness
} }
$f = false; $f = false;
$quotation = []; $quotation = [];
if(in_array(strtoupper($tag),['GM', 'BSTC'])){
$exchange = ExchangeFactory::createExchange("Token7");
$quotation = $exchange->getTicker($tag, 'HA');
$quotation['rmb'] = (float)sprintf("%0.2f", $quotation['last']);
return $quotation;
}
foreach (self::$exchanges as $exchange) { foreach (self::$exchanges as $exchange) {
/** /**
* @var $exchange \common\service\exchange\Exchange * @var $exchange \common\service\exchange\Exchange
*/ */
$exchange = ExchangeFactory::createExchange($exchange); $exchange = ExchangeFactory::createExchange($exchange);
if('GM' == $tag || 'BSTC' == $tag){
$quotation = $exchange->getTickerToken7($tag, 'HA');
$f = true;
continue;
}
if ($exchange->symbolExists($tag)) { if ($exchange->symbolExists($tag)) {
$quotation = $exchange->getTicker($tag); $quotation = $exchange->getTicker($tag);
$f = true; $f = true;
...@@ -109,14 +111,11 @@ class ExchangeBusiness ...@@ -109,14 +111,11 @@ class ExchangeBusiness
/** /**
* @var $exchange \common\service\exchange\Exchange * @var $exchange \common\service\exchange\Exchange
*/ */
if('GM' == $tag || 'BSTC' == $tag){
$quotation['rmb'] = (float)sprintf("%0.2f", $quotation['last']); $exchange = ExchangeFactory::createExchange("Bty");
}else{ $rate = $exchange->getTicker("BTY", "USDT");
$exchange = ExchangeFactory::createExchange("Bty"); $rate = (float)$rate['rmb'] / $rate['last'];
$rate = $exchange->getTicker("BTY", "USDT"); $quotation['rmb'] = (float)sprintf("%0.2f", $rate * $quotation['last']);
$rate = (float)$rate['rmb'] / $rate['last'];
$quotation['rmb'] = (float)sprintf("%0.2f", $rate * $quotation['last']);
}
return $quotation; return $quotation;
} }
......
...@@ -81,12 +81,4 @@ abstract class Exchange ...@@ -81,12 +81,4 @@ abstract class Exchange
$values = $this->redis->hvals($this->quotation_prefix . $symbol); $values = $this->redis->hvals($this->quotation_prefix . $symbol);
return array_combine($keys, $values); return array_combine($keys, $values);
} }
public function getTickerToken7($tag = 'BTC', $aim = "USDT")
{
$symbol = $this->formatSymbol($tag, $aim);
$keys = $this->redis->hkeys($this->quotation_prefix . $symbol);
$values = $this->redis->hvals($this->quotation_prefix . $symbol);
return array_combine($keys, $values);
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment