-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calculate available volume using book percentage #37
Conversation
jorgegarcia7
commented
Feb 27, 2023
- calculate_available_volume() returns the available volume up to a certain max. book percentage.
…ertain max. level of overround.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Can you lint with black (https://github.com/psf/black)?
- Can you add a docstring?
betfairutil/__init__.py
Outdated
""" | ||
available_volume = 0 | ||
for depth in range(10): | ||
book_percentage, size = 0, 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you split this onto two separate lines?
betfairutil/__init__.py
Outdated
:return: Available total volume. | ||
""" | ||
available_volume = 0 | ||
for depth in range(10): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you replace with
for depth in itertools.count():
betfairutil/__init__.py
Outdated
if book_percentage < max_book_percentage: | ||
available_volume += size | ||
|
||
return available_volume |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove this line? Coverage has dropped because it never gets hit. But if we switch to itertools.count()
above then this line is no longer needed
tests/test_non_prices.py
Outdated
@@ -13,7 +13,7 @@ | |||
from betfairlightweight.resources import RunnerBook | |||
from pyrsistent import pmap | |||
|
|||
from betfairutil import calculate_book_percentage | |||
from betfairutil import calculate_book_percentage, calculate_available_volume |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you put these on two separate lines?