FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-binance/tests/test_depth_cache.py at develop · EncodingJerry/python-binance · GitHub
EncodingJerry
/
python-binance
Public
forked from
kbai/python-binance
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
python-binance
/
tests
/
test_depth_cache.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
42 lines (28 loc) · 977 Bytes
Breadcrumbs
python-binance
/
tests
/
test_depth_cache.py
Copy path
File metadata and controls
42 lines (28 loc) · 977 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
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from
binance
.
depthcache
import
DepthCache
import
pytest
TEST_SYMBOL
=
"BNBBTC"
@
pytest
.
fixture
def
fresh_cache
():
return
DepthCache
(
TEST_SYMBOL
)
def
test_add_bids
(
fresh_cache
):
"""Verify basic functionality for adding a bid to the cache"""
high_bid
=
[
0.111
,
489
]
mid_bid
=
[
0.018
,
300
]
low_bid
=
[
0.001
,
100
]
for
bid
in
[
high_bid
,
low_bid
,
mid_bid
]:
fresh_cache
.
add_bid
(
bid
)
bids
=
fresh_cache
.
get_bids
()
assert
len
(
bids
)
==
3
assert
bids
==
sorted
(
bids
,
reverse
=
True
)
def
test_add_asks
(
fresh_cache
):
"""Verify basic functionality for adding an ask to the cache"""
high_ask
=
[
0.111
,
489
]
mid_ask
=
[
0.018
,
300
]
low_ask
=
[
0.001
,
100
]
for
ask
in
[
high_ask
,
low_ask
,
mid_ask
]:
fresh_cache
.
add_ask
(
ask
)
asks
=
fresh_cache
.
get_asks
()
# Three asks should be in the cache
assert
len
(
asks
)
==
3
# Lowest ask price should be first (ascending order)
assert
asks
==
sorted
(
asks
)
Back
|
FazBrowse Home
|
New Git URL