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
d30471e0
Commit
d30471e0
authored
Nov 13, 2020
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
zyc hot ticker
parent
a3fb29ea
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
75 additions
and
4 deletions
+75
-4
TickerController.php
api/controllers/TickerController.php
+16
-0
Ztb.php
common/service/exchange/Ztb.php
+4
-4
ZtbBuilder.php
common/service/exchange/factory/ZtbBuilder.php
+55
-0
No files found.
api/controllers/TickerController.php
View file @
d30471e0
...
...
@@ -335,6 +335,22 @@ class TickerController extends BaseController
]
];
}
if
(
52
==
$platform_id
)
{
$datas
=
[
[
'exchange'
=>
'huobi'
,
'symbol'
=>
[
'btcusdt'
,
'ethusdt'
],
],
[
'exchange'
=>
'ztb'
,
'symbol'
=>
[
'zycusdt'
],
]
];
}
if
(
53
==
$platform_id
)
{
$datas
=
[
[
...
...
common/service/exchange/Ztb.php
View file @
d30471e0
...
...
@@ -34,7 +34,7 @@ class Ztb extends Exchange implements ExchangeInterface
*/
public
function
formatSymbol
(
$tag
=
'ZYC'
,
$aim
=
'USDT'
)
{
return
strtoupper
(
$tag
.
'_'
.
$aim
);
return
strtoupper
(
$tag
.
$aim
);
}
/**
...
...
@@ -44,7 +44,7 @@ class Ztb extends Exchange implements ExchangeInterface
*/
public
function
setSupportedSymbol
()
{
$this
->
redis
->
sadd
(
$this
->
supported_symbol
,
'ZYC
_
USDT'
);
$this
->
redis
->
sadd
(
$this
->
supported_symbol
,
'ZYCUSDT'
);
}
/**
...
...
@@ -59,10 +59,10 @@ class Ztb extends Exchange implements ExchangeInterface
if
(
is_array
(
$content
)
&&
isset
(
$content
[
'ticker'
]))
{
$data
=
$content
[
'ticker'
];
foreach
(
$data
as
$item
)
{
if
(
in_array
(
$item
[
'symbol'
],
[
'ZYC
_
USDT'
]))
{
if
(
in_array
(
$item
[
'symbol'
],
[
'ZYCUSDT'
]))
{
$data
=
$item
;
$key
=
$this
->
quotation_prefix
.
$item
[
'symbol'
];
$this
->
redis
->
hmset
(
$key
,
'low'
,
$data
[
'low'
],
'high'
,
$data
[
'high'
],
'last'
,
$data
[
'last'
]);
$this
->
redis
->
hmset
(
$key
,
'low'
,
$data
[
'low'
],
'high'
,
$data
[
'high'
],
'last'
,
$data
[
'last'
]
,
'vol'
,
$data
[
'vol'
],
'change'
,
$data
[
'change'
]
);
$this
->
redis
->
sadd
(
$this
->
supported_symbol
,
$item
[
'symbol'
]);
}
}
...
...
common/service/exchange/factory/ZtbBuilder.php
0 → 100644
View file @
d30471e0
<?php
/**
* Created by PhpStorm.
* User: jiaming
* Date: 2019/8/15
* Time: 10:10
*/
namespace
common\service\exchange\factory
;
use
common\components\Tools
;
use
linslin\yii2\curl\Curl
;
class
ZtbBuilder
extends
FactoryService
{
protected
$base_url
=
'https://api.ztb.pro'
;
protected
$supported_symbol
=
'supported_symbol_ztb'
;
protected
$supported_symbol_list
=
'supported_symbol_ztb_list'
;
protected
$supported_symbol_close_asc
=
'supported_symbol_close_asc_ztb'
;
protected
$supported_symbol_close_desc
=
'supported_symbol_close_desc_ztb'
;
protected
$supported_symbol_change_asc
=
'supported_symbol_change_asc_ztb'
;
protected
$supported_symbol_change_desc
=
'supported_symbol_change_desc_ztb'
;
protected
$quotation_prefix
=
'quotation_ztb_'
;
public
function
getHotTicker
(
$symbol
=
[])
{
if
(
empty
(
$symbol
))
{
return
[
'code'
=>
$this
->
code
,
'ticker'
=>
[]];
}
$ticker
=
[];
foreach
(
$symbol
as
$val
)
{
list
(
$low
,
$high
,
$change
,
$last
,
$vol
)
=
$this
->
redis
->
hmget
(
$this
->
quotation_prefix
.
strtoupper
(
str_replace
(
'USDT'
,
'_USDT'
,
$val
)),
'low'
,
'high'
,
'change'
,
'last'
,
'vol'
);
$explode_arr
=
explode
(
'usdt'
,
$val
);
$temp
=
[];
$temp
[
'symbol'
]
=
strtoupper
(
$explode_arr
[
0
])
.
'/USDT'
;
$temp
[
'currency'
]
=
strtoupper
(
$explode_arr
[
0
]);
$temp
[
'base_currency'
]
=
'USDT'
;
$temp
[
'close'
]
=
(
float
)
sprintf
(
"%0.6f"
,
$last
);
$temp
[
'close_usd'
]
=
(
float
)
sprintf
(
"%0.6f"
,
$last
*
$this
->
basic_price
[
'USDT'
][
'usd'
]);
$temp
[
'close_rmb'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$last
*
$this
->
basic_price
[
'USDT'
][
'rmb'
]);
$temp
[
'change'
]
=
$change
;
$temp
[
'high_usd'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$high
*
$this
->
basic_price
[
'USDT'
][
'usd'
]);
$temp
[
'low_usd'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$low
*
$this
->
basic_price
[
'USDT'
][
'usd'
]);
$temp
[
'high_rmb'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$high
*
$this
->
basic_price
[
'USDT'
][
'rmb'
]);
$temp
[
'low_rmb'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$low
*
$this
->
basic_price
[
'USDT'
][
'rmb'
]);
$temp
[
'vol'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$vol
);
array_push
(
$ticker
,
$temp
);
}
if
(
count
(
$ticker
)
>
0
)
{
$this
->
code
=
0
;
}
return
[
'code'
=>
$this
->
code
,
'ticker'
=>
$ticker
];
}
}
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