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
5ca09605
Commit
5ca09605
authored
Nov 20, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/ticker' into 'master'
bn hot-ticker See merge request
!209
parents
0c8283fa
2984b57a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
5 deletions
+51
-5
TickerController.php
api/controllers/TickerController.php
+20
-5
BitnasdaqBuilder.php
common/service/exchange/factory/BitnasdaqBuilder.php
+31
-0
No files found.
api/controllers/TickerController.php
View file @
5ca09605
...
...
@@ -284,6 +284,20 @@ class TickerController extends BaseController
public
function
actionHotTicker
()
{
$platform_id
=
Yii
::
$app
->
request
->
get
(
'platform_id'
,
0
);
$datas
=
[
[
'exchange'
=>
'huobi'
,
'symbol'
=>
[
'btcusdt'
,
'ethusdt'
]
],[
'exchange'
=>
'zhaobi'
,
'symbol'
=>
[
'btyusdt'
]
]
];
if
(
9
==
$platform_id
)
{
$datas
=
[
[
...
...
@@ -299,19 +313,20 @@ class TickerController extends BaseController
],
]
];
}
else
{
}
if
(
17
==
$platform_id
)
{
$datas
=
[
[
'exchange'
=>
'huobi'
,
'symbol'
=>
[
'btcusdt'
,
'ethusdt'
]
]
,
],[
'exchange'
=>
'
zhaobi
'
,
'exchange'
=>
'
bitnasdaq
'
,
'symbol'
=>
[
'b
ty
usdt'
]
'b
nc
usdt'
]
,
]
];
}
...
...
common/service/exchange/factory/BitnasdaqBuilder.php
View file @
5ca09605
...
...
@@ -143,4 +143,35 @@ class BitnasdaqBuilder extends FactoryService
$this
->
redis_ticker
->
rpush
(
$this
->
supported_symbol_change_desc
,
strtoupper
(
$val
[
'symbol'
]));
}
}
public
function
getHotTicker
(
$symbol
=
[])
{
if
(
empty
(
$symbol
))
{
return
[
'code'
=>
$this
->
code
,
'ticker'
=>
[]];
}
$ticker
=
[];
foreach
(
$symbol
as
$val
)
{
list
(
$low
,
$high
,
$close
,
$open
,
$vol
)
=
$this
->
redis
->
hmget
(
$this
->
quotation_prefix
.
strtolower
(
$val
),
'low'
,
'high'
,
'last'
,
'open'
,
'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"
,
$close
);
$temp
[
'close_usd'
]
=
(
float
)
sprintf
(
"%0.6f"
,
$close
*
$this
->
basic_price
[
'USDT'
][
'usd'
]);
$temp
[
'close_rmb'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$close
*
$this
->
basic_price
[
'USDT'
][
'rmb'
]);
$temp
[
'change'
]
=
(
0
==
$open
)
?
0
:
(
float
)
sprintf
(
"%0.2f"
,
(
$close
-
$open
)
/
$open
*
100
);
$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