Beispiel #1
0
 def set_price(price_info: Price, contract: sj.contracts.Contract):
     if price_info.price_type == PriceType.LimitUp:
         price_info.price = contract.limit_up
     elif price_info.price_type == PriceType.LimitDown:
         price_info.price = contract.limit_down
     elif price_info.price_type == PriceType.Unchanged:
         price_info.price = contract.reference
     return PriceGap(**dict(price_info))
Beispiel #2
0
 def adjust_condition(self, condition: TouchOrderCond,
                      contract: sj.contracts.Contract):
     tconds_dict = condition.touch_cmd.dict()
     tconds_dict.pop("code")
     if tconds_dict:
         for key, value in tconds_dict.items():
             if key not in ["volume", "total_volume"]:
                 tconds_dict[key] = TouchOrderExecutor.set_price(
                     Price(**value), contract)
         tconds_dict["order_contract"] = self.contracts[
             condition.order_cmd.code]
         tconds_dict["order"] = condition.order_cmd.order
         return StoreCond(**tconds_dict)