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
03e87e57
Commit
03e87e57
authored
6 years ago
by
rlgy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bittrex api
parent
43ee5f02
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
0 deletions
+50
-0
Bittrex.php
common/service/exchange/Bittrex.php
+50
-0
No files found.
common/service/exchange/Bittrex.php
0 → 100644
View file @
03e87e57
<?php
/**
* Created by PhpStorm.
* User: rlgyzhcn
* Date: 18-6-28
* Time: 上午9:25
*/
namespace
common\service\exchange
;
use
Yii
;
class
Bittrex
extends
Exchange
implements
ExchangeInterface
{
protected
$supported_symbol
=
'supported_symbol_bittrex'
;
protected
$quotation_prefix
=
'quotation_bittrex_'
;
public
function
formatSymbol
(
$tag
=
'BTC'
,
$aim
=
'USD'
)
{
return
strtoupper
(
trim
(
$tag
)
.
'-'
.
trim
(
$aim
));
}
public
function
setSupportedSymbol
()
{
$api
=
'https://bittrex.com/api/v1.1/public/getmarkets'
;
$rev
=
$this
->
ch
->
get
(
$api
,
false
);
if
(
$rev
&&
$rev
[
'success'
])
{
$lists
=
$rev
[
'result'
];
foreach
(
$lists
as
$item
)
{
$this
->
redis
->
sadd
(
$this
->
supported_symbol
,
$item
[
'MarketName'
]);
}
}
}
public
function
setQuotation
()
{
$api
=
'https://bittrex.com/api/v1.1/public/getmarketsummaries'
;
$rev
=
$this
->
ch
->
get
(
$api
,
false
);
if
(
$rev
&&
$rev
[
'success'
])
{
$lists
=
$rev
[
'result'
];
foreach
(
$lists
as
$item
)
{
$this
->
redis
->
hmset
(
$this
->
quotation_prefix
.
$item
[
'MarketName'
],
'low'
,
$item
[
'Low'
],
'high'
,
$item
[
'High'
],
'last'
,
$item
[
'Last'
]);
}
}
}
}
\ 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