Commit 6be90f32 authored by shajiaiming's avatar shajiaiming

小数点后变4位

parent 8b56be53
......@@ -90,42 +90,42 @@ class ExchangeBusiness
if(in_array(strtoupper($tag),['GM', 'BSTC'])){
$exchange = ExchangeFactory::createExchange("Token7");
$quotation = $exchange->getTicker($tag, 'HA');
$quotation['rmb'] = (float)sprintf("%0.4f", $quotation['last']);
$quotation['rmb'] = (float)sprintf("%0.2f", $quotation['last']);
return $quotation;
}
if(in_array(strtoupper($tag),['BECC'])){
$exchange = ExchangeFactory::createExchange("S");
$quotation = $exchange->getTicker($tag, 'ST');
$quotation['rmb'] = (float)sprintf("%0.4f", $quotation['last']);
$quotation['rmb'] = (float)sprintf("%0.2f", $quotation['last']);
return $quotation;
}
if(in_array(strtoupper($tag),['GHP'])){
$exchange = ExchangeFactory::createExchange("Zg");
$quotation = $exchange->getTicker($tag, 'CNZ');
$quotation['rmb'] = (float)sprintf("%0.4f", $quotation['last']);
$quotation['rmb'] = (float)sprintf("%0.2f", $quotation['last']);
return $quotation;
}
if(in_array(strtoupper($tag),['SFT'])){
$exchange = ExchangeFactory::createExchange("Zhaobi");
$quotation = $exchange->getTicker($tag, 'CNY');
$quotation['rmb'] = (float)sprintf("%0.4f", $quotation['last']);
$quotation['rmb'] = (float)sprintf("%0.2f", $quotation['last']);
return $quotation;
}
if(in_array(strtoupper($tag),['CTG'])){
$exchange = ExchangeFactory::createExchange("Gdpro");
$quotation = $exchange->getTicker($tag, 'CNY');
$quotation['rmb'] = (float)sprintf("%0.4f", $quotation['last']);
$quotation['rmb'] = (float)sprintf("%0.2f", $quotation['last']);
return $quotation;
}
if(in_array(strtoupper($tag),['USDT'])){
$exchange = ExchangeFactory::createExchange("Go");
$quotation = $exchange->getTicker('CNY', 'USD');
$quotation['rmb'] = (float)sprintf("%0.4f", $quotation['last']);
$quotation['rmb'] = (float)sprintf("%0.2f", $quotation['last']);
return $quotation;
}
......
......@@ -66,7 +66,7 @@ class CoinService extends Coin implements CoinInterface
*/
public function setPrice($price)
{
$this->price = (float)sprintf("%0.4f", $price);
$this->price = (float)sprintf("%0.2f", $price);
}
/**
......@@ -155,7 +155,7 @@ class CoinService extends Coin implements CoinInterface
*/
public function setHigh($high)
{
$this->high = (float)sprintf("%0.4f", $high / 6.6);
$this->high = (float)sprintf("%0.2f", $high / 6.6);
}
/**
......@@ -184,7 +184,7 @@ class CoinService extends Coin implements CoinInterface
*/
public function setLow($low)
{
$this->low = (float)sprintf("%0.4f", $low / 6.6);
$this->low = (float)sprintf("%0.2f", $low / 6.6);
}
/**
......
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