Commit dc60edee authored by shajiaiming's avatar shajiaiming

new coin tiker

parent 21b6c06c
......@@ -60,17 +60,19 @@ class ExchangeBusiness
}
$f = false;
$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) {
/**
* @var $exchange \common\service\exchange\Exchange
*/
$exchange = ExchangeFactory::createExchange($exchange);
if('GM' == $tag || 'BSTC' == $tag){
$quotation = $exchange->getTickerToken7($tag, 'HA');
$f = true;
continue;
}
if ($exchange->symbolExists($tag)) {
$quotation = $exchange->getTicker($tag);
$f = true;
......@@ -109,14 +111,11 @@ class ExchangeBusiness
/**
* @var $exchange \common\service\exchange\Exchange
*/
if('GM' == $tag || 'BSTC' == $tag){
$quotation['rmb'] = (float)sprintf("%0.2f", $quotation['last']);
}else{
$exchange = ExchangeFactory::createExchange("Bty");
$rate = $exchange->getTicker("BTY", "USDT");
$rate = (float)$rate['rmb'] / $rate['last'];
$quotation['rmb'] = (float)sprintf("%0.2f", $rate * $quotation['last']);
}
$exchange = ExchangeFactory::createExchange("Bty");
$rate = $exchange->getTicker("BTY", "USDT");
$rate = (float)$rate['rmb'] / $rate['last'];
$quotation['rmb'] = (float)sprintf("%0.2f", $rate * $quotation['last']);
return $quotation;
}
......
......@@ -81,12 +81,4 @@ abstract class Exchange
$values = $this->redis->hvals($this->quotation_prefix . $symbol);
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