Commit 646e732c authored by shajiaiming's avatar shajiaiming

test

parent b0d6b746
...@@ -114,6 +114,12 @@ class BinanceBuilder extends FactoryService ...@@ -114,6 +114,12 @@ class BinanceBuilder extends FactoryService
$temp = []; $temp = [];
$temp['symbol'] = strtoupper($symbol); $temp['symbol'] = strtoupper($symbol);
$temp['close'] = $close; $temp['close'] = $close;
foreach ($this->basic_coin as $k => $coin) {
$explode_arr = explode(strtoupper($coin), strtoupper($symbol));
if (2 == count($explode_arr) && empty($explode_arr[1])) {
$temp['close_rmb'] = (float)sprintf("%0.4f", $close * $this->basic_price[$coin]['rmb']);
}
}
$temp['low'] = $low; $temp['low'] = $low;
$temp['high'] = $high; $temp['high'] = $high;
$temp['open'] = $open; $temp['open'] = $open;
...@@ -124,7 +130,7 @@ class BinanceBuilder extends FactoryService ...@@ -124,7 +130,7 @@ class BinanceBuilder extends FactoryService
$this->redis_ticker->hmset($key, 'low', $low, 'high', $high, 'last', $close, 'open', $open, 'vol', $vol); $this->redis_ticker->hmset($key, 'low', $low, 'high', $high, 'last', $close, 'open', $open, 'vol', $vol);
} }
$ticker_sort_close = Tools::arraySort($ticker, 'close'); $ticker_sort_close = Tools::arraySort($ticker, 'close_rmb');
$this->redis_ticker->del($this->supported_symbol_close_asc); $this->redis_ticker->del($this->supported_symbol_close_asc);
$this->redis_ticker->del($this->supported_symbol_close_desc); $this->redis_ticker->del($this->supported_symbol_close_desc);
foreach ($ticker_sort_close as $val) { foreach ($ticker_sort_close as $val) {
......
...@@ -135,6 +135,12 @@ class HuobiBuilder extends FactoryService ...@@ -135,6 +135,12 @@ class HuobiBuilder extends FactoryService
$temp = []; $temp = [];
$temp['symbol'] = strtoupper($symbol); $temp['symbol'] = strtoupper($symbol);
$temp['close'] = $close; $temp['close'] = $close;
foreach ($this->basic_coin as $k => $coin) {
$explode_arr = explode(strtoupper($coin), strtoupper($symbol));
if (2 == count($explode_arr) && empty($explode_arr[1])) {
$temp['close_rmb'] = (float)sprintf("%0.4f", $close * $this->basic_price[$coin]['rmb']);
}
}
$temp['low'] = $low; $temp['low'] = $low;
$temp['high'] = $high; $temp['high'] = $high;
$temp['open'] = $open; $temp['open'] = $open;
...@@ -145,7 +151,7 @@ class HuobiBuilder extends FactoryService ...@@ -145,7 +151,7 @@ class HuobiBuilder extends FactoryService
$this->redis_ticker->hmset($key, 'low', $low, 'high', $high, 'last', $close, 'open', $open, 'vol', $vol); $this->redis_ticker->hmset($key, 'low', $low, 'high', $high, 'last', $close, 'open', $open, 'vol', $vol);
} }
$ticker_sort_close = Tools::arraySort($ticker, 'close'); $ticker_sort_close = Tools::arraySort($ticker, 'close_rmb');
$this->redis_ticker->del($this->supported_symbol_close_asc); $this->redis_ticker->del($this->supported_symbol_close_asc);
$this->redis_ticker->del($this->supported_symbol_close_desc); $this->redis_ticker->del($this->supported_symbol_close_desc);
foreach ($ticker_sort_close as $val) { foreach ($ticker_sort_close as $val) {
......
...@@ -103,13 +103,19 @@ class ZhaobiBuilder extends FactoryService ...@@ -103,13 +103,19 @@ class ZhaobiBuilder extends FactoryService
$temp = []; $temp = [];
$temp['symbol'] = strtoupper($symbol); $temp['symbol'] = strtoupper($symbol);
$temp['close'] = number_format($close, 6, '.', ''); $temp['close'] = number_format($close, 6, '.', '');
foreach ($this->basic_coin as $k => $coin) {
$explode_arr = explode(strtoupper($coin), strtoupper($symbol));
if (2 == count($explode_arr) && empty($explode_arr[1])) {
$temp['close_rmb'] = (float)sprintf("%0.4f", $close * $this->basic_price[$coin]['rmb']);
}
}
$temp['change'] = (0 == $open) ? 0 : (float)sprintf("%0.2f", ($close - $open) / $open * 100); $temp['change'] = (0 == $open) ? 0 : (float)sprintf("%0.2f", ($close - $open) / $open * 100);
array_push($ticker, $temp); array_push($ticker, $temp);
$key = $this->quotation_prefix . strtoupper($symbol); $key = $this->quotation_prefix . strtoupper($symbol);
$this->redis_ticker->hmset($key, 'low', $low, 'high', $high, 'last', $close, 'open', $open, 'vol', $vol); $this->redis_ticker->hmset($key, 'low', $low, 'high', $high, 'last', $close, 'open', $open, 'vol', $vol);
} }
$ticker_sort_close = Tools::arraySort($ticker, 'close'); $ticker_sort_close = Tools::arraySort($ticker, 'close_rmb');
$this->redis_ticker->del($this->supported_symbol_close_asc); $this->redis_ticker->del($this->supported_symbol_close_asc);
$this->redis_ticker->del($this->supported_symbol_close_desc); $this->redis_ticker->del($this->supported_symbol_close_desc);
foreach ($ticker_sort_close as $val) { foreach ($ticker_sort_close as $val) {
......
...@@ -14,7 +14,7 @@ class TickerController extends Controller ...@@ -14,7 +14,7 @@ class TickerController extends Controller
{ {
public function actionSort() public function actionSort()
{ {
$class = ['Binance', 'Huobi', 'Zhaobi']; $class = ['Huobi'];
foreach ($class as $val) { foreach ($class as $val) {
go(function () use ($val) { go(function () use ($val) {
\Co::sleep(0.5); \Co::sleep(0.5);
......
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