This commit is contained in:
Dobromir Popov
2025-08-05 00:38:41 +03:00
parent 3bbfde5d2b
commit 3e0d7d5a99
7 changed files with 30 additions and 127 deletions

View File

@ -118,6 +118,18 @@ class PriceBucketer:
logger.debug(f"Aggregated {len(bucket_list)} bucket sets")
return aggregated
def get_bucket_price(self, price: float) -> float:
"""
Get the bucket price for a given price.
Args:
price: Original price
Returns:
float: Bucket price (rounded to bucket boundaries)
"""
return math.floor(price / self.bucket_size) * self.bucket_size
def get_bucket_range(self, center_price: float, depth: int) -> Tuple[float, float]:
"""
Get price range for buckets around a center price.