<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
	<xs:include schemaLocation="TransactionRecordTypes2.1.xsd"/>
	<xs:include schemaLocation="CancellationRecordType2.1.xsd"/>
	<!--	
******************************************************************************
	MiFIDTransactionReporting

	Root element of the schema. There must be one (at least) or more
	  of these two elements. Therefore there will be an unlimited
	  number of any type of records (transactions or cancellations)

	TransactionRecordInfo: contains data related to the transactions 
		associated to a Financial Instrument. See TransactionRecordTypes.xsd 
		XML-Schema Files for further information.

	CancellationRecordInfo: contains the unique identifier for the 
		transaction to be cancelled by the CA.
		See CancellationRecordTypes.xsd XML-Schema Files for
		further information.

And five attributes:

	Version: version number of the schema.
	Updated in version 2.1 for backward compatability reasons.
	
	AuthorityKey: Investment Firm code supplied by CYSEC alpha-2. Length: 2 characters.

	CreationDate: Mandatory date in ISO 8601 extended format  
		(YYYY-MM-DD). 

	CreationTime: Mandatory time in extended ISO 8601 HH:MM:SS 
		format.
						
	CreationTimeOffset: Mandatory ISO 8601 Time Zone Offset. 
		Format: SHH max 12 h, where S is the sign (+ or -) and 
		HH the number of hours.

******************************************************************************
-->
	<xs:element name="MiFIDTransactionReporting">
		<xs:annotation>
			<xs:documentation>Transaction Report Document XML Schema</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:choice maxOccurs="unbounded">
				<xs:element name="TransactionRecordInfo" type="TransactionRecordInfoCompleteDescriptionType"/>
				<xs:element name="CancellationRecordInfo" type="CancellationRecordInfoType"/>
			</xs:choice>
			<xs:attribute name="Version" use="required">
				<xs:simpleType>
					<xs:restriction base="xs:string">
						<xs:pattern value="1.0|2.1"/>
					</xs:restriction>
				</xs:simpleType>
			</xs:attribute>
			<xs:attribute name="AuthorityKey" type="AuthorityKeyType" use="required"/>
			<xs:attribute name="CreationDate" type="xs:date" use="required"/>
			<xs:attribute name="CreationTime" type="xs:time" use="required"/>
			<xs:attribute name="CreationTimeOffset" type="TimeIdentifierType" use="required"/>
		</xs:complexType>
	</xs:element>
	<!-- 
********************************************************************
TRANSACTION RECORD TYPE

ReportingFirmIdentification: Mandatory Field.  ISO 9362 - 
	SWIFT/Bank Identifier Code (BIC). Provides information on 
	the Reporting Firm identification scheme.

TradingDay: Mandatory Field. ISO 8601 Extended Date Format 
	(YYYY-MM-DD). Indicates the trading day on which the 
	transaction was executed.

TradingTime: Mandatory Field. The time at which the 
	transaction was executed.

BuySellIndicator: Mandatory Field. Identifies whether the 
	transaction was a buy or sell from the perspective of the 
	reporting investment firm or from the perspective of the client.

TradingCapacity: Mandatory Field. Identifies whether the firm 
	executed the transaction on its own account (either on its 
	own behalf or on behalf of a client) or for the account on 
	behalf of a client.

Updated for version 2.1
	Choice of 
		1) InstrumentIdentification (simple type : InstrumentIdentificationType) or 
		2) AIIInstrumentIdentification (complex type: AIIInstrumentIdentificationType)
	The transaction is identified by either an ISIN-identifier or an AII-identifier
	
		InstrumentIdentification: Mandatory (if choisen) Code ISO 6166 ISIN. 
			Unique, to be decided by the CA (if any) to which the report
			is made identifying the financial instrument which is the subject
			of the transaction.
		
		AIIInstrumentIdentification: Mandatory ComplexType 
			Composed by six mandatory fields
			Unique, to be decided by the CA (if any) to which the report
			is made identifying the financial instrument which is the subject
			of the transaction.

UnitPrice: Mandatory Field. It express whether :
	- The price in percentage or
	- The unit price of a security or
	- The price of one derivative contract in case of derivatives on 
		securities

PriceNotation: Mandatory Field. ISO 4217 - Currency Code.

Quantity: Mandatory Field. The number of units of the financial 
	instrument, the number of units of the nominal value of bonds, or the number of derivative contracts included in the transaction.

Counterparty: The complex structure of this element is being described 
	in the TransactionRecordTypes.xsd schema.

Client: Mandatory Field, a BIC code or an Internal Code.

TradingVenueCode: Mandatory Field. The complex structure of this element is 
	being described in the TransactionRecordTypes.xsd schema.

TransactionReferenceNumber: Mandatory Field. A unique identification 
	number for the transaction provided by the investment firm 
	or a third party reporting on its behalf.


See TransactionRecordTypes.xsd XML-Schema File for further 
		information.
************************************************************************
-->
	<xs:complexType name="TransactionRecordInfoCompleteDescriptionType">
		<xs:sequence>
			<xs:element name="ReportingFirmIdentification" type="FirmIdentificationBICType"/>
			<xs:element name="TradingDay" type="xs:date"/>
			<xs:element name="TradingTime" type="TradingTimeCompleteDescriptionType"/>
			<xs:element name="BuySellIndicator" type="BuySellIndicatorType"/>
			<xs:element name="TradingCapacity" type="TradingCapacityType"/>
			<xs:choice>
				<xs:element name="InstrumentIdentification" type="InstrumentIdentificationType"/>
				<xs:element name="AIIInstrumentIdentification" type="AIIInstrumentIdentificationType"/>
			</xs:choice>
			<xs:element name="UnitPrice" type="UnitPriceCompleteDescriptionType"/>
			<xs:element name="PriceNotation" type="PriceNotationType"/>
			<xs:element name="Quantity" type="QuantityType"/>
			<xs:element name="Counterparty" type="CounterpartyCompleteDescriptionType"/>
			<xs:element name="Client" type="ClientCompleteDescriptionType"/>
			<xs:element name="TradingVenueCode" type="TradingVenueCodeCompleteDescriptionType"/>
			<xs:element name="TransactionReferenceNumber" type="TransactionReferenceNumberType"/>
		</xs:sequence>
	</xs:complexType>
	<!--	
**********************************************************************************
	CANCELLATION RECORD INFO TYPE

	CancelledTransactionUniqueIdentifier: Univocally identifies the 
		transaction to cancel among the transactions sent by this CA.

	CancelledTransactionFlag: Mandatory Field. C (cancelled by the
		Reporting Firm) or D (cancelled by the CA).

	CancelledInstrumentIdentifier: Optional Field
	I : ISIN cancellation
	A : AII cancellation
	This element is Optional to make the schema backward compatible
	with the previous version

	See CancellationRecordType.xsd XML-Schema File for further 
		information.
**********************************************************************************
-->
	<xs:complexType name="CancellationRecordInfoType">
		<xs:sequence>
			<xs:element name="CancelledTransactionUniqueIdentifier" type="TransactionReferenceNumberType"/>
			<xs:element name="CancelledTransactionFlag" type="CancelledTransactionFlagType"/>
			<xs:element name="CancelledInstrumentIdentifier" type="CancelledInstrumentIdentifierType" minOccurs="0"/>
		</xs:sequence>
	</xs:complexType>
</xs:schema>

