Skip to content

Commit

Permalink
fix trade size calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
qianyun210603 committed Nov 27, 2023
1 parent b641606 commit f90db1f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion qlib/contrib/strategy/signal_strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,8 @@ def _generate_decisions_from_bs_list(
cash += trade_val - trade_cost
# buy new stock
# note the current has been changed
value = cash * self.risk_degree / len(buy) if len(buy) > 0.0 else 0.0
vacancy = self.topk - len(current_stock_list) + len(sell)
value = cash * self.risk_degree / vacancy if vacancy > 0 else 0.0

# open_cost should be considered in the real trading environment, while the backtest in evaluate.py does not
# consider it as the aim of demo is to accomplish same strategy as evaluate.py, so comment out this line
Expand Down

0 comments on commit f90db1f

Please sign in to comment.