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
2e66ec0a
Commit
2e66ec0a
authored
Dec 21, 2021
by
shajiaiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/ticker' into 'master'
Feature/ticker See merge request
!487
parents
7c1d219d
8d915681
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
26 deletions
+34
-26
ExchangeBusiness.php
common/business/ExchangeBusiness.php
+15
-15
Gwa.php
common/service/exchange/Gwa.php
+16
-8
GwaBuilder.php
common/service/exchange/factory/GwaBuilder.php
+3
-3
No files found.
common/business/ExchangeBusiness.php
View file @
2e66ec0a
...
@@ -32,19 +32,16 @@ class ExchangeBusiness
...
@@ -32,19 +32,16 @@ class ExchangeBusiness
2
=>
'Hadax'
,
2
=>
'Hadax'
,
3
=>
'Bittrex'
,
3
=>
'Bittrex'
,
4
=>
'Zb'
,
4
=>
'Zb'
,
5
=>
'Zg'
,
5
=>
'Go'
,
6
=>
'Go'
,
6
=>
'Zhaobi'
,
7
=>
'Zhaobi'
,
7
=>
'Binance'
,
8
=>
'Binance'
,
8
=>
'Bilaxy'
,
9
=>
'Bilaxy'
,
9
=>
'Bitnasdaq'
,
10
=>
'Bitnasdaq'
,
10
=>
'Isummit'
,
11
=>
'Isummit'
,
11
=>
'Boc'
,
12
=>
'Boc'
,
12
=>
'Ztb'
,
13
=>
'Jinwang'
,
13
=>
'Wbf'
,
14
=>
'Hd'
,
14
=>
'Gwa'
15
=>
'Ztb'
,
16
=>
'Wbf'
,
17
=>
'Gwa'
//1 => 'Hadax', //不需要
//1 => 'Hadax', //不需要
//2 => 'Bitfinex', //不需要
//2 => 'Bitfinex', //不需要
...
@@ -61,6 +58,9 @@ class ExchangeBusiness
...
@@ -61,6 +58,9 @@ class ExchangeBusiness
//12 => 'Tsc',//已挂
//12 => 'Tsc',//已挂
//16 => 'Dag',//已挂
//16 => 'Dag',//已挂
//17 => 'Coinka',//已挂
//17 => 'Coinka',//已挂
//5 => 'Zg',//已挂
//13 => 'Jinwang',//已挂
//14 => 'Hd',//已挂
];
];
/**
/**
...
@@ -442,9 +442,9 @@ class ExchangeBusiness
...
@@ -442,9 +442,9 @@ class ExchangeBusiness
goto
doEnd
;
goto
doEnd
;
}
}
if
(
in_array
(
strtoupper
(
$tag
),
[
'GWA'
]))
{
if
(
in_array
(
strtoupper
(
$tag
),
[
'GWA'
,
'KLG'
]))
{
$exchange
=
ExchangeFactory
::
createExchange
(
"Gwa"
);
$exchange
=
ExchangeFactory
::
createExchange
(
"Gwa"
);
$quotation
=
$exchange
->
getTicker
(
'GWA'
,
'USDT'
);
$quotation
=
$exchange
->
getTicker
(
strtoupper
(
$tag
)
,
'USDT'
);
goto
doEnd
;
goto
doEnd
;
}
}
...
...
common/service/exchange/Gwa.php
View file @
2e66ec0a
...
@@ -12,9 +12,9 @@ use linslin\yii2\curl\Curl;
...
@@ -12,9 +12,9 @@ use linslin\yii2\curl\Curl;
class
Gwa
extends
Exchange
implements
ExchangeInterface
class
Gwa
extends
Exchange
implements
ExchangeInterface
{
{
protected
$supported_symbol
=
'supported_symbol_gwa'
;
protected
$supported_symbol
=
'supported_symbol_gwa
world
'
;
protected
$quotation_prefix
=
'quotation_gwa_'
;
protected
$quotation_prefix
=
'quotation_gwa
world
_'
;
protected
$base_url
=
'http
s://api.gwaworld.io/get
Balance'
;
protected
$base_url
=
'http
://154.85.53.6:8001/getToken
Balance'
;
public
function
symbolExists
(
$tag
=
'GWA'
,
$aim
=
"USDT"
)
public
function
symbolExists
(
$tag
=
'GWA'
,
$aim
=
"USDT"
)
{
{
...
@@ -56,11 +56,19 @@ class Gwa extends Exchange implements ExchangeInterface
...
@@ -56,11 +56,19 @@ class Gwa extends Exchange implements ExchangeInterface
{
{
$curl
=
new
Curl
();
$curl
=
new
Curl
();
$res
=
$curl
->
get
(
$this
->
base_url
,
false
);
$res
=
$curl
->
get
(
$this
->
base_url
,
false
);
if
(
is_array
(
$res
)
&&
1
==
$res
[
'code'
])
{
if
(
is_array
(
$res
)
&&
isset
(
$res
[
'data'
]))
{
$key
=
$this
->
quotation_prefix
.
'GWAUSDT'
;
$data
=
$res
[
'data'
][
'ticker'
];
$this
->
redis
->
hmset
(
$key
,
'low'
,
$res
[
'data'
][
'currPrice'
],
'high'
,
$res
[
'data'
][
'currPrice'
],
'last'
,
$res
[
'data'
][
'currPrice'
],
'change'
,
$res
[
'data'
][
'range'
]);
foreach
(
$data
as
$item
)
{
if
(
!
$this
->
redis
->
sismember
(
$this
->
supported_symbol
,
'GWAUSDT'
))
{
$key
=
$this
->
quotation_prefix
.
strtoupper
(
$item
[
'symbol'
]);
$this
->
redis
->
sadd
(
$this
->
supported_symbol
,
'GWAUSDT'
);
$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'
]));
}
}
}
}
}
}
}
...
...
common/service/exchange/factory/GwaBuilder.php
View file @
2e66ec0a
...
@@ -14,13 +14,13 @@ use linslin\yii2\curl\Curl;
...
@@ -14,13 +14,13 @@ use linslin\yii2\curl\Curl;
class
GwaBuilder
extends
FactoryService
class
GwaBuilder
extends
FactoryService
{
{
protected
$base_url
=
'https://api.gwaworld.io'
;
protected
$base_url
=
'https://api.gwaworld.io'
;
protected
$supported_symbol
=
'supported_symbol_gwa'
;
protected
$supported_symbol
=
'supported_symbol_gwa
world
'
;
protected
$supported_symbol_list
=
'supported_symbol_gwa_list'
;
protected
$supported_symbol_list
=
'supported_symbol_gwa
world
_list'
;
protected
$supported_symbol_close_asc
=
'supported_symbol_close_asc_gwa'
;
protected
$supported_symbol_close_asc
=
'supported_symbol_close_asc_gwa'
;
protected
$supported_symbol_close_desc
=
'supported_symbol_close_desc_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_asc
=
'supported_symbol_change_asc_gwa'
;
protected
$supported_symbol_change_desc
=
'supported_symbol_change_desc_gwa'
;
protected
$supported_symbol_change_desc
=
'supported_symbol_change_desc_gwa'
;
protected
$quotation_prefix
=
'quotation_gwa_'
;
protected
$quotation_prefix
=
'quotation_gwa
world
_'
;
public
function
getHotTicker
(
$symbol
=
[])
public
function
getHotTicker
(
$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