88from tigeropen .common .consts import OrderStatus
99
1010
11- def market_order (account , contract , action , quantity , user_id = None ):
11+ def market_order (account , contract , action , quantity , secret_key = None ):
1212 """
1313 市价单
1414 :param account:
@@ -17,10 +17,10 @@ def market_order(account, contract, action, quantity, user_id=None):
1717 :param quantity:
1818 :return:
1919 """
20- return Order (account , contract , action , 'MKT' , quantity , user_id = user_id )
20+ return Order (account , contract , action , 'MKT' , quantity , secret_key = secret_key )
2121
2222
23- def limit_order (account , contract , action , quantity , limit_price , user_id = None ):
23+ def limit_order (account , contract , action , quantity , limit_price , secret_key = None ):
2424 """
2525 限价单
2626 :param account:
@@ -30,10 +30,10 @@ def limit_order(account, contract, action, quantity, limit_price, user_id=None):
3030 :param limit_price: 限价的价格
3131 :return:
3232 """
33- return Order (account , contract , action , 'LMT' , quantity , limit_price = limit_price , user_id = user_id )
33+ return Order (account , contract , action , 'LMT' , quantity , limit_price = limit_price , secret_key = secret_key )
3434
3535
36- def stop_order (account , contract , action , quantity , aux_price , user_id = None ):
36+ def stop_order (account , contract , action , quantity , aux_price , secret_key = None ):
3737 """
3838 止损单
3939 :param account:
@@ -43,10 +43,10 @@ def stop_order(account, contract, action, quantity, aux_price, user_id=None):
4343 :param aux_price: 触发止损单的价格
4444 :return:
4545 """
46- return Order (account , contract , action , 'STP' , quantity , aux_price = aux_price , user_id = user_id )
46+ return Order (account , contract , action , 'STP' , quantity , aux_price = aux_price , secret_key = secret_key )
4747
4848
49- def stop_limit_order (account , contract , action , quantity , limit_price , aux_price , user_id = None ):
49+ def stop_limit_order (account , contract , action , quantity , limit_price , aux_price , secret_key = None ):
5050 """
5151 限价止损单
5252 :param account:
@@ -58,10 +58,10 @@ def stop_limit_order(account, contract, action, quantity, limit_price, aux_price
5858 :return:
5959 """
6060 return Order (account , contract , action , 'STP_LMT' , quantity , limit_price = limit_price , aux_price = aux_price ,
61- user_id = user_id )
61+ secret_key = secret_key )
6262
6363
64- def trail_order (account , contract , action , quantity , trailing_percent = None , aux_price = None , user_id = None ):
64+ def trail_order (account , contract , action , quantity , trailing_percent = None , aux_price = None , secret_key = None ):
6565 """
6666 移动止损单
6767 :param account:
@@ -73,7 +73,7 @@ def trail_order(account, contract, action, quantity, trailing_percent=None, aux_
7373 :return:
7474 """
7575 return Order (account , contract , action , 'TRAIL' , quantity , trailing_percent = trailing_percent , aux_price = aux_price ,
76- user_id = user_id )
76+ secret_key = secret_key )
7777
7878
7979def order_leg (leg_type , price , time_in_force = 'DAY' , outside_rth = None ):
@@ -87,7 +87,7 @@ def order_leg(leg_type, price, time_in_force='DAY', outside_rth=None):
8787 return OrderLeg (leg_type = leg_type , price = price , time_in_force = time_in_force , outside_rth = outside_rth )
8888
8989
90- def limit_order_with_legs (account , contract , action , quantity , limit_price , order_legs = None , user_id = None ):
90+ def limit_order_with_legs (account , contract , action , quantity , limit_price , order_legs = None , secret_key = None ):
9191 """
9292 限价单 + 附加订单(仅环球账户支持)
9393 :param account:
@@ -101,7 +101,7 @@ def limit_order_with_legs(account, contract, action, quantity, limit_price, orde
101101 if order_legs and len (order_legs ) > 2 :
102102 raise Exception ('2 order legs at most' )
103103 return Order (account , contract , action , 'LMT' , quantity , limit_price = limit_price , order_legs = order_legs ,
104- user_id = user_id )
104+ secret_key = secret_key )
105105
106106
107107def algo_order_params (start_time = None , end_time = None , no_take_liq = None , allow_past_end_time = None , participation_rate = None ):
@@ -118,7 +118,7 @@ def algo_order_params(start_time=None, end_time=None, no_take_liq=None, allow_pa
118118 allow_past_end_time = allow_past_end_time , participation_rate = participation_rate )
119119
120120
121- def algo_order (account , contract , action , quantity , strategy , algo_params = None , limit_price = None , user_id = None ):
121+ def algo_order (account , contract , action , quantity , strategy , algo_params = None , limit_price = None , secret_key = None ):
122122 """
123123 算法订单
124124 :param account:
@@ -131,7 +131,7 @@ def algo_order(account, contract, action, quantity, strategy, algo_params=None,
131131 :return:
132132 """
133133 return Order (account , contract , action , order_type = strategy , quantity = quantity , algo_params = algo_params ,
134- limit_price = limit_price , outside_rth = False , user_id = user_id )
134+ limit_price = limit_price , outside_rth = False , secret_key = secret_key )
135135
136136
137137def get_order_status (value ):
0 commit comments