Ejemplo n.º 1
0
def read_is_short_restricted(field):
    """Return True if the stock cannot be sold short."""
    if field != "":
        if field == 'Y':
            return True
        if field == 'N':
            return False
        else:
            raise UnexpectedField(
                "Unknown Value in Short Restricted Field: %s" % field)
    else:
        return False
Ejemplo n.º 2
0
def read_tick_direction(field):
    """
    1 if last tick was an uptick, -1 for downtick, 0 for zero-tick.

    Throws a BadField exception if
    """
    if field != "":
        field_as_int = int(field)
        if field_as_int == 173:
            return np.int8(1)
        if field_as_int == 175:
            return np.int8(-1)
        if field_as_int == 183:
            return np.int8(0)
        else:
            raise UnexpectedField(
                "Unknown value in Tick Direction Field: %s" % field)
    else:
        return np.int8(0)