2020 StarkDebuggingOrderAmountsModel ,
2121 StarkSettlementModel ,
2222 TimeInForce ,
23+ SelfTradeProtectionLevel ,
2324)
2425from x10 .utils .date import to_epoch_millis , utc_now
2526from x10 .utils .starkex import generate_nonce , hash_order
@@ -36,6 +37,7 @@ def create_order_object(
3637 expire_time = utc_now () + timedelta (hours = 8 ),
3738 order_external_id : Optional [str ] = None ,
3839 time_in_force : TimeInForce = TimeInForce .GTT ,
40+ self_trade_protection_level : SelfTradeProtectionLevel = SelfTradeProtectionLevel .ACCOUNT ,
3941) -> PerpetualOrderModel :
4042 """
4143 Creates an order object to be placed on the exchange using the `place_order` method.
@@ -56,6 +58,7 @@ def create_order_object(
5658 previous_order_external_id = previous_order_id ,
5759 order_external_id = order_external_id ,
5860 time_in_force = time_in_force ,
61+ self_trade_protection_level = self_trade_protection_level ,
5962 )
6063
6164
@@ -74,6 +77,7 @@ def __create_order_object(
7477 previous_order_external_id : Optional [str ] = None ,
7578 order_external_id : Optional [str ] = None ,
7679 time_in_force : TimeInForce = TimeInForce .GTT ,
80+ self_trade_protection_level : SelfTradeProtectionLevel = SelfTradeProtectionLevel .ACCOUNT ,
7781) -> PerpetualOrderModel :
7882 if exact_only :
7983 raise NotImplementedError ("`exact_only` option is not supported yet" )
@@ -130,6 +134,7 @@ def __create_order_object(
130134 time_in_force = time_in_force ,
131135 expiry_epoch_millis = to_epoch_millis (expire_time ),
132136 fee = amounts .fee_rate ,
137+ self_trade_protection_level = self_trade_protection_level ,
133138 nonce = Decimal (nonce ),
134139 cancel_id = previous_order_external_id ,
135140 settlement = settlement ,
0 commit comments