今晚的美股又跳水惹
假如我們預計要掛個價格出去但發現價格不如預期的往反方向走,該怎麼辦呢?
當然是趕快抽單或是做逆勢單囉
首先 先設定好要掛的單子(order)與送出單子(trade)
contract = api.Contracts.Futures.TXF['TXF202110']
order = api.Order(
action='Sell',
price=17760,
quantity=1,
price_type='LMT',
order_type='ROD',
octype=sj.constant.FuturesOCType.Auto,
account=api.futopt_account
)
trade = api.place_order(contract, order)
回傳
OrderState.FOrder {
'operation': {
'op_type': 'New',
'op_code': '00',
'op_msg': ''
},
'order': {
'id': '02c347f7',
'seqno': '956201',
'ordno': 'kY00H',
'action': 'Sell',
'price': 17760.0,
'quantity': 1,
'order_cond': None,
'order_type': 'ROD',
'price_type': 'LMT',
'market_type': 'Night',
'oc_type': 'New',
'subaccount': ''
},
'status': {
'id': '02c347f7',
'exchange_ts': 1625729890,
'modified_price': 0.0,
'cancel_quantity': 0
},
'contract': {
'security_type': 'FUT',
'code': 'TXF',
'exchange': 'TIM',
'delivery_month': '202107',
'strike_price': 0.0,
'option_right': 'Future'
}
}
今天我們要取消送出的單
api.update_status(api.futopt_account)
api.cancel_order(trade)
回傳
OrderState.FOrder {
"operation":{
"op_type":"Cancel",
"op_code":"00",
"op_msg":""
},
"order":{
"id":"02c347f7",
"seqno":"956201",
"ordno":"kY00H",
"action":"Sell",
"price":17760.0,
"quantity":1,
"order_cond":None,
"order_type":"ROD",
"price_type":"CXL",
"market_type":"Night",
"oc_type":"New",
"subaccount":""
},
"status":{
"id":"02c347f7",
"exchange_ts":1625730789,
"modified_price":0.0,
"cancel_quantity":1
},
"contract":{
"security_type":"FUT",
"code":"TXF",
"exchange":"TIM",
"delivery_month":"202107",
"strike_price":0.0,
"option_right":"Future"
}
}
這樣就可以取消送出的單,假如已經成交的單子就沒辦法了,要趕快設停損
當然也有很多右側交易者摩拳擦掌,要抄底...
看起來最近還要震盪一陣子