Skip to content
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

Merged
merged 5 commits into from
Feb 28, 2023

Conversation

jorgegarcia7
Copy link
Contributor

  • calculate_available_volume() returns the available volume up to a certain max. book percentage.

Copy link
Owner

@mberk mberk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Can you lint with black (https://github.com/psf/black)?
  2. Can you add a docstring?

@mberk mberk changed the base branch from master to release-0.6.0 February 27, 2023 17:03
"""
available_volume = 0
for depth in range(10):
book_percentage, size = 0, 0
Copy link
Owner

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?

:return: Available total volume.
"""
available_volume = 0
for depth in range(10):
Copy link
Owner

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():

if book_percentage < max_book_percentage:
available_volume += size

return available_volume
Copy link
Owner

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

@@ -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
Copy link
Owner

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?

@mberk mberk merged commit 682d236 into mberk:release-0.6.0 Feb 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants