fix协议介绍19-交易报告(TradeCaptureReport )

35 篇文章 0 订阅
34 篇文章 16 订阅


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.
Component StandardHeader BaseHeader

MsgType = AE

 
Component ApplicationSequenceControl ApplSeqCtrl      
571 TradeReportID @RptID  

TradeReportID is conditionally required in a message-chaining model in which a subsequent message may refer to a prior message via TradeReportRefID. The alternative to a message-chain model is an entity-based model in which TradeID is used to identify a trade. In this case, TradeID is required and TradeReportID can be optionally specified.

 
1003 TradeID @TrdID      
1040 SecondaryTradeID @TrdID2      
1041 FirmTradeID @FirmTrdID      
1042 SecondaryFirmTradeID @FirmTrdID2      
487 TradeReportTransType @TransTyp  

Identifies Trade Report message transaction type.

 
856 TradeReportType @RptTyp      
939 TrdRptStatus @TrdRptStat  

Status of Trade Report

In 3 party listed derivatives model used to convey status of a trade to a counterparty. Used specifically in a "claim" model.

 
568 TradeRequestID @ReqID  

Request ID if the Trade Capture Report is in response to a Trade Capture Report Request

 
828 TrdType @TrdTyp      
829 TrdSubType @TrdSubTyp      
855 SecondaryTrdType @TrdTyp2      
1123 TradeHandlingInstr @TrdHandlInst      
1124 OrigTradeHandlingInstr @OrigTrdHandlInst      
1125 OrigTradeDate @OrigTrdDt  

Used to preserve original trade date when original trade is being referenced in a subsequent trade transaction such as a transfer

 
1126 OrigTradeID @OrigTrdID  

Used to preserve original trade id when original trade is being referenced in a subsequent trade transaction such as a transfer

 
1127 OrigSecondaryTradeID @OrignTrdID2  

Used to preserve original secondary trade id when original trade is being referenced in a subsequent trade transaction such as a transfer

 
830 TransferReason @TrnsfrRsn      
150 ExecType @ExecTyp  

Type of Execution being reported:

Uses subset of ExecType for Trade Capture Reports

 
748 TotNumTradeReports @TotNumTrdRpts  

Number of trade reports returned - if this report is part of a response to a Trade Capture Report Request

 
912 LastRptRequested @LastRptReqed  

Indicates if this is the last report in the response to a Trade Capture Report Request

 
325 UnsolicitedIndicator @Unsol  

Set to 'Y' if message is sent as a result of a subscription request or out of band configuration as opposed to a Position Request.

 
263 SubscriptionRequestType @SubReqTyp  

Used to subscribe / unsubscribe for trade capture reports. If the field is absent, the value 0 will be the default

 
572 TradeReportRefID @RptRefID  

The TradeReportID that is being referenced for some action, such as correction or cancellation

 
881 SecondaryTradeReportRefID @RptRefID2     FIX.5.0
818 SecondaryTradeReportID @RptID2     FIX.5.0
820 TradeLinkID @LinkID  

Used to associate a group of trades together. Useful for average price calculations.

 
880 TrdMatchID @MtchID      
17 ExecID @ExecID  

Market (Exchange) assigned Execution Identifier

 
527 SecondaryExecID @ExecID2      
378 ExecRestatementReason @ExecRstmtRsn  

Reason for restatement

 
570 PreviouslyReported @PrevlyRpted  

Indicates if the trade capture report was previously reported to the counterparty

 
423 PriceType @PxTyp  

Can be used to indicate cabinet trade pricing

 
Component RootParties Pty  

Insert here the set of "Root Parties" fields defined in "common components of application messages" Used for acting parties that applies to the whole message, not individual legs, sides, etc..

 
1015 AsOfIndicator @AsOfInd  

Indicates if the trade is an outtrade from a previous day.

 
716 SettlSessID @SetSesID      
717 SettlSessSubID @SetSesSub      
1430 VenueType @VenuTyp      
1300 MarketSegmentID @MktSegID      
1301 MarketID @MktID      
Component Instrument Instrmt

Insert here the set of "Instrument" (symbology) fields defined in "Common Components of Application Messages"

 
Component FinancingDetails FinDetls  

Insert here the set of "FinancingDetails" fields defined in "Common Components of Application Messages"

 
854 QtyType @QtyTyp      
Component YieldData Yield  

Insert here the set of "YieldData" fields defined in "Common Components of Application Messages"

 
Component UndInstrmtGrp Undly      
822 UnderlyingTradingSessionID @UndSesID      
823 UnderlyingTradingSessionSubID @UndSesSub      
32 LastQty @LastQty

Trade Quantity.

 
31 LastPx @LastPx

Trade Price.

 
1056 CalculatedCcyLastQty @CalcCcyLastQty      
15 Currency @Ccy  

Primary currency of the specified currency pair. Used to qualify LastQty and GrossTradeAmout

 
120 SettlCurrency @SettlCcy  

Contra currency of the deal. Used to qualify CalculatedCcyLastQty

 
669 LastParPx @LastParPx  

Last price expressed in percent-of-par. Conditionally required for Fixed Income trades when LastPx is expressed in Yield, Spread, Discount or any other price type that is not percent-of-par.

 
194 LastSpotRate @LastSpotRt  

Applicable for F/X orders

 
195 LastForwardPoints @LastFwdPnts  

Applicable for F/X orders

 
1071 LastSwapPoints @LastSwapPnts      
30 LastMkt @LastMkt      
75 TradeDate @TrdDt  

Used when reporting other than current day trades.

 
715 ClearingBusinessDate @BizDt      
6 AvgPx @AvgPx  

Average Price - if present then the LastPx will contain the original price on the execution

 
Component SpreadOrBenchmarkCurveData SprdBnchmkCurve  

Insert here the set of "SpreadOrBenchmarkCurveData" fields defined in "Common Components of Application Messages"

 
819 AvgPxIndicator @AvgPxInd  

Average Pricing indicator

 
Component PositionAmountData Amt  

Insert here here the set of "Position Amount Data" fields defined in "Common Components of Application Messages"

 
442 MultiLegReportingType @MLegRptTyp  

Type of report if multileg instrument.

Provided to support a scenario for trades of multileg instruments between two parties.

 
824 TradeLegRefID @TrdLegRefID  

Reference to the leg of a multileg instrument to which this trade refers

Used when MultiLegReportingType = 2 (Single Leg of a Multileg security)

 
Component TrdInstrmtLegGrp TrdLeg  

Number of legs

Identifies a Multi-leg Execution if present and non-zero.

 
60 TransactTime @TxnTm  

Time the transaction represented by this Trade Capture Report occurred. Execution Time of trade. Also describes the time of block trades.

 
Component TrdRegTimestamps TrdRegTS      
63 SettlType @SettlTyp      
64 SettlDate @SettlDt  

Takes precedence over SettlType value and conditionally required/omitted for specific SettlType values.

 
987 UnderlyingSettlementDate @StlDt  

The settlement date for the underlying instrument of a derivatives security.

 
573 MatchStatus @MtchStat      
574 MatchType @MtchTyp      
Component TrdCapRptSideGrp RptSide

Number of sides

 
1188 Volatility @Vol      
1380 DividendYield @DividendYield      
1190 RiskFreeRate @RFR      
1382 CurrencyRatio @CurrencyRatio      
797 CopyMsgIndicator @CopyMsgInd  

Indicates drop copy.

 
Component TrdRepIndicatorsGrp TrdRepIndicatorsGrp  

Number of trade reporting indicators following

 
852 PublishTrdIndicator @PubTrdInd     FIX.5.0
1390 TradePublishIndicator @TrdPubInd      
853 ShortSaleReason @ShrtSaleRsn      
994 TierCode @TierCD  

Indicates the algorithm (tier) used to match a trade

 
1011 MessageEventSource @MsgEvtSrc  

Used to identify the event or source which gave rise to a message

 
779 LastUpdateTime @LastUpdateTm  

Used to indicate reports after a specific time

 
991 RndPx @RndPx  

Specifies the rounded price to quoted precision.

 
1132 TZTransactTime @TZTransactTime      
1134 ReportedPxDiff @ReportedPxDiff  

The reason(s) for the price difference should be stated by using field (Tag 828 ) TrdType and, if required, field (Tag 829) TrdSubType as well

 
381 GrossTradeAmt @GrossTrdAmt  

(LastQty(32) * LastPx(31) or LastParPx(669)) For Fixed Income, LastParPx(669) is used when LastPx(31) is not expressed as "percent of par" price.

 
1328 RejectText @RejTxt      
1329 FeeMultiplier @FeeMult      
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-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;
	}

}

处理逻辑:略



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

hxpjava1

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值