Click here to Skip to main content
15,889,116 members
Articles / All Topics

Receive Trade Capture (AE) Report on FIX Protocol

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
29 Sep 2018CPOL2 min read 5.3K   2
Trade Capture Report (AE) is a post-trade message which is sent by the broker or exchange to report the trades for the participants.

Trade Capture Report (AE) message is a post-trade message which is sent by the broker or exchange to report the trades for participant.

How to Request Trade Capture Report?

A client may use Trade Capture Report Request (AD) to subscribe for trade capture reports based upon selection criteria provided on the trade capture report request.

The server will respond with a Trade Capture Report Request Ack (AR) to indicate, via the TradeRequestStatus (750) and TradeRequestResult (749) fields, whether the request is successful or not. Sometimes if the Trade Capture Report Request message is rejected due to some validations, a Reject message can be generated as the response.

Trade Capture Report Request (AD) Message Structure

Tag Field Name Req Description
568 TradeRequestID Y Request unique identifier
569 TradeRequestType Y Type of request
  • 0: All Trades
  • 1: Trades Matching Specified Criteria If none of the criteria below are specified, this will return all trades.
150 ExecType N Request for all trades of a specific execution type
  <Instrument> block N Request for all trades for the list of instruments
  =>Symbol   Symbol name
  => SecurityId   Security Id
  =>……    

You need to remember that these are standard fields for Trade Capture Report Request (AD) message, the list of supported fields may vary between various FIX formats.

Also, always follow the Rules of engagement document provided by the broker before implementing FIX messages.

Trade Capture Report Request Ack (AC) Message

It is acknowledged message to Trade Capture Report Request (AD)

Tag FieldName Req Description
568 TradeRequestID Y Identifier of the request being acknowledged
569 TradeRequestType Y Identifier of the request being acknowledged
750 TradeRequestStatus Y Whether the request is accepted or rejected
0: Accepted
1: Rejected
749 TradeRequestResult Y Reason the request is rejected.
0: Successful
9: Not Authorized
100: Cannot Match Selection Criteria 200: Request Limit for Day Reached

Trade Capture Report

It is a response message to TradeCapture Report Request (AD) which reports trades between counterparties.

Message Structure

Tag Field Name Req Description
568 TradeRequestID Y Request unique identifier
571 TradeReportID Y Unique Id of response message
17 ExecId Y Identifier of the trade
48 SecurityId N Instrument Id
55 Symbol N Symbol name
32 LastQty Y Traded Quantity
31 LastPx Y Traded Price
75 TradeDate Y Traded date
60 TransactTime Y Transaction time of a trade

Implementation

TradeCaptureReportRequest (AD)

C#
TradeCaptureReportRequest request = new TradeCaptureReportRequest();

string requestId = DateTime.UtcNow.ToString("yyyyMMddHHmmssfff");//generate unique request ID
request.TradeRequestID = new TradeRequestID(requestId);
request.TradeRequestType = new TradeRequestType
(TradeRequestType.MATCHED_TRADES_MATCHING_CRITERIA_PROVIDED_ON_REQUEST);

request.NoDates = new NoDates(2);
//Criteria to get trades between two dates
var noDatesGroup = new TradeCaptureReportRequest.NoDatesGroup();
noDatesGroup.TransactTime = new TransactTime(start);
request.AddGroup(noDatesGroup);
noDatesGroup = new TradeCaptureReportRequest.NoDatesGroup();
noDatesGroup.TransactTime = new TransactTime(end);
request.AddGroup(noDatesGroup);
<br>Session.SendToTarget(request, sessionId);

TradeCaptureReportRequest Ack (AC)

C#
public void OnMessage(TradeCaptureReportRequestAck ackReport, SessionID session)
{
	if (ackReport.TradeRequestStatus.getValue() == TradeRequestStatus.REJECTED)
	{
	  if (OnReject != null)
	   Console.WriteLine("TradeReportRequest Rejected");
	}
	else if (ackReport.TradeRequestStatus.getValue() == TradeRequestStatus.ACCEPTED)
	{
	   Console.WriteLine("TradeReportRequestStatus Accepted");
	}
	else if (ackReport.TradeRequestStatus.getValue() == TradeRequestStatus.COMPLETED)
	{
	  Console.WriteLine("TradeReportRequestStatus COMPLETED");
	}
}

TradeCaptureReport (AE)

C#
public override void OnMessage(TradeCaptureReport ackReport, SessionID session)
{
    //Capturing data in DTO
	TradeReport tradeReport = new TradeReport
	{
	  Id = ackReport.ExecID.getValue(),
	  LastQty = ackReport.LastQty.getValue(),
	  TransactTime = ackReport.IsSetTransactTime() ? 
                     ackReport.TransactTime.getValue() : DateTime.UtcNow,
	  LastPrice = ackReport.LastPx.getValue(),
	  InstrumentId = Convert.ToInt32(ackReport.SecurityID.getValue())
	};

	NoSides noSides = ackReport.NoSides;
	tradeReport.Symbol = _symbolMap[tradeReport.InstrumentId];

	var group = new TradeCaptureReport.NoSidesGroup();
	group = (TradeCaptureReport.NoSidesGroup)ackReport.GetGroup(1, group);
	if (group.IsSetSide())
	{
		switch (group.Side.getValue())
		{
		 case Side.BUY:
		  tradeReport.Side = BuySellType.Buy;
		  break;
		  case Side.SELL:
		   tradeReport.Side = BuySellType.Sell;
		  break;
		}
	}
	tradeReport.OrderId = group.OrderID.getValue();
	tradeReport.ClientOrderId = group.ClOrdID.getValue();
}

You can download the code from Github here.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect Saxo Bank A/S
Denmark Denmark
• Solution Architect /Principle Lead Developer with 12 years of IT experience with more emphasize on Capital Domain and Investment banking domain.
• Strong experience in Continuous Integration, Delivery and DevOps solutions.
• Strong experience in drafting solutions, stakeholder communications and risk management.
• Proved strong coding and designing skills with agile approaches (TDD, XP framework, Pair Programming).
• Delivered many projects with involvement from inception to delivery phase.
• Strong experience in high performance, multithreaded, low latency applications.
• Ability to communicate with the business and technical stake holders effectively.
• Have extensive experience in Capital Market Domain: Front Office & BackOffice (Algorithm Trading tools, messaging framework, Enterprise bus, integration of FIX APIs and many trading APIs).
• Functional knowledge of Portfolio/Wealth Management, Equities, Fixed Income, Derivatives, Forex.
• Practical knowledge of building and practicing agile delivery methodologies (SCRUM, TDD, Kanban).

Technical Skills

• Architectural: Solution Design, Architectural Presentations (Logical, Component, Physical, UML diagrams)
• Languages: C#, C++
• Server Technologies: WCF, Web API,
• Middle Ware: ActiveMQ, RabbitMQ, Enterprise Service Bus
• UI Technologies: Winforms and WPF
• Web Technologies: Asp.Net Mvc, KnockOutJS, JQuery, Advance Java Scripts Concepts
• Databases: Sql Server 2008 +, MySQL
• Tools/Frameworks: TFS, SVN, NUnit, Rhino Mocks, Unity, NAnt, QuickFix/n, Nhibernate, LINQ, JIRA,

Functional Skills

• Wealth Management System, Trade Life Cycle, Trading Components and their integrations
• Working knowledge of Stocks, Bonds, CFDs,Forex, Futures and Options
• Pricing Systems, Market Data Management,
• BackOffice Processes : Settlement Processes, Netting, Tax, Commissions, Corporate Actions Handling,
• Reporting Solutions : OLTP and OLAP Data model designing
• FIX Engine implementation and integration

Comments and Discussions

 
QuestionAre we sure ? Pin
TheQult30-Sep-18 22:18
professionalTheQult30-Sep-18 22:18 
AnswerRe: Are we sure ? Pin
Neeraj Kaushik19807-Oct-18 3:32
Neeraj Kaushik19807-Oct-18 3:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.