Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
token
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wallet
token
Commits
c312d6ce
Commit
c312d6ce
authored
Nov 13, 2020
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
zyc ticker
parent
d6dc17e9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
33 deletions
+33
-33
ExchangeBusiness.php
common/business/ExchangeBusiness.php
+27
-27
Ztb.php
common/service/exchange/Ztb.php
+6
-6
No files found.
common/business/ExchangeBusiness.php
View file @
c312d6ce
...
...
@@ -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
(
"Zt
b
"
);
$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'
]);
...
...
common/service/exchange/Zt.php
→
common/service/exchange/Zt
b
.php
View file @
c312d6ce
...
...
@@ -10,14 +10,14 @@ namespace common\service\exchange;
use
linslin\yii2\curl\Curl
;
class
Zt
extends
Exchange
implements
ExchangeInterface
class
Zt
b
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.zt
b
.com/api/v1/tickers'
;
public
function
symbolExists
(
$tag
=
'
CI
C'
,
$aim
=
"USDT"
)
public
function
symbolExists
(
$tag
=
'
ZY
C'
,
$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
=
'
CI
C'
,
$aim
=
'USDT'
)
public
function
formatSymbol
(
$tag
=
'
ZY
C'
,
$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
,
'
CIC
USDT'
);
$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'
],
[
'
CI
C_USDT'
]))
{
if
(
in_array
(
$item
[
'symbol'
],
[
'
ZY
C_USDT'
]))
{
$data
=
$item
;
$key
=
$this
->
quotation_prefix
.
$item
[
'symbol'
];
$this
->
redis
->
hmset
(
$key
,
'low'
,
$data
[
'low'
],
'high'
,
$data
[
'high'
],
'last'
,
$data
[
'last'
]);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment