FIX.5.0SP2 Message
TradeCaptureReport [type 'AE']
<TrdCaptRpt>
The Trade Capture Report message can be:
• Used to report trades between counterparties.
• Used to report trades to a trade matching system
• Can be sent unsolicited between counterparties.
• Sent as a reply to a Trade Capture Report Request.
• Can be used to report unmatched and matched trades.
Added FIX.4.3
Expand Components | Collapse Components
| Field or Component | Field Name | FIXML name | Req'd | Comments | Depr. |
|
消息实现:
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-12-2
*/
public class TradeCaptureReportMsg extends BaseMsg {
private Tag tradeReportID=new Tag("571","String",false);
private Tag tradeReportTransType=new Tag("487","int",false);
private Tag tradeReportType=new Tag("856","int",false);
private Tag trdType=new Tag("828","int",false);
private Tag tradeHandlingInstr=new Tag("1123","char",false);
private Tag lastPx=new Tag("31","Price",true);
private Tag lastQty=new Tag("32","Qty",true);
private Tag transactTime = new Tag("60", "UTCTimestamp", false);
private Tag trdCapRptSideGrp=new TrdCapRptSideGrpTag(true);
private Tag instrument = new InstrumentTag(true);
private Tag exchangeTradeType=new Tag("5681","char",false);
private Tag execType=new Tag("150","char",false);
private Tag tradeID=new Tag("1003","String",false);
private Tag trdRptStatus=new Tag("939","int",false);
private Set<String> tagIdsSet = new HashSet<String>();
public TradeCaptureReportMsg(){
this.getHeadEntity().getMsgType().setTagValue("AE");
tagIdsSet.add("571");
tagIdsSet.add("487");
tagIdsSet.add("856");
tagIdsSet.add("828");
tagIdsSet.add("1123");
tagIdsSet.add("31");
tagIdsSet.add("32");
tagIdsSet.add("60");
tagIdsSet.add("5681");
tagIdsSet.add("150");
tagIdsSet.add("1003");
tagIdsSet.add("939");
this.bodyEntity.getBodyTagList().add(tradeReportID);
this.bodyEntity.getBodyTagList().add(tradeReportTransType);
this.bodyEntity.getBodyTagList().add(tradeReportType);
this.bodyEntity.getBodyTagList().add(trdType);
this.bodyEntity.getBodyTagList().add(tradeHandlingInstr);
this.bodyEntity.getBodyTagList().add(lastPx);
this.bodyEntity.getBodyTagList().add(lastQty);
this.bodyEntity.getBodyTagList().add(transactTime);
this.bodyEntity.getBodyTagList().add(trdCapRptSideGrp);
this.bodyEntity.getBodyTagList().add(instrument);
this.bodyEntity.getBodyTagList().add(exchangeTradeType);
this.bodyEntity.getBodyTagList().add(execType);
this.bodyEntity.getBodyTagList().add(tradeID);
this.bodyEntity.getBodyTagList().add(trdRptStatus);
}
@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("552")){
input=this.getTrdCapRptSideGrp().decode(input, already);
}else if(InstrumentTag.tagIdsSet.contains(firstTagId)){
input=this.instrument.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 (tradeReportTransType.getTagValue() != null) {
if (!(Integer.parseInt(tradeReportTransType.getTagValue()) >= 0 && Integer
.parseInt(tradeReportTransType.getTagValue()) <= 5)) {
throw new InValidDataException("tradeReportTransType错误["
+ tradeReportTransType.getTagId() + "=" + tradeReportTransType.getTagValue()
+ "]");
}
}
if (tradeReportType.getTagValue() != null) {
if (!(Integer.parseInt(tradeReportType.getTagValue()) >= 0 && Integer
.parseInt(tradeReportType.getTagValue()) <= 15)) {
throw new InValidDataException("tradeReportType错误["
+ tradeReportType.getTagId() + "=" + tradeReportType.getTagValue()
+ "]");
}
}
if (trdType.getTagValue() != null) {
if (!(Integer.parseInt(trdType.getTagValue()) >= 0 && Integer
.parseInt(trdType.getTagValue()) <= 55)) {
throw new InValidDataException("trdType错误["
+ trdType.getTagId() + "=" + trdType.getTagValue()
+ "]");
}
}
if(tradeHandlingInstr.getTagValue()!=null){
if(!MsgUtil.tradeHandlingInstr.contains(tradeHandlingInstr.getTagValue())){
throw new InValidDataException("tradeHandlingInstr错误["
+ tradeHandlingInstr.getTagId() + "=" + tradeHandlingInstr.getTagValue()
+ "]");
}
}
if(exchangeTradeType.getTagValue()!=null){
if(!MsgUtil.exchangeTradeType.contains(exchangeTradeType.getTagValue())){
throw new InValidDataException("exchangeTradeType错误["
+ exchangeTradeType.getTagId() + "=" + exchangeTradeType.getTagValue()
+ "]");
}
}
if(execType.getTagValue()!=null){
if(!MsgUtil.execType.contains(execType.getTagValue())){
throw new InValidDataException("execType错误["
+ execType.getTagId() + "=" + execType.getTagValue()
+ "]");
}
}
if(trdRptStatus.getTagValue()!=null){
if(!(Integer.parseInt(trdRptStatus.getTagValue())==0
||Integer.parseInt(trdRptStatus.getTagValue())==1
||Integer.parseInt(trdRptStatus.getTagValue())==3)){
throw new InValidDataException("trdRptStatus错误["
+ trdRptStatus.getTagId() + "=" + trdRptStatus.getTagValue()
+ "]");
}
}
}
public Tag getTradeReportID() {
return tradeReportID;
}
public void setTradeReportID(Tag tradeReportID) {
this.tradeReportID = tradeReportID;
}
public Tag getTradeReportTransType() {
return tradeReportTransType;
}
public void setTradeReportTransType(Tag tradeReportTransType) {
this.tradeReportTransType = tradeReportTransType;
}
public Tag getTradeReportType() {
return tradeReportType;
}
public void setTradeReportType(Tag tradeReportType) {
this.tradeReportType = tradeReportType;
}
public Tag getTrdType() {
return trdType;
}
public void setTrdType(Tag trdType) {
this.trdType = trdType;
}
public Tag getTradeHandlingInstr() {
return tradeHandlingInstr;
}
public void setTradeHandlingInstr(Tag tradeHandlingInstr) {
this.tradeHandlingInstr = tradeHandlingInstr;
}
public Tag getLastPx() {
return lastPx;
}
public void setLastPx(Tag lastPx) {
this.lastPx = lastPx;
}
public Tag getLastQty() {
return lastQty;
}
public void setLastQty(Tag lastQty) {
this.lastQty = lastQty;
}
public Tag getTransactTime() {
return transactTime;
}
public void setTransactTime(Tag transactTime) {
this.transactTime = transactTime;
}
public Tag getTrdCapRptSideGrp() {
return trdCapRptSideGrp;
}
public void setTrdCapRptSideGrp(Tag trdCapRptSideGrp) {
this.trdCapRptSideGrp = trdCapRptSideGrp;
}
public Tag getInstrument() {
return instrument;
}
public void setInstrument(Tag instrument) {
this.instrument = instrument;
}
public Set<String> getTagIdsSet() {
return tagIdsSet;
}
public void setTagIdsSet(Set<String> tagIdsSet) {
this.tagIdsSet = tagIdsSet;
}
public Tag getExchangeTradeType() {
return exchangeTradeType;
}
public void setExchangeTradeType(Tag exchangeTradeType) {
this.exchangeTradeType = exchangeTradeType;
}
public Tag getExecType() {
return execType;
}
public void setExecType(Tag execType) {
this.execType = execType;
}
public Tag getTradeID() {
return tradeID;
}
public void setTradeID(Tag tradeID) {
this.tradeID = tradeID;
}
public Tag getTrdRptStatus() {
return trdRptStatus;
}
public void setTrdRptStatus(Tag trdRptStatus) {
this.trdRptStatus = trdRptStatus;
}
}
处理逻辑:略