def pprint_positions(position):
    """
    custom print for TQSDK positions 

    Args:
        position (tqsdk's position object)

    Returns:
        str: the formated string
    """
    open_cost = 0
    if position.pos > 0:
        open_cost = position.open_price_long
    elif position.pos < 0 :
        open_cost = position.open_price_short
    s = "Contract: {}, Net Holding: {}, pos long : {}, pos short: {}, open cost (avg): {}".format(position.instrument_id, position.pos, position.pos_long, position.pos_short, open_cost)
    return s