FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
php-binance-api/examples/web_socket_depth.php at master · ccxt/php-binance-api · GitHub
ccxt
/
php-binance-api
Public
Notifications
You must be signed in to change notification settings
Fork
484
Star
647
Code
Issues
76
Pull requests
11
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
php-binance-api
/
examples
/
web_socket_depth.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
21 lines (18 loc) · 661 Bytes
Breadcrumbs
php-binance-api
/
examples
/
web_socket_depth.php
Copy path
File metadata and controls
executable file
·
21 lines (18 loc) · 661 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
require
'
php-binance-api.php
'
;
require
'
vendor/autoload.php
'
;
// @see home_directory_config.php
// use config from ~/.confg/jaggedsoft/php-binance-api.json
$
api
=
new
Binance
\
API
();
$
api
->
depthCache
([
"
BNBBTC
"
],
function
(
$
api
,
$
symbol
,
$
depth
) {
echo
"{
$
symbol
}
depth cache update
\n"
;
$
limit
=
11
;
// Show only the closest asks/bids
$
sorted
=
$
api
->
sortDepth
(
$
symbol
,
$
limit
);
$
bid
=
$
api
->
first
(
$
sorted
[
'
bids
'
]);
$
ask
=
$
api
->
first
(
$
sorted
[
'
asks
'
]);
echo
$
api
->
displayDepth
(
$
sorted
);
echo
"
ask:
{
$
ask
}\n"
;
echo
"
bid:
{
$
bid
}\n"
;
$
endpoint
=
strtolower
(
$
symbol
) .
'
@depthCache
'
;
$
api
->
terminate
(
$
endpoint
);
});
Back
|
FazBrowse Home
|
New Git URL