docstr: Parameters
  ----------
  topk : int
      top-N stocks to buy
  risk_degree : float
      position percentage of total value buy_method:
  
          rank_fill: assign the weight stocks that rank high first(1/topk max)
          average_fill: assign the weight to the stocks rank high averagely.
docstr_tok: ["Parameters","--","--","--","--","--","topk",":","int","top-N","stocks","to","buy","risk_degree",":","float","position","percentage","of","total","value","buy_method",":","rank_fill",":","assign","the","weight","stocks","that","rank","high","first","(","1\/topk","max",")","average_fill",":","assign","the","weight","to","the","stocks","rank","high","averagely","."]
code: def __init__(
      self,
      model,
      dataset,
      topk,
      order_generator_cls_or_obj=OrderGenWInteract,
      max_sold_weight=1.0,
      risk_degree=0.95,
      buy_method="first_fill",
      trade_exchange=None,
      level_infra=None,
      common_infra=None,
      **kwargs,
  ):
      """
      Parameters
      ----------
      topk : int
          top-N stocks to buy
      risk_degree : float
          position percentage of total value buy_method:
  
              rank_fill: assign the weight stocks that rank high first(1/topk max)
              average_fill: assign the weight to the stocks rank high averagely.
      """
      super(SoftTopkStrategy, self).__init__(
          model,
          dataset,
          order_generator_cls_or_obj,
          trade_exchange,
          level_infra,
          common_infra,
          **kwargs,
      )
      self.topk = topk
      self.max_sold_weight = max_sold_weight
      self.risk_degree = risk_degree
      self.buy_method = buy_method
  
file_path: qlib/qlib/contrib/strategy/cost_control.py
imports: from .order_generator import OrderGenWInteract
  from .signal_strategy import WeightStrategyBase
  import copy
label_desc: Use image node_id 1 to create a new SoftTopkStrategy object from inherited base classes: WeightStrategyBase with example: obj = SoftTopkStrategy(model, dataset, topk, order_generator_cls_or_obj, max_sold_weight, risk_degree, buy_method, trade_exchange, level_infra, common_infra)