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
12a08c2e
Commit
12a08c2e
authored
Jul 08, 2020
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hl行情接口更新
parent
7a73e2c8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
9 deletions
+15
-9
Zg.php
common/service/exchange/Zg.php
+15
-9
No files found.
common/service/exchange/Zg.php
View file @
12a08c2e
...
@@ -14,7 +14,7 @@ class Zg extends Exchange implements ExchangeInterface
...
@@ -14,7 +14,7 @@ class Zg extends Exchange implements ExchangeInterface
{
{
protected
$supported_symbol
=
'supported_symbol_zg'
;
protected
$supported_symbol
=
'supported_symbol_zg'
;
protected
$quotation_prefix
=
'quotation_zg_'
;
protected
$quotation_prefix
=
'quotation_zg_'
;
protected
$base_url
=
'https://api1.zg.com/tickers
'
;
protected
$base_url
=
'https://api.zg.com/openapi/quote/v1/ticker/24hr
'
;
public
function
symbolExists
(
$tag
=
'HL'
,
$aim
=
"USDT"
)
public
function
symbolExists
(
$tag
=
'HL'
,
$aim
=
"USDT"
)
{
{
...
@@ -24,6 +24,7 @@ class Zg extends Exchange implements ExchangeInterface
...
@@ -24,6 +24,7 @@ class Zg extends Exchange implements ExchangeInterface
}
}
return
false
;
return
false
;
}
}
/**
/**
* 转化交易对为请求变量
* 转化交易对为请求变量
*
*
...
@@ -33,7 +34,7 @@ class Zg extends Exchange implements ExchangeInterface
...
@@ -33,7 +34,7 @@ class Zg extends Exchange implements ExchangeInterface
*/
*/
public
function
formatSymbol
(
$tag
=
'HL'
,
$aim
=
'USDT'
)
public
function
formatSymbol
(
$tag
=
'HL'
,
$aim
=
'USDT'
)
{
{
return
strtoupper
(
$tag
.
'_'
.
$aim
);
return
strtoupper
(
$tag
.
'_'
.
$aim
);
}
}
/**
/**
...
@@ -58,14 +59,19 @@ class Zg extends Exchange implements ExchangeInterface
...
@@ -58,14 +59,19 @@ class Zg extends Exchange implements ExchangeInterface
'User-Agent'
=>
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36'
,
'User-Agent'
=>
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36'
,
]);
]);
$content
=
$curl
->
get
(
$this
->
base_url
,
false
);
$content
=
$curl
->
get
(
$this
->
base_url
,
false
);
if
(
is_array
(
$content
)
&&
isset
(
$content
[
'ticker'
]))
{
if
(
is_array
(
$content
))
{
$data
=
$content
[
'ticker'
];
foreach
(
$content
as
$item
)
{
foreach
(
$data
as
$item
)
{
if
(
in_array
(
$item
[
'symbol'
],
[
'HLUSDT'
,
'GHPUSDT'
]))
{
if
(
in_array
(
$item
[
'symbol'
],
[
'HL_USDT'
,
'GHP_CNZ'
]))
{
if
(
$item
[
'symbol'
]
==
'HLUSDT'
)
{
$symbol
=
'HL_USDT'
;
}
if
(
$item
[
'symbol'
]
==
'GHPUSDT'
)
{
$symbol
=
'GHP_CNZ'
;
}
$data
=
$item
;
$data
=
$item
;
$key
=
$this
->
quotation_prefix
.
$item
[
'symbol'
]
;
$key
=
$this
->
quotation_prefix
.
$symbol
;
$this
->
redis
->
hmset
(
$key
,
'low'
,
$data
[
'low
'
],
'high'
,
$data
[
'high'
],
'last'
,
$data
[
'last
'
]);
$this
->
redis
->
hmset
(
$key
,
'low'
,
$data
[
'low
Price'
],
'high'
,
$data
[
'highPrice'
],
'last'
,
$data
[
'lastPrice'
],
'open'
,
$data
[
'openPrice
'
]);
$this
->
redis
->
sadd
(
$this
->
supported_symbol
,
$
item
[
'symbol'
]
);
$this
->
redis
->
sadd
(
$this
->
supported_symbol
,
$
symbol
);
}
}
}
}
}
}
...
...
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