首页 > 其他分享 >fix协议介绍12-取消订单被拒(OrderCacelReject)

fix协议介绍12-取消订单被拒(OrderCacelReject)

时间:2023-01-01 14:00:54浏览次数:70  
标签:12 ordStatus tagIdsSet fix add Tag new OrderCacelReject public


FIX.5.0SP2 Message

OrderCancelReject [type '9']

<OrdCxlRej>


The order cancel reject message is issued by the broker upon receipt of a cancel request or cancel/replace request message which cannot be honored.




Added  FIX.2.7

Expand Components | Collapse Components

 

Field or Component

Field Name

FIXML name

Req'd

Comments

Depr.


Component

StandardHeader

BaseHeader


MsgType = 9

 


​37​

​OrderID​

@OrdID


If CxlRejReason="Unknown order", specify "NONE".

 


​198​

​SecondaryOrderID​

@OrdID2

 

Can be used to provide order id used by exchange or executing system.

 


​526​

​SecondaryClOrdID​

@ID2

 

 

 


​11​

​ClOrdID​

@ID


Unique order id assigned by institution or by the intermediary with closest association with the investor. to the cancel request or to the replacement order.

 


​583​

​ClOrdLinkID​

@LnkID

 

 

 


​41​

​OrigClOrdID​

@OrigID

 

ClOrdID(11) which could not be canceled/replaced. ClOrdID of the previous accepted order (NOT the initial order of the day) when canceling or replacing an order.

Required when referring to orders that were electronically submitted over FIX or otherwise assigned a ClOrdID.

 


​39​

​OrdStatus​

@Stat


OrdStatus value after this cancel reject is applied.

If CxlRejReason = "Unknown Order", specify Rejected.

 


​636​

​WorkingIndicator​

@WorkingInd

 

For optional use with OrdStatus = 0 (New)

 


​586​

​OrigOrdModTime​

@OrigOrdModTm

 

 

 


​66​

​ListID​

@ListID

 

Required for rejects against orders which were submitted as part of a list.

 


​1​

​Account​

@Acct

 

 

 


​660​

​AcctIDSource​

@AcctIDSrc

 

 

 


​581​

​AccountType​

@AcctTyp

 

 

 


​229​

​TradeOriginationDate​

@OrignDt

 

 

 


​75​

​TradeDate​

@TrdDt

 

 

 


​60​

​TransactTime​

@TxnTm

 

 

 


​434​

​CxlRejResponseTo​

@CxlRejRspTo


 

 


​102​

​CxlRejReason​

@CxlRejRsn

 

 

 


​58​

​Text​

@Txt

 

 

 


​354​

​EncodedTextLen​

@EncTxtLen

 

Must be set if EncodedText field is specified and must immediately precede it.

 


​355​

​EncodedText​

@EncTxt

 

Encoded (non-ASCII characters) representation of the Text field in the encoded format specified via the MessageEncoding field.

 


Component

StandardTrailer

 


 

 


消息实现:

package cs.mina.codec.msg;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

import cs.mina.exception.InValidDataException;

/*
*@author(huangxiaoping)
*@date 2013-11-29
*/
public class OrderCancelRejectMsg extends BaseMsg {
private Tag clOrdID=new Tag("11","String",true);
private Tag parties=new PartiesTag(false);
private Tag orderID=new Tag("37","String",true);
private Tag origClOrdID=new Tag("41","String",false);
private Tag ordStatus=new Tag("39","char",true);
private Tag cxlRejResponseTo=new Tag("434","char",true);
private Tag cxlRejReason=new Tag("102","int",false);
private Tag rejectText=new Tag("1328","String",false);
private Tag transactTime=new Tag("60","UTCTimestamp",true);

private Set<String> tagIdsSet=new HashSet<String>();
public OrderCancelRejectMsg(){
this.getHeadEntity().getMsgType().setTagValue("9");
tagIdsSet.add("11");
tagIdsSet.add("37");
tagIdsSet.add("41");
tagIdsSet.add("39");
tagIdsSet.add("434");
tagIdsSet.add("102");
tagIdsSet.add("1328");
tagIdsSet.add("60");
this.bodyEntity.getBodyTagList().add(clOrdID);
this.bodyEntity.getBodyTagList().add(parties);
this.bodyEntity.getBodyTagList().add(orderID);
this.bodyEntity.getBodyTagList().add(origClOrdID);
this.bodyEntity.getBodyTagList().add(ordStatus);
this.bodyEntity.getBodyTagList().add(cxlRejResponseTo);
this.bodyEntity.getBodyTagList().add(cxlRejReason);
this.bodyEntity.getBodyTagList().add(rejectText);
this.bodyEntity.getBodyTagList().add(transactTime);
}

@Override
public void decodeBody() {
Set<String> already=new HashSet<String>();
String input=this.body;
while(input.length()!=0){
String firstTagId=input.substring(0, input.indexOf("="));
if(firstTagId.equals("453")){
input=this.getParties().decode(input, already);
}else{
List<Tag> tagList=this.bodyEntity.getBodyTagList();
boolean exist=false;
for(int j=0;j<tagList.size();j++){
Tag tag=tagList.get(j);
if(tag.getTagId().equals(firstTagId)){
input=tag.decode(input, already);
exist=true;
break;
}
}
if(!exist){
throw new InValidDataException(firstTagId+"不在消息字段中");
}
}

}
}

@Override
public void validate() {
this.headEntity.validate();
List<Tag> bodyTagList=this.bodyEntity.getBodyTagList();
for(int i=0;i<bodyTagList.size();i++){
bodyTagList.get(i).validate();
}
this.tailerEntity.validate();
if(ordStatus.getTagValue()!=null){
if(!MsgUtil.ordStatus.contains(ordStatus.getTagValue())){
throw new InValidDataException("ordStatus错误["+ordStatus.getTagId()+"="+ordStatus.getTagValue()+"]");
}
}
if(cxlRejResponseTo.getTagValue()!=null){
if(!MsgUtil.cxlRejResponseTo.contains(cxlRejResponseTo.getTagValue())){
throw new InValidDataException("cxlRejResponseTo错误["+cxlRejResponseTo.getTagId()+"="+cxlRejResponseTo.getTagValue()+"]");
}
}
if(cxlRejReason.getTagValue()!=null){
if(!((Integer.parseInt(cxlRejReason.getTagValue())>=0&&Integer.parseInt(cxlRejReason.getTagValue())<=8)||Integer.parseInt(cxlRejReason.getTagValue())==18||Integer.parseInt(cxlRejReason.getTagValue())==99||Integer.parseInt(cxlRejReason.getTagValue())==103)){
throw new InValidDataException("cxlRejReason错误["+cxlRejReason.getTagId()+"="+cxlRejReason.getTagValue()+"]");
}
}
}

public Tag getClOrdID() {
return clOrdID;
}

public void setClOrdID(Tag clOrdID) {
this.clOrdID = clOrdID;
}

public Tag getParties() {
return parties;
}

public void setParties(Tag parties) {
this.parties = parties;
}

public Tag getOrderID() {
return orderID;
}

public void setOrderID(Tag orderID) {
this.orderID = orderID;
}

public Tag getOrigClOrdID() {
return origClOrdID;
}

public void setOrigClOrdID(Tag origClOrdID) {
this.origClOrdID = origClOrdID;
}

public Tag getOrdStatus() {
return ordStatus;
}

public void setOrdStatus(Tag ordStatus) {
this.ordStatus = ordStatus;
}

public Tag getCxlRejResponseTo() {
return cxlRejResponseTo;
}

public void setCxlRejResponseTo(Tag cxlRejResponseTo) {
this.cxlRejResponseTo = cxlRejResponseTo;
}

public Tag getCxlRejReason() {
return cxlRejReason;
}

public void setCxlRejReason(Tag cxlRejReason) {
this.cxlRejReason = cxlRejReason;
}

public Tag getRejectText() {
return rejectText;
}

public void setRejectText(Tag rejectText) {
this.rejectText = rejectText;
}

public Tag getTransactTime() {
return transactTime;
}

public void setTransactTime(Tag transactTime) {
this.transactTime = transactTime;
}

public Set<String> getTagIdsSet() {
return tagIdsSet;
}

public void setTagIdsSet(Set<String> tagIdsSet) {
this.tagIdsSet = tagIdsSet;
}

}


处理逻辑:略




标签:12,ordStatus,tagIdsSet,fix,add,Tag,new,OrderCacelReject,public
From: https://blog.51cto.com/u_11979904/5982988

相关文章