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
dc60edee
Commit
dc60edee
authored
6 years ago
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new coin tiker
parent
21b6c06c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
23 deletions
+13
-23
ExchangeBusiness.php
common/business/ExchangeBusiness.php
+13
-14
Exchange.php
common/service/exchange/Exchange.php
+0
-9
No files found.
common/business/ExchangeBusiness.php
View file @
dc60edee
...
...
@@ -60,17 +60,19 @@ class ExchangeBusiness
}
$f
=
false
;
$quotation
=
[];
if
(
in_array
(
strtoupper
(
$tag
),[
'GM'
,
'BSTC'
])){
$exchange
=
ExchangeFactory
::
createExchange
(
"Token7"
);
$quotation
=
$exchange
->
getTicker
(
$tag
,
'HA'
);
$quotation
[
'rmb'
]
=
(
float
)
sprintf
(
"%0.2f"
,
$quotation
[
'last'
]);
return
$quotation
;
}
foreach
(
self
::
$exchanges
as
$exchange
)
{
/**
* @var $exchange \common\service\exchange\Exchange
*/
$exchange
=
ExchangeFactory
::
createExchange
(
$exchange
);
if
(
'GM'
==
$tag
||
'BSTC'
==
$tag
){
$quotation
=
$exchange
->
getTickerToken7
(
$tag
,
'HA'
);
$f
=
true
;
continue
;
}
if
(
$exchange
->
symbolExists
(
$tag
))
{
$quotation
=
$exchange
->
getTicker
(
$tag
);
$f
=
true
;
...
...
@@ -109,14 +111,11 @@ class ExchangeBusiness
/**
* @var $exchange \common\service\exchange\Exchange
*/
if
(
'GM'
==
$tag
||
'BSTC'
==
$tag
){
$quotation
[
'rmb'
]
=
(
float
)
sprintf
(
"%0.2f"
,
$quotation
[
'last'
]);
}
else
{
$exchange
=
ExchangeFactory
::
createExchange
(
"Bty"
);
$rate
=
$exchange
->
getTicker
(
"BTY"
,
"USDT"
);
$rate
=
(
float
)
$rate
[
'rmb'
]
/
$rate
[
'last'
];
$quotation
[
'rmb'
]
=
(
float
)
sprintf
(
"%0.2f"
,
$rate
*
$quotation
[
'last'
]);
}
$exchange
=
ExchangeFactory
::
createExchange
(
"Bty"
);
$rate
=
$exchange
->
getTicker
(
"BTY"
,
"USDT"
);
$rate
=
(
float
)
$rate
[
'rmb'
]
/
$rate
[
'last'
];
$quotation
[
'rmb'
]
=
(
float
)
sprintf
(
"%0.2f"
,
$rate
*
$quotation
[
'last'
]);
return
$quotation
;
}
...
...
This diff is collapsed.
Click to expand it.
common/service/exchange/Exchange.php
View file @
dc60edee
...
...
@@ -81,12 +81,4 @@ abstract class Exchange
$values
=
$this
->
redis
->
hvals
(
$this
->
quotation_prefix
.
$symbol
);
return
array_combine
(
$keys
,
$values
);
}
public
function
getTickerToken7
(
$tag
=
'BTC'
,
$aim
=
"USDT"
)
{
$symbol
=
$this
->
formatSymbol
(
$tag
,
$aim
);
$keys
=
$this
->
redis
->
hkeys
(
$this
->
quotation_prefix
.
$symbol
);
$values
=
$this
->
redis
->
hvals
(
$this
->
quotation_prefix
.
$symbol
);
return
array_combine
(
$keys
,
$values
);
}
}
\ 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