From df9745f13433a7b0b03a8017c052e414d79c0ddb Mon Sep 17 00:00:00 2001 From: Dong Zhou Date: Fri, 15 Oct 2021 09:07:03 +0000 Subject: [PATCH] support empty order --- qlib/contrib/strategy/order_generator.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/qlib/contrib/strategy/order_generator.py b/qlib/contrib/strategy/order_generator.py index ee20be947..5dfef1510 100644 --- a/qlib/contrib/strategy/order_generator.py +++ b/qlib/contrib/strategy/order_generator.py @@ -80,6 +80,9 @@ class OrderGenWInteract(OrderGenerator): :rtype: list """ + if target_weight_position is None: + return [] + # calculate current_tradable_value current_amount_dict = current.get_stock_amount_dict() @@ -164,6 +167,9 @@ class OrderGenWOInteract(OrderGenerator): :rtype: list of generated orders """ + if target_weight_position is None: + return [] + risk_total_value = risk_degree * current.calculate_value() current_stock = current.get_stock_list()