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
dbac8271
Commit
dbac8271
authored
Dec 21, 2021
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add klg ticker
parent
7c1d219d
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
165 deletions
+34
-165
ExchangeBusiness.php
common/business/ExchangeBusiness.php
+15
-154
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 @
dbac8271
<?php
<?php
/**
* Created by PhpStorm.
* User: rlgyzhcn
* Date: 18-6-27
* Time: 下午12:04
*/
namespace
common\business
;
namespace
common\business
;
...
@@ -32,19 +26,17 @@ class ExchangeBusiness
...
@@ -32,19 +26,17 @@ 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
=>
'Jinwang'
,
13
=>
'Jinwang'
,
13
=>
'Ztb'
,
14
=>
'Hd'
,
14
=>
'Wbf'
,
15
=>
'Ztb'
,
15
=>
'Gwa'
16
=>
'Wbf'
,
17
=>
'Gwa'
//1 => 'Hadax', //不需要
//1 => 'Hadax', //不需要
//2 => 'Bitfinex', //不需要
//2 => 'Bitfinex', //不需要
...
@@ -59,6 +51,8 @@ class ExchangeBusiness
...
@@ -59,6 +51,8 @@ class ExchangeBusiness
//6 => 'Token7',//已挂
//6 => 'Token7',//已挂
//10 => 'Ex',//已挂
//10 => 'Ex',//已挂
//12 => 'Tsc',//已挂
//12 => 'Tsc',//已挂
//13 => 'Jinwang',//已挂
//14 => 'Hd',//已挂
//16 => 'Dag',//已挂
//16 => 'Dag',//已挂
//17 => 'Coinka',//已挂
//17 => 'Coinka',//已挂
];
];
...
@@ -100,139 +94,6 @@ class ExchangeBusiness
...
@@ -100,139 +94,6 @@ class ExchangeBusiness
goto
doEnd
;
goto
doEnd
;
}
}
if
(
strtoupper
(
$tag
)
==
'USAT'
)
{
$tag
=
'USDT'
;
}
if
(
strtoupper
(
$tag
)
==
'DUSDT'
)
{
$quotation
=
[
'low'
=>
6.99
,
'high'
=>
6.99
,
'last'
=>
6.99
,
'rmb'
=>
6.99
,
];
goto
doEnd
;
}
if
(
strtoupper
(
$tag
)
==
'YPLUS'
)
{
$quotation
=
[
'low'
=>
10
,
'high'
=>
10
,
'last'
=>
10
,
'rmb'
=>
10
,
];
goto
doEnd
;
}
if
(
strtoupper
(
$tag
)
==
'BOSS'
)
{
$quotation
=
[
'low'
=>
2000
,
'high'
=>
2000
,
'last'
=>
2000
,
'rmb'
=>
2000
,
];
goto
doEnd
;
}
if
(
strtoupper
(
$tag
)
==
'CPF'
)
{
$quotation
=
[
'low'
=>
3.4
,
'high'
=>
3.4
,
'last'
=>
3.4
,
'rmb'
=>
3.4
,
];
goto
doEnd
;
}
if
(
strtoupper
(
$tag
)
==
'FZM'
)
{
$quotation
=
[
'low'
=>
40
,
'high'
=>
40
,
'last'
=>
40
,
'rmb'
=>
40
,
];
goto
doEnd
;
}
if
(
strtoupper
(
$tag
)
==
'POKE'
)
{
$quotation
=
[
'low'
=>
0.1621
,
'high'
=>
0.1621
,
'last'
=>
0.1621
,
'rmb'
=>
0.1621
,
];
goto
doEnd
;
}
if
(
strtoupper
(
$tag
)
==
'LHG'
)
{
$quotation
=
[
'low'
=>
0.105
,
'high'
=>
0.105
,
'last'
=>
0.105
,
'rmb'
=>
0.105
,
];
goto
doEnd
;
}
if
(
in_array
(
strtoupper
(
$tag
),
[
'LZ'
,
'DTM'
,
'CNNY'
]))
{
$quotation
=
[
'low'
=>
1
,
'high'
=>
1
,
'last'
=>
1
,
'rmb'
=>
1
,
];
goto
doEnd
;
}
// if (strtoupper($tag) == 'ZUE') {
// $quotation = [
// 'low' => 0.1,
// 'high' => 0.1,
// 'last' => 0.1,
// ];
// goto doEnd;
// }
if
(
in_array
(
strtoupper
(
$tag
),
[
'SZHB'
,
'FK'
]))
{
$quotation
=
[
'low'
=>
0.01
,
'high'
=>
0.01
,
'last'
=>
0.01
,
'rmb'
=>
0.01
,
];
goto
doEnd
;
}
if
(
in_array
(
strtoupper
(
$tag
),
[
'GST'
,
'JNTK'
,
'SPT'
,
'STO'
,
'GM'
,
'BSTC'
,
'RYH'
,
'CNDT'
,
'WL'
,
'ETS'
,
'LIMS'
,
'AT'
,
'BTJ'
,
'WXB'
,
'GFCC'
,
'TNT'
]))
{
$quotation
=
[
'low'
=>
0
,
'high'
=>
0
,
'last'
=>
0
,
'rmb'
=>
0
,
];
goto
doEnd
;
}
if
(
in_array
(
$tag
,
$coin_quotation_disable_items
))
{
return
false
;
}
$f
=
false
;
$quotation
=
[];
if
(
in_array
(
strtoupper
(
$tag
),
[
'LELE'
,
'ZUE'
]))
{
if
(
strtoupper
(
$tag
)
==
'LELE'
)
{
$exchange
=
ExchangeFactory
::
createExchange
(
"Wbf"
);
$quotation
=
$exchange
->
getTicker
(
$tag
,
'USDT'
);
}
if
(
strtoupper
(
$tag
)
==
'ZUE'
)
{
$quotation
=
[
'low'
=>
0.1
,
'high'
=>
0.1
,
'last'
=>
0.1
,
];
}
goto
doEnd
;
}
if
(
in_array
(
strtoupper
(
$tag
),
[
'GLCW'
]))
{
if
(
in_array
(
strtoupper
(
$tag
),
[
'GLCW'
]))
{
$exchange
=
ExchangeFactory
::
createExchange
(
"Jinwang"
);
$exchange
=
ExchangeFactory
::
createExchange
(
"Jinwang"
);
$quotation
=
$exchange
->
getTicker
(
$tag
,
'USDT'
);
$quotation
=
$exchange
->
getTicker
(
$tag
,
'USDT'
);
...
@@ -442,9 +303,9 @@ class ExchangeBusiness
...
@@ -442,9 +303,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 @
dbac8271
...
@@ -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 @
dbac8271
...
@@ -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