Commit dbac8271 authored by shajiaiming's avatar shajiaiming

add klg ticker

parent 7c1d219d
<?php
/**
* Created by PhpStorm.
* User: rlgyzhcn
* Date: 18-6-27
* Time: 下午12:04
*/
namespace common\business;
......@@ -32,19 +26,17 @@ class ExchangeBusiness
2 => 'Hadax',
3 => 'Bittrex',
4 => 'Zb',
5 => 'Zg',
6 => 'Go',
7 => 'Zhaobi',
8 => 'Binance',
9 => 'Bilaxy',
10 => 'Bitnasdaq',
11 => 'Isummit',
12 => 'Boc',
13 => 'Jinwang',
14 => 'Hd',
15 => 'Ztb',
16 => 'Wbf',
17 => 'Gwa'
5 => 'Go',
6 => 'Zhaobi',
7 => 'Binance',
8 => 'Bilaxy',
9 => 'Bitnasdaq',
10 => 'Isummit',
11 => 'Boc',
12 => 'Jinwang',
13 => 'Ztb',
14 => 'Wbf',
15 => 'Gwa'
//1 => 'Hadax', //不需要
//2 => 'Bitfinex', //不需要
......@@ -59,6 +51,8 @@ class ExchangeBusiness
//6 => 'Token7',//已挂
//10 => 'Ex',//已挂
//12 => 'Tsc',//已挂
//13 => 'Jinwang',//已挂
//14 => 'Hd',//已挂
//16 => 'Dag',//已挂
//17 => 'Coinka',//已挂
];
......@@ -100,139 +94,6 @@ class ExchangeBusiness
goto doEnd;
}
if (strtoupper($tag) == 'USAT') {
$tag = 'USDT';
}
if (strtoupper($tag) == 'DUSDT') {
$quotation = [
'low' => 6.99,
'high' => 6.99,
'last' => 6.99,
'rmb' => 6.99,
];
goto doEnd;
}
if (strtoupper($tag) == 'YPLUS') {
$quotation = [
'low' => 10,
'high' => 10,
'last' => 10,
'rmb' => 10,
];
goto doEnd;
}
if (strtoupper($tag) == 'BOSS') {
$quotation = [
'low' => 2000,
'high' => 2000,
'last' => 2000,
'rmb' => 2000,
];
goto doEnd;
}
if (strtoupper($tag) == 'CPF') {
$quotation = [
'low' => 3.4,
'high' => 3.4,
'last' => 3.4,
'rmb' => 3.4,
];
goto doEnd;
}
if (strtoupper($tag) == 'FZM') {
$quotation = [
'low' => 40,
'high' => 40,
'last' => 40,
'rmb' => 40,
];
goto doEnd;
}
if (strtoupper($tag) == 'POKE') {
$quotation = [
'low' => 0.1621,
'high' => 0.1621,
'last' => 0.1621,
'rmb' => 0.1621,
];
goto doEnd;
}
if (strtoupper($tag) == 'LHG') {
$quotation = [
'low' => 0.105,
'high' => 0.105,
'last' => 0.105,
'rmb' => 0.105,
];
goto doEnd;
}
if (in_array(strtoupper($tag), ['LZ', 'DTM', 'CNNY'])) {
$quotation = [
'low' => 1,
'high' => 1,
'last' => 1,
'rmb' => 1,
];
goto doEnd;
}
// if (strtoupper($tag) == 'ZUE') {
// $quotation = [
// 'low' => 0.1,
// 'high' => 0.1,
// 'last' => 0.1,
// ];
// goto doEnd;
// }
if (in_array(strtoupper($tag), ['SZHB', 'FK'])) {
$quotation = [
'low' => 0.01,
'high' => 0.01,
'last' => 0.01,
'rmb' => 0.01,
];
goto doEnd;
}
if (in_array(strtoupper($tag), ['GST', 'JNTK', 'SPT', 'STO', 'GM', 'BSTC', 'RYH', 'CNDT', 'WL', 'ETS', 'LIMS', 'AT', 'BTJ', 'WXB', 'GFCC', 'TNT'])) {
$quotation = [
'low' => 0,
'high' => 0,
'last' => 0,
'rmb' => 0,
];
goto doEnd;
}
if (in_array($tag, $coin_quotation_disable_items)) {
return false;
}
$f = false;
$quotation = [];
if (in_array(strtoupper($tag), ['LELE', 'ZUE'])) {
if (strtoupper($tag) == 'LELE') {
$exchange = ExchangeFactory::createExchange("Wbf");
$quotation = $exchange->getTicker($tag, 'USDT');
}
if (strtoupper($tag) == 'ZUE') {
$quotation = [
'low' => 0.1,
'high' => 0.1,
'last' => 0.1,
];
}
goto doEnd;
}
if (in_array(strtoupper($tag), ['GLCW'])) {
$exchange = ExchangeFactory::createExchange("Jinwang");
$quotation = $exchange->getTicker($tag, 'USDT');
......@@ -442,9 +303,9 @@ class ExchangeBusiness
goto doEnd;
}
if (in_array(strtoupper($tag), ['GWA'])) {
if (in_array(strtoupper($tag), ['GWA', 'KLG'])) {
$exchange = ExchangeFactory::createExchange("Gwa");
$quotation = $exchange->getTicker('GWA', 'USDT');
$quotation = $exchange->getTicker(strtoupper($tag), 'USDT');
goto doEnd;
}
......
......@@ -12,9 +12,9 @@ use linslin\yii2\curl\Curl;
class Gwa extends Exchange implements ExchangeInterface
{
protected $supported_symbol = 'supported_symbol_gwa';
protected $quotation_prefix = 'quotation_gwa_';
protected $base_url = 'https://api.gwaworld.io/getBalance';
protected $supported_symbol = 'supported_symbol_gwaworld';
protected $quotation_prefix = 'quotation_gwaworld_';
protected $base_url = 'http://154.85.53.6:8001/getTokenBalance';
public function symbolExists($tag = 'GWA', $aim = "USDT")
{
......@@ -56,11 +56,19 @@ class Gwa extends Exchange implements ExchangeInterface
{
$curl = new Curl();
$res = $curl->get($this->base_url, false);
if (is_array($res) && 1 == $res['code']) {
$key = $this->quotation_prefix . 'GWAUSDT';
$this->redis->hmset($key, 'low', $res['data']['currPrice'], 'high', $res['data']['currPrice'], 'last', $res['data']['currPrice'], 'change', $res['data']['range']);
if (!$this->redis->sismember($this->supported_symbol, 'GWAUSDT')) {
$this->redis->sadd($this->supported_symbol, 'GWAUSDT');
if (is_array($res) && isset($res['data'])) {
$data = $res['data']['ticker'];
foreach ($data as $item) {
$key = $this->quotation_prefix . strtoupper($item['symbol']);
$low = isset($item['low']) ? $item['low'] : 0;
$high = isset($item['high']) ? $item['high'] : 0;
$last = isset($item['last']) ? $item['last'] : 0;
$vol = isset($item['vol']) ? $item['vol'] : 0;
$change = isset($item['range']) ? $item['range'] : 0;
$this->redis->hmset($key, 'low', $low, 'high', $high, 'last', $last, 'vol', $vol, 'change', $change);
if (!$this->redis->sismember($this->supported_symbol, strtoupper($item['symbol']))){
$this->redis->sadd($this->supported_symbol, strtoupper($item['symbol']));
}
}
}
}
......
......@@ -14,13 +14,13 @@ use linslin\yii2\curl\Curl;
class GwaBuilder extends FactoryService
{
protected $base_url = 'https://api.gwaworld.io';
protected $supported_symbol = 'supported_symbol_gwa';
protected $supported_symbol_list = 'supported_symbol_gwa_list';
protected $supported_symbol = 'supported_symbol_gwaworld';
protected $supported_symbol_list = 'supported_symbol_gwaworld_list';
protected $supported_symbol_close_asc = 'supported_symbol_close_asc_gwa';
protected $supported_symbol_close_desc = 'supported_symbol_close_desc_gwa';
protected $supported_symbol_change_asc = 'supported_symbol_change_asc_gwa';
protected $supported_symbol_change_desc = 'supported_symbol_change_desc_gwa';
protected $quotation_prefix = 'quotation_gwa_';
protected $quotation_prefix = 'quotation_gwaworld_';
public function getHotTicker($symbol = [])
{
......
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