Commit c312d6ce authored by shajiaiming's avatar shajiaiming

zyc ticker

parent d6dc17e9
......@@ -26,23 +26,24 @@ class ExchangeBusiness
* @var array
*/
private static $exchanges = [
0 => 'Bty',
#1 => 'HuoBi',
1 => 'Wbf',
2 => 'Hadax',
3 => 'Bitfinex',
4 => 'Bittrex',
5 => 'Zb',
6 => 'Zg',
7 => 'Go',
8 => 'Zhaobi',
9 => 'Binance',
10 => 'Bilaxy',
11 => 'Bitnasdaq',
12 => 'Isummit',
13 => 'Boc',
14 => 'Jinwang',
15 => 'Hd'
// 0 => 'Bty',
// #1 => 'HuoBi',
// 1 => 'Wbf',
// 2 => 'Hadax',
// 3 => 'Bitfinex',
// 4 => 'Bittrex',
// 5 => 'Zb',
// 6 => 'Zg',
// 7 => 'Go',
// 8 => 'Zhaobi',
// 9 => 'Binance',
// 10 => 'Bilaxy',
// 11 => 'Bitnasdaq',
// 12 => 'Isummit',
// 13 => 'Boc',
// 14 => 'Jinwang',
// 15 => 'Hd',
16 => 'Ztb'
//1 => 'Hadax', //不需要
//2 => 'Bitfinex', //不需要
......@@ -54,12 +55,11 @@ class ExchangeBusiness
//7 => 'Gdpro',//已挂
//8 => 'Ceohk', //已挂
//14 => 'Biki',//已挂
// 6 => 'Token7',//已挂
// 10 => 'Ex',//已挂
// 11 => 'Zt',//已挂
// 12 => 'Tsc',//已挂
// 16 => 'Dag',//已挂
// 17 => 'Coinka',//已挂
//6 => 'Token7',//已挂
//10 => 'Ex',//已挂
//12 => 'Tsc',//已挂
//16 => 'Dag',//已挂
//17 => 'Coinka',//已挂
];
/**
......@@ -275,9 +275,9 @@ class ExchangeBusiness
goto doEnd;
}
if (in_array(strtoupper($tag), ['CIC'])) {
$exchange = ExchangeFactory::createExchange("Zt");
$quotation = $exchange->getTicker('CIC', 'USDT');
if (in_array(strtoupper($tag), ['CIC', 'ZYC'])) {
$exchange = ExchangeFactory::createExchange("Ztb");
$quotation = $exchange->getTicker(strtoupper($tag), 'USDT');
goto doEnd;
}
......@@ -404,7 +404,7 @@ class ExchangeBusiness
$exchange = ExchangeFactory::createExchange("Go");
$rate = $exchange->getTicker("CNY", "USD");
$cny_usd_rate = 1 / $rate['last'];
if (in_array(strtoupper($tag), ['FOLI', 'CIC', 'KPC8', 'BVA', 'DAG', 'BNC', 'GHP', 'DRA', 'ETC', 'PAX', 'STH', 'XJH', 'SFT', 'TSC', 'SUM', 'USDW', 'FUT', 'MBTC', 'METH', 'GLCW', 'HDC'])) {
if (in_array(strtoupper($tag), ['FOLI', 'CIC', 'ZYC', 'KPC8', 'BVA', 'DAG', 'BNC', 'GHP', 'DRA', 'ETC', 'PAX', 'STH', 'XJH', 'SFT', 'TSC', 'SUM', 'USDW', 'FUT', 'MBTC', 'METH', 'GLCW', 'HDC'])) {
$quotation['usd'] = (float)sprintf("%0.4f", $quotation['last']);
$quotation['rmb'] = (float)sprintf("%0.4f", $quotation['last'] / $cny_usd_rate);
$quotation['low'] = (float)sprintf("%0.4f", $quotation['low']);
......
......@@ -10,14 +10,14 @@ namespace common\service\exchange;
use linslin\yii2\curl\Curl;
class Zt extends Exchange implements ExchangeInterface
class Ztb extends Exchange implements ExchangeInterface
{
protected $supported_symbol = 'supported_symbol_zt';
protected $quotation_prefix = 'quotation_zt_';
protected $base_url = 'https://www.zt.com/api/v1/tickers';
protected $base_url = 'https://www.ztb.com/api/v1/tickers';
public function symbolExists($tag = 'CIC', $aim = "USDT")
public function symbolExists($tag = 'ZYC', $aim = "USDT")
{
$supported = $this->redis->smembers($this->supported_symbol);
if (is_array($supported) && in_array($this->formatSymbol($tag, $aim), $supported)) {
......@@ -32,7 +32,7 @@ class Zt extends Exchange implements ExchangeInterface
* @param string $aim
* @return mixed
*/
public function formatSymbol($tag = 'CIC', $aim = 'USDT')
public function formatSymbol($tag = 'ZYC', $aim = 'USDT')
{
return strtoupper($tag .'_'. $aim);
}
......@@ -44,7 +44,7 @@ class Zt extends Exchange implements ExchangeInterface
*/
public function setSupportedSymbol()
{
$this->redis->sadd($this->supported_symbol, 'CICUSDT');
$this->redis->sadd($this->supported_symbol, 'ZYC_USDT');
}
/**
......@@ -59,7 +59,7 @@ class Zt extends Exchange implements ExchangeInterface
if (is_array($content) && isset($content['ticker'])) {
$data = $content['ticker'];
foreach ($data as $item) {
if (in_array($item['symbol'], ['CIC_USDT'])) {
if (in_array($item['symbol'], ['ZYC_USDT'])) {
$data = $item;
$key = $this->quotation_prefix . $item['symbol'];
$this->redis->hmset($key, 'low', $data['low'], 'high', $data['high'], 'last', $data['last']);
......
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