<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"           
	targetNamespace="http://schemas.fi.se/TRS/InTrans"
	xmlns="http://schemas.fi.se/TRS/InTrans" 
	elementFormDefault="unqualified">
	<xs:annotation>
		<xs:appinfo>
			TRS - Transaction report
		</xs:appinfo>
		<xs:documentation>
			<Status>
				<Status>Production</Status>
				<Description>Production</Description>
				<Version>2.10</Version>
				<Revisions>
					<Revision date="2007-01-31">Currency code list complemented</Revision>
					<Revision date="2007-02-15">New simple type, StringType40_noReq, assigned to element VenueReferenceNumber to allow empty element value.</Revision>
					<Revision date="2007-02-15">New simple type, PriceAmount, assigned to elements PriceCurrency and PricePercentage. New type allows negative numbers. Previously assigned type was AmountType.</Revision>
					<Revision date="2007-02-15">Simple types StringType20 and StringType70: Value for minInclusive changed from 1 to 0 (zero)</Revision>
					<Revision date="2007-02-15">Sequence restrictions for transaction record types removed.</Revision>
					<Revision date="2007-03-05">New simple type: StringType11, sssigned to element ProxyHolder.  Previously assigned type was StringType20.</Revision>
					<Revision date="2007-04-11">PriceNotation/Currency codelist changed to be of type string(3). VenueReferenceNumber and Client elements optional.</Revision>
					<Revision date="2007-06-08">Schema name convension changed and Fixed Version attibute added at root element</Revision>
					<Revision date="2007-08-09">Added unique to ReportingFirm Identification attribute and BICCodeType to upper case letters</Revision>
					<Revision date="2007-08-15">Changed the ClientCodeType to allow 70 chars</Revision>
					<Revision date="2007-08-15">Changed the Client to allow 70 chars</Revision>
					<Revision date="2007-08-16">CustomerClient type 'C' added to CounterPartyCodeType</Revision>
					<Revision date="2007-08-16">Internal type 'I' removed from CounterPartyCodeType</Revision>
					<Revision date="2007-08-16">CounterPartyCodeType use='required' removed</Revision>
					<Revision date="2007-08-16">UpdateTransaction element removed</Revision>
					<Revision date="2007-09-20">xs:choise changed to xs:sequence</Revision>
					<Revision date="2007-09-20">Schema harmonized with other TRS schemas</Revision>
					<Revision date="2007-10-10">CounterParty type changed to StringType40</Revision>

					<Revision date="2008-05-14">Added new attribute type B for VenueIdentification</Revision>
					<Revision date="2008-05-14">Added fields for reporting of AII</Revision>
					<Revision date="2008-05-14">Changed maxLength restriction for the AmountType</Revision>
					<Revision date="2008-05-14">Changed maximum length for Client Code value</Revision>
					<Revision date="2008-05-14">Added restriction for the ¤-character</Revision>

					<Revision date="2008-05-30">Changed pattern for Instrument to correspond with HUB schema</Revision>
					<Revision date="2008-05-30">Corrected pattern for ExchangeProductCode</Revision>
					<Revision date="2008-06-26">Changed the description of TradingCapacity value A to Agent</Revision>

					<Revision date="2008-08-27">New version 2.1</Revision>
					<Revision date="2008-08-27">Added restriction to the PriceType excluding negativ prices. Affects the Unitprice and the AIIStrikePrice </Revision>

				</Revisions>
			</Status>
			<Subject>
				<Project>TRS</Project>
				<Category>Transaction</Category>
			</Subject>
			<Title>TRS - Transaction report format</Title>
			<Type>Architectural</Type>
			<Description>Transaction report requested by the SE authority in accordance with then demands in MiFID</Description>
			<Language>English</Language>
		</xs:documentation>
	</xs:annotation>

	<!-- BIC code -->
	<xs:simpleType name="BICCodeType">
		<xs:annotation>
			<xs:documentation>ISO 9362 - SWIFT/Bank Identifier Code (BIC) - Format: 11(x)(A-Z|0-9)</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:token">
			<xs:length value="11" />
			<xs:pattern id="upperCaseLetters11" value="[A-Z|0-9]{0,11}"/>
		</xs:restriction>
	</xs:simpleType>

	<!-- String with a max length of 11 -->
	<xs:simpleType name="StringType11">
		<xs:annotation>
			<xs:documentation>Format: max 11(x)</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:token">
			<xs:minLength value="0"></xs:minLength>
			<xs:maxLength value="11"></xs:maxLength>
			<xs:pattern	value="[^¤]*"/>
		</xs:restriction>
	</xs:simpleType>

	<!-- String with a max length of 20 -->
	<xs:simpleType name="StringType20">
		<xs:annotation>
			<xs:documentation>Format: max 20(x)</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:token">
			<xs:minLength value="0"></xs:minLength>
			<xs:maxLength value="20"></xs:maxLength>
			<xs:pattern	value="[^¤]*"/>
		</xs:restriction>
	</xs:simpleType>

	<!-- String with a max length of 40 -->
	<xs:simpleType name="StringType40">
		<xs:annotation>
			<xs:documentation>Format: max 40(x)</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:token">
			<xs:minLength value="1"></xs:minLength>
			<xs:maxLength value="40"></xs:maxLength>
			<xs:pattern	value="[^¤]*"/>
		</xs:restriction>
	</xs:simpleType>

	<!-- String with a max length of 40 -->
	<xs:simpleType name="StringType40_noReq">
		<xs:annotation>
			<xs:documentation>Format: max 40(x)</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:token">
			<xs:minLength value="0"></xs:minLength>
			<xs:maxLength value="40"></xs:maxLength>
			<xs:pattern	value="[^¤]*"/>
		</xs:restriction>
	</xs:simpleType>

	<!-- String with a max length of 70 -->
	<xs:simpleType name="StringType70">
		<xs:annotation>
			<xs:documentation>Format: max 70(x)</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:token">
			<xs:minLength value="0"></xs:minLength>
			<xs:maxLength value="70"></xs:maxLength>
			<xs:pattern	value="[^¤]*"/>
		</xs:restriction>
	</xs:simpleType>

	<!-- Date specified in the following form YYYY-MM-DDThh:mm:ss with optional timezone -->
	<xs:simpleType name="DateTimeType">
		<xs:annotation>
			<xs:documentation>YYYY-MM-DDThh:mm:ss+/-hh:mm</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:dateTime"></xs:restriction>
	</xs:simpleType>

	<!-- Buy / Sell indicator -->
	<xs:simpleType name="BuySellType">
		<xs:annotation>
			<xs:documentation>
				Buy / Sell indicator
				B = Buy, S = Sell
			</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:pattern value="B|S" />
		</xs:restriction>
	</xs:simpleType>

	<!-- Trading capacity -->
	<xs:simpleType name="TradingCapacityType">
		<xs:annotation>
			<xs:documentation>
				P =  Own account / portfolio.
				M = Market maker.
				C = Own account as agent for a customer.
				W = Warehousing.
				For the account, and on behalf, of a client:
				A = Agent.
			</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:pattern value="P|M|C|W|A" />
		</xs:restriction>
	</xs:simpleType>

	<!-- String with a length of 12 -->
	<xs:simpleType name="InstrumentType">
		<xs:annotation>
			<xs:documentation>Format: 2(a)9(x)1n. Must be a valid ISO 6166 ISIN code.</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:token">
			<xs:length value="12" />
			<xs:pattern	value="[A-Z]{2}([A-Z]|[0-9]){9}[0-9]"/>
		</xs:restriction>
	</xs:simpleType>

	<xs:complexType name="AIIInstrumentIdentificationType">
		<xs:sequence>
			<xs:element name="AIIExchangeCode" type="ExchangeCode" minOccurs="1" maxOccurs="1" />
			<xs:element name="AIIExchangeProductCode" type="ExchangeProductCode" minOccurs="1" maxOccurs="1" />
			<xs:element name="AIIDerivativeType" type="DerivativeType" minOccurs="1" maxOccurs="1"/>
			<xs:element name="AIIPutCallIdentifier" type="PutCallIdentifier" minOccurs="1" maxOccurs="1" />
			<xs:element name="AIIMaturityDate" type="MaturityDate" minOccurs="1" maxOccurs="1" />
			<xs:element name="AIIStrikePrice" type="PriceType" minOccurs="1" maxOccurs="1" />
		</xs:sequence>
	</xs:complexType>

	<!-- Venue admitting derivative to trading -->
	<xs:simpleType name="ExchangeCode">
		<xs:annotation>
			<xs:documentation>Must be a valid ISO 10383 Market Identifier Code(MIC).</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:token">
			<xs:length value="4" />
			<xs:pattern id="upperCaseLetters4" value="[A-Z|0-9]{4}"/>
		</xs:restriction>
	</xs:simpleType>

	<!-- Product identifier -->
	<xs:simpleType name="ExchangeProductCode">
		<xs:annotation>
			<xs:documentation>Format: Up to 12(x).</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:token">
			<xs:minLength value="1" />
			<xs:maxLength value="12" />
			<xs:pattern	value="([A-Z]|[0-9])*"/>
		</xs:restriction>
	</xs:simpleType>

	<!-- Derivative indicator -->
	<xs:simpleType name="DerivativeType">
		<xs:annotation>
			<xs:documentation>
				Derivative indicator
				O = Option, F = Future
			</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:pattern value="O|F" />
		</xs:restriction>
	</xs:simpleType>

	<!-- Put or Call indicator -->
	<xs:simpleType name="PutCallIdentifier">
		<xs:annotation>
			<xs:documentation>
				Indicates if the derivative is a put, call or a future.
				P = Put, C = Call, F = Future
			</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:pattern value="P|C|F" />
		</xs:restriction>
	</xs:simpleType>

	<!-- Date specified in the following form YYYY-MM-DD -->
	<xs:simpleType name="MaturityDate">
		<xs:annotation>
			<xs:documentation>YYYY-MM-DD</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:date"></xs:restriction>
	</xs:simpleType>
	
	<!-- Amount decimal -->
	<xs:simpleType name="AmountType">
		<xs:annotation>
			<xs:documentation>Format: Max 19(d) and max 5 decimals numbers </xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:decimal">
			<xs:totalDigits value="19"/>
			<xs:fractionDigits value="5" />
			<xs:minExclusive value="0"/>
		</xs:restriction>
	</xs:simpleType>

	<!-- Price decimal -->
	<xs:simpleType name="PriceType">
		<xs:annotation>
			<xs:documentation>Format: Max 19(d) and max 5 decimals numbers (can be negative)</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:decimal">
			<xs:totalDigits value="19"/>
			<xs:fractionDigits value="5" />
			<xs:minInclusive value="0"/>
		</xs:restriction>
	</xs:simpleType>

	<!-- Price notation -->
	<xs:simpleType name="PriceNotationType">
		<xs:annotation>
			<xs:documentation>Must be a valid ISO 4217 currency code.</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:pattern value="[A-Z]{3,3}" />
		</xs:restriction>
	</xs:simpleType>

	<!-- Venue code -->
	<xs:simpleType name="VenueCodeType">
		<xs:annotation>
			<xs:documentation>
				M = ISO 10383 Market Identifier Code(MIC).
				O = XOFF. Off market transaction
				B = ISO 9362 SWIFT/Bank identifier code (BIC)
			</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:pattern value="M|O|B" />
		</xs:restriction>
	</xs:simpleType>

	<!-- Venue -->
	<xs:simpleType name="VenueType">
		<xs:annotation>
			<xs:documentation>A valid ISO 10383 Market Identifier Code(MIC), valid ISO 9362 SWIFT/Bank identifier code (BIC) or 'XOFF' if off market transaction.</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:token">
			<xs:minLength value="4" />
			<xs:maxLength value="11" />
			<xs:pattern id="upperCaseLetters" value="[A-Z|0-9]{0,11}"/>
		</xs:restriction>
	</xs:simpleType>

	<!-- Client code -->
	<xs:simpleType name="ClientCodeType">
		<xs:annotation>
			<xs:documentation>B = BIC or I = Internal</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:pattern value="B|I" />
		</xs:restriction>
	</xs:simpleType>

	<!-- Counter party code -->
	<xs:simpleType name="CounterPartyCodeType">
		<xs:annotation>
			<xs:documentation>
				B = BIC,
				M = MIC,
				C = CustomerClient
			</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:pattern value="B|M|C" />
		</xs:restriction>
	</xs:simpleType>

	<!-- Cancellation indicator -->
	<xs:simpleType name="CancellationIndicatorType">
		<xs:annotation>
			<xs:documentation>C = Cancel the previously submitted transaction</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:pattern value="C" />
		</xs:restriction>
	</xs:simpleType>

	<!-- Transaction definition -->
	<xs:complexType name="TransactionRecordInfoCompleteDescriptionType">
		<xs:sequence>
			<xs:element name="TransactionReferenceNumber" type="StringType40" />
			<xs:element name="TradingTimestamp" type="DateTimeType" />
			<xs:element name="BuySellIndicator" type="BuySellType" />
			<xs:element name="TradingCapacity" type="TradingCapacityType" />
			<xs:choice minOccurs="1">
				<xs:element name="Instrument" type="InstrumentType" />
				<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="AmountType" />
			<xs:element name="CounterParty">
				<xs:complexType>
					<xs:simpleContent>
						<xs:extension base="StringType40">
							<xs:attribute name="CodeType" type="CounterPartyCodeType" use="required"/>
						</xs:extension>
					</xs:simpleContent>
				</xs:complexType>
			</xs:element>
			<xs:element name="Venue">
				<xs:complexType>
					<xs:simpleContent>
						<xs:extension base="VenueType">
							<xs:attribute name="CodeType" type="VenueCodeType" use="required"/>
						</xs:extension>
					</xs:simpleContent>
				</xs:complexType>
			</xs:element>
			<xs:element name="VenueReferenceNumber" type="StringType40_noReq" minOccurs="0" maxOccurs="1"/>
			<xs:element name="Client" minOccurs="0" maxOccurs="1">
				<xs:complexType>
					<xs:simpleContent>
						<xs:extension base="StringType40">
							<xs:attribute name="CodeType" type="ClientCodeType" use="required"/>
						</xs:extension>
					</xs:simpleContent>
				</xs:complexType>
			</xs:element>
			<xs:element name="ClientName" type="StringType70" minOccurs="0" maxOccurs="1"/>
			<xs:element name="ClientIdentificationLocal" type="StringType20" minOccurs="0" maxOccurs="1"/>
			<xs:element name="ClientStreet" type="StringType70" minOccurs="0" maxOccurs="1"/>
			<xs:element name="ClientZipCode" type="StringType70" minOccurs="0" maxOccurs="1"/>
			<xs:element name="ClientCity" type="StringType70" minOccurs="0" maxOccurs="1"/>
			<xs:element name="ClientCountry" type="StringType70" minOccurs="0" maxOccurs="1"/>
			<xs:element name="ProxyHolder" type="StringType11" minOccurs="0" maxOccurs="1"/>
		</xs:sequence>
	</xs:complexType>

	<!-- Cancellation definition -->
	<xs:complexType name="CancellationTransactionType">
		<xs:sequence>
			<xs:element name="CancelledTransactionUniqueIdentifier" type="StringType40" />
			<xs:element name="CancellationIndicator" type="CancellationIndicatorType" />
		</xs:sequence>
	</xs:complexType>

	<!-- Unit price complete description -->
	<xs:complexType name="UnitPriceCompleteDescriptionType">
		<xs:choice>
			<xs:element name="PriceCurrency" type="PriceType"/>
			<xs:element name="PricePercentage" type="PriceType"/>
		</xs:choice>
	</xs:complexType>

	<!-- Transaction schema -->
	<xs:element name="report">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="TechnicalReportingFirm">
					<xs:complexType>
						<xs:attribute name="Identification" type="BICCodeType" use="required"/>
					</xs:complexType>
				</xs:element>
				<xs:element name="ReportingFirm" minOccurs="1" maxOccurs="unbounded">
					<xs:complexType>
						<xs:sequence>
							<xs:element name="Transaction" type="TransactionRecordInfoCompleteDescriptionType" minOccurs="0" maxOccurs="unbounded" />
							<xs:element name="CancellationTransaction" type="CancellationTransactionType" minOccurs="0" maxOccurs="unbounded" />
						</xs:sequence>
						<xs:attribute name="Identification" type="BICCodeType" use="required"/>
					</xs:complexType>
				</xs:element>
			</xs:sequence>
			<xs:attribute name="Version" type="xs:decimal" use="required" fixed="2.10"></xs:attribute>
		</xs:complexType>
		<xs:unique name="uniqueIdReportingFirm">
			<xs:selector xpath="ReportingFirm"/>
			<xs:field xpath="@Identification"/>
		</xs:unique>
	</xs:element>
	
</xs:schema>
