Module orca_whirlpool.internal.utils.position_util

Expand source code
from ..types.enums import PositionStatus


class PositionUtil:
    @staticmethod
    def get_position_status(
        tick_current_index: int,
        tick_lower_index: int,
        tick_upper_index: int,
    ) -> PositionStatus:
        if tick_current_index >= tick_upper_index:
            return PositionStatus.PriceIsAboveRange
        if tick_current_index < tick_lower_index:
            return PositionStatus.PriceIsBelowRange
        return PositionStatus.PriceIsInRange

Classes

class PositionUtil
Expand source code
class PositionUtil:
    @staticmethod
    def get_position_status(
        tick_current_index: int,
        tick_lower_index: int,
        tick_upper_index: int,
    ) -> PositionStatus:
        if tick_current_index >= tick_upper_index:
            return PositionStatus.PriceIsAboveRange
        if tick_current_index < tick_lower_index:
            return PositionStatus.PriceIsBelowRange
        return PositionStatus.PriceIsInRange

Static methods

def get_position_status(tick_current_index: int, tick_lower_index: int, tick_upper_index: int) ‑> PositionStatus
Expand source code
@staticmethod
def get_position_status(
    tick_current_index: int,
    tick_lower_index: int,
    tick_upper_index: int,
) -> PositionStatus:
    if tick_current_index >= tick_upper_index:
        return PositionStatus.PriceIsAboveRange
    if tick_current_index < tick_lower_index:
        return PositionStatus.PriceIsBelowRange
    return PositionStatus.PriceIsInRange