def get_open_orders_kraken_result_processor(json_document, pair_name): open_orders = EMPTY_LIST if is_error(open_orders) or "open" not in json_document["result"]: msg = "get_open_orders_kraken_result_processor - error response - {er}".format( er=json_document) log_to_file(msg, ERROR_LOG_FILE_NAME) return open_orders for order_id in json_document["result"]["open"]: new_order = Trade.from_kraken( order_id, json_document["result"]["open"][order_id]) if new_order is not None: open_orders.append(new_order) return open_orders
def get_order_history_kraken_result_processor(json_document, pair_name): """ json_document - response from exchange api as json string pair_name - for backwords compabilities """ orders = EMPTY_LIST if is_error(json_document) or "closed" not in json_document["result"]: msg = "get_order_history_kraken_result_processor - error response - {er}".format( er=json_document) log_to_file(msg, ERROR_LOG_FILE_NAME) return orders for order_id in json_document["result"]["closed"]: new_order = Trade.from_kraken( order_id, json_document["result"]["closed"][order_id]) if new_order is not None: orders.append(new_order) return orders