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 |
|
|
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;
}
}
处理逻辑:略