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
eb9831b4
Commit
eb9831b4
authored
Jul 20, 2020
by
shajiaiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/ticker' into 'master'
issumit ticker See merge request
!349
parents
d0aa41b8
91335aac
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
2 deletions
+58
-2
ExchangeBusiness.php
common/business/ExchangeBusiness.php
+9
-2
Isummit.php
common/service/exchange/Isummit.php
+49
-0
No files found.
common/business/ExchangeBusiness.php
View file @
eb9831b4
...
...
@@ -44,7 +44,8 @@ class ExchangeBusiness
15
=>
'Bitnasdaq'
,
16
=>
'Dag'
,
17
=>
'Coinka'
,
18
=>
'Boc'
,
18
=>
'Isummit'
,
19
=>
'Boc'
,
//1 => 'Hadax', //不需要
...
...
@@ -139,6 +140,12 @@ class ExchangeBusiness
}
$f
=
false
;
$quotation
=
[];
if
(
in_array
(
strtoupper
(
$tag
),
[
'SUM'
,
'USDW'
,
'FUT'
]))
{
$exchange
=
ExchangeFactory
::
createExchange
(
"Isummit"
);
$quotation
=
$exchange
->
getTicker
(
$tag
,
'USDT'
);
goto
doEnd
;
}
if
(
in_array
(
strtoupper
(
$tag
),
[
'PAX'
]))
{
$exchange
=
ExchangeFactory
::
createExchange
(
"HuoBi"
);
$quotation
=
$exchange
->
getTicker
(
$tag
,
'husd'
);
...
...
@@ -337,7 +344,7 @@ class ExchangeBusiness
$exchange
=
ExchangeFactory
::
createExchange
(
"Go"
);
$rate
=
$exchange
->
getTicker
(
"CNY"
,
"USD"
);
$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'
]))
{
if
(
in_array
(
strtoupper
(
$tag
),
[
'FOLI'
,
'CIC'
,
'KPC8'
,
'BVA'
,
'DAG'
,
'BNC'
,
'GHP'
,
'DRA'
,
'ETC'
,
'PAX'
,
'STH'
,
'XJH'
,
'SFT'
,
'TSC'
,
'SUM'
,
'USDW'
,
'FUT'
]))
{
$quotation
[
'usd'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$quotation
[
'last'
]);
$quotation
[
'rmb'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$quotation
[
'last'
]
/
$cny_usd_rate
);
}
else
if
(
in_array
(
strtoupper
(
$tag
),
[
'SUSD'
]))
{
...
...
common/service/exchange/Isummit.php
0 → 100644
View file @
eb9831b4
<?php
/**
* Created by PhpStorm.
* User: rlgyzhcn
* Date: 18-6-26
* Time: 下午7:21
*/
namespace
common\service\exchange
;
use
Yii
;
use
linslin\yii2\curl\Curl
;
class
Isummit
extends
Exchange
implements
ExchangeInterface
{
protected
$supported_symbol
=
'supported_symbol_isummit'
;
protected
$quotation_prefix
=
'quotation_isummit_'
;
protected
$base_url
=
'http://www.isummit.top'
;
public
function
formatSymbol
(
$tag
=
'BTC'
,
$aim
=
'USDT'
)
{
return
strtolower
(
trim
(
$tag
)
.
trim
(
$aim
));
}
public
function
setSupportedSymbol
()
{
}
public
function
setQuotation
()
{
$curl
=
new
Curl
();
$api
=
$this
->
base_url
.
'/api/coins/market'
;
$res
=
$curl
->
get
(
$api
,
false
);
if
(
isset
(
$res
[
'code'
])
&&
200
==
$res
[
'code'
]
&&
isset
(
$res
[
'data'
]))
{
foreach
(
$res
[
'data'
]
as
$item
)
{
if
(
in_array
(
strtoupper
(
$item
[
'coin'
]),
[
'SUM'
,
'USDW'
,
'FUT'
]))
{
$low
=
isset
(
$item
[
'price'
])
?
$item
[
'price'
]
:
0
;
$high
=
isset
(
$item
[
'price'
])
?
$item
[
'price'
]
:
0
;
$last
=
isset
(
$item
[
'price'
])
?
$item
[
'price'
]
:
0
;
$open
=
isset
(
$item
[
'price'
])
?
$item
[
'price'
]
:
0
;
$cache_key
=
$this
->
quotation_prefix
.
strtolower
(
$item
[
'coin'
]
.
'USDT'
);
$this
->
redis
->
hmset
(
$cache_key
,
'low'
,
$low
,
'high'
,
$high
,
'last'
,
$last
,
'open'
,
$open
);
}
}
}
}
}
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