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
f277951d
Commit
f277951d
authored
Nov 13, 2020
by
shajiaiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/ticker' into 'master'
zyc ticker See merge request
!407
parents
d6dc17e9
c312d6ce
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 @
f277951d
...
@@ -26,23 +26,24 @@ class ExchangeBusiness
...
@@ -26,23 +26,24 @@ class ExchangeBusiness
* @var array
* @var array
*/
*/
private
static
$exchanges
=
[
private
static
$exchanges
=
[
0
=>
'Bty'
,
// 0 => 'Bty',
#1 => 'HuoBi',
// #1 => 'HuoBi',
1
=>
'Wbf'
,
// 1 => 'Wbf',
2
=>
'Hadax'
,
// 2 => 'Hadax',
3
=>
'Bitfinex'
,
// 3 => 'Bitfinex',
4
=>
'Bittrex'
,
// 4 => 'Bittrex',
5
=>
'Zb'
,
// 5 => 'Zb',
6
=>
'Zg'
,
// 6 => 'Zg',
7
=>
'Go'
,
// 7 => 'Go',
8
=>
'Zhaobi'
,
// 8 => 'Zhaobi',
9
=>
'Binance'
,
// 9 => 'Binance',
10
=>
'Bilaxy'
,
// 10 => 'Bilaxy',
11
=>
'Bitnasdaq'
,
// 11 => 'Bitnasdaq',
12
=>
'Isummit'
,
// 12 => 'Isummit',
13
=>
'Boc'
,
// 13 => 'Boc',
14
=>
'Jinwang'
,
// 14 => 'Jinwang',
15
=>
'Hd'
// 15 => 'Hd',
16
=>
'Ztb'
//1 => 'Hadax', //不需要
//1 => 'Hadax', //不需要
//2 => 'Bitfinex', //不需要
//2 => 'Bitfinex', //不需要
...
@@ -54,12 +55,11 @@ class ExchangeBusiness
...
@@ -54,12 +55,11 @@ class ExchangeBusiness
//7 => 'Gdpro',//已挂
//7 => 'Gdpro',//已挂
//8 => 'Ceohk', //已挂
//8 => 'Ceohk', //已挂
//14 => 'Biki',//已挂
//14 => 'Biki',//已挂
// 6 => 'Token7',//已挂
//6 => 'Token7',//已挂
// 10 => 'Ex',//已挂
//10 => 'Ex',//已挂
// 11 => 'Zt',//已挂
//12 => 'Tsc',//已挂
// 12 => 'Tsc',//已挂
//16 => 'Dag',//已挂
// 16 => 'Dag',//已挂
//17 => 'Coinka',//已挂
// 17 => 'Coinka',//已挂
];
];
/**
/**
...
@@ -275,9 +275,9 @@ class ExchangeBusiness
...
@@ -275,9 +275,9 @@ class ExchangeBusiness
goto
doEnd
;
goto
doEnd
;
}
}
if
(
in_array
(
strtoupper
(
$tag
),
[
'CIC'
]))
{
if
(
in_array
(
strtoupper
(
$tag
),
[
'CIC'
,
'ZYC'
]))
{
$exchange
=
ExchangeFactory
::
createExchange
(
"Zt"
);
$exchange
=
ExchangeFactory
::
createExchange
(
"Zt
b
"
);
$quotation
=
$exchange
->
getTicker
(
'CIC'
,
'USDT'
);
$quotation
=
$exchange
->
getTicker
(
strtoupper
(
$tag
)
,
'USDT'
);
goto
doEnd
;
goto
doEnd
;
}
}
...
@@ -404,7 +404,7 @@ class ExchangeBusiness
...
@@ -404,7 +404,7 @@ class ExchangeBusiness
$exchange
=
ExchangeFactory
::
createExchange
(
"Go"
);
$exchange
=
ExchangeFactory
::
createExchange
(
"Go"
);
$rate
=
$exchange
->
getTicker
(
"CNY"
,
"USD"
);
$rate
=
$exchange
->
getTicker
(
"CNY"
,
"USD"
);
$cny_usd_rate
=
1
/
$rate
[
'last'
];
$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
[
'usd'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$quotation
[
'last'
]);
$quotation
[
'rmb'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$quotation
[
'last'
]
/
$cny_usd_rate
);
$quotation
[
'rmb'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$quotation
[
'last'
]
/
$cny_usd_rate
);
$quotation
[
'low'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$quotation
[
'low'
]);
$quotation
[
'low'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$quotation
[
'low'
]);
...
...
common/service/exchange/Zt.php
→
common/service/exchange/Zt
b
.php
View file @
f277951d
...
@@ -10,14 +10,14 @@ namespace common\service\exchange;
...
@@ -10,14 +10,14 @@ namespace common\service\exchange;
use
linslin\yii2\curl\Curl
;
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
$supported_symbol
=
'supported_symbol_zt'
;
protected
$quotation_prefix
=
'quotation_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
);
$supported
=
$this
->
redis
->
smembers
(
$this
->
supported_symbol
);
if
(
is_array
(
$supported
)
&&
in_array
(
$this
->
formatSymbol
(
$tag
,
$aim
),
$supported
))
{
if
(
is_array
(
$supported
)
&&
in_array
(
$this
->
formatSymbol
(
$tag
,
$aim
),
$supported
))
{
...
@@ -32,7 +32,7 @@ class Zt extends Exchange implements ExchangeInterface
...
@@ -32,7 +32,7 @@ class Zt extends Exchange implements ExchangeInterface
* @param string $aim
* @param string $aim
* @return mixed
* @return mixed
*/
*/
public
function
formatSymbol
(
$tag
=
'
CI
C'
,
$aim
=
'USDT'
)
public
function
formatSymbol
(
$tag
=
'
ZY
C'
,
$aim
=
'USDT'
)
{
{
return
strtoupper
(
$tag
.
'_'
.
$aim
);
return
strtoupper
(
$tag
.
'_'
.
$aim
);
}
}
...
@@ -44,7 +44,7 @@ class Zt extends Exchange implements ExchangeInterface
...
@@ -44,7 +44,7 @@ class Zt extends Exchange implements ExchangeInterface
*/
*/
public
function
setSupportedSymbol
()
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
...
@@ -59,7 +59,7 @@ class Zt extends Exchange implements ExchangeInterface
if
(
is_array
(
$content
)
&&
isset
(
$content
[
'ticker'
]))
{
if
(
is_array
(
$content
)
&&
isset
(
$content
[
'ticker'
]))
{
$data
=
$content
[
'ticker'
];
$data
=
$content
[
'ticker'
];
foreach
(
$data
as
$item
)
{
foreach
(
$data
as
$item
)
{
if
(
in_array
(
$item
[
'symbol'
],
[
'
CI
C_USDT'
]))
{
if
(
in_array
(
$item
[
'symbol'
],
[
'
ZY
C_USDT'
]))
{
$data
=
$item
;
$data
=
$item
;
$key
=
$this
->
quotation_prefix
.
$item
[
'symbol'
];
$key
=
$this
->
quotation_prefix
.
$item
[
'symbol'
];
$this
->
redis
->
hmset
(
$key
,
'low'
,
$data
[
'low'
],
'high'
,
$data
[
'high'
],
'last'
,
$data
[
'last'
]);
$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