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
3dfad114
Commit
3dfad114
authored
6 years ago
by
rlgy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
z网api
parent
03e87e57
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
0 deletions
+47
-0
Zb.php
common/service/exchange/Zb.php
+47
-0
No files found.
common/service/exchange/Zb.php
0 → 100644
View file @
3dfad114
<?php
/**
* Created by PhpStorm.
* User: rlgyzhcn
* Date: 18-6-28
* Time: 上午10:08
*/
namespace
common\service\exchange
;
class
Zb
extends
Exchange
implements
ExchangeInterface
{
protected
$supported_symbol
=
'supported_symbol_zb'
;
protected
$quotation_prefix
=
'quotation_zb_'
;
public
function
formatSymbol
(
$tag
=
'BTC'
,
$aim
=
'USDT'
)
{
return
strtolower
(
trim
(
$tag
)
.
'_'
.
trim
(
$aim
));
}
public
function
setSupportedSymbol
()
{
$api
=
"http://api.zb.com/data/v1/markets"
;
$rev
=
$this
->
ch
->
get
(
$api
,
false
);
if
(
$rev
)
{
$keys
=
array_keys
(
$rev
);
foreach
(
$keys
as
$key
)
{
$this
->
redis
->
sadd
(
$this
->
supported_symbol
,
str_replace
(
'_'
,
''
,
$key
));
}
}
}
public
function
setQuotation
()
{
$api
=
'http://api.zb.com/data/v1/allTicker'
;
$rev
=
$this
->
ch
->
get
(
$api
,
false
);
if
(
$rev
)
{
foreach
(
$rev
as
$key
=>
$item
)
{
$this
->
redis
->
hmset
(
$this
->
quotation_prefix
.
$key
,
'low'
,
$item
[
'low'
],
'high'
,
$item
[
'high'
],
'last'
,
$item
[
'last'
]);
}
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
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