Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions qlib/contrib/strategy/signal_strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,6 @@ def filter_stock(li):
else:
raise NotImplementedError(f"This type of input is not supported")

# Get the stock list we really want to buy
buy = today[: len(sell) + self.topk - len(last)]
for code in current_stock_list:
if not self.trade_exchange.is_stock_tradable(
stock_id=code,
Expand Down Expand Up @@ -260,6 +258,10 @@ def filter_stock(li):
)
# update cash
cash += trade_val - trade_cost

# Get the stock list we really want to buy.
# Buy only enough to keep holdings within topk after the sell orders that were actually generated.
buy = today[: max(0, len(sell_order_list) + self.topk - len(last))]
# buy new stock
# note the current has been changed
# current_stock_list = current_temp.get_stock_list()
Expand Down