您的位置:首页 > 其它

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

2013-12-13 12:43 393 查看


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 ComponentField NameFIXML nameReq'dCommentsDepr.

ComponentStandardHeaderBaseHeader
MsgType = 9

37OrderID@OrdID
If CxlRejReason="Unknown order", specify "NONE".

198SecondaryOrderID@OrdID2Can be used to provide order id used by exchange or executing system.

526SecondaryClOrdID@ID2

11ClOrdID@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.

583ClOrdLinkID@LnkID

41OrigClOrdID@OrigIDClOrdID(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.

39OrdStatus@Stat
OrdStatus value after this cancel reject is applied.

If CxlRejReason = "Unknown Order", specify Rejected.

636WorkingIndicator@WorkingIndFor optional use with OrdStatus = 0 (New)

586OrigOrdModTime@OrigOrdModTm

66ListID@ListIDRequired for rejects against orders which were submitted as part of a list.

1Account@Acct

660AcctIDSource@AcctIDSrc

581AccountType@AcctTyp

229TradeOriginationDate@OrignDt

75TradeDate@TrdDt

60TransactTime@TxnTm

434CxlRejResponseTo@CxlRejRspTo

102CxlRejReason@CxlRejRsn

58Text@Txt

354EncodedTextLen@EncTxtLenMust be set if EncodedText field is specified and must immediately precede it.

355EncodedText@EncTxtEncoded (non-ASCII characters) representation of the Text field in the encoded format specified via the MessageEncoding field.

ComponentStandardTrailer
© 2007 - 2012 FIX Protocol Limited
Contact us
Copyright and Acceptable Use policy
Privacy Policy

消息实现:

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;
}

}


处理逻辑:略
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: