<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
	<xs:simpleType name="DOCTYPEID_Type">
		<xs:annotation>
			<xs:documentation>Тип: "Идентификатор типа документа в системе электронного документооборота" / Type: "Unique document type in the Electronic Document Management System"</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:minLength value="0"/>
			<xs:maxLength value="20"/>
			<xs:pattern value="[A-Z,0-9,_,//,А-Я]{1,20}"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="DOCNO_Type">
		<xs:annotation>
			<xs:documentation>Тип: "Уникальный учетный номер документа в системе ЭДО" / Type: "Unique document tracking number in the Electronic Document Management System"</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:minLength value="0"/>
			<xs:maxLength value="20"/>
			<xs:pattern value="[A-Z,0-9,//]{1,20}"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="SENDERID_Type">
		<xs:annotation>
			<xs:documentation>Тип: "Идентификатор фирмы отправителя/получателя ЭДО" / Type: "Sender Identifier"</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:maxLength value="7"/>
			<xs:minLength value="3"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="SENDERNAME_Type">
		<xs:annotation>
			<xs:documentation>Тип: "Краткое наименование отправителя" / Short name of the sender</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:minLength value="0"/>
			<xs:maxLength value="512"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="REMARKS_Type">
		<xs:annotation>
			<xs:documentation>Тип: "Примечание к документу" / Type: "Notes to the document"</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:minLength value="0"/>
			<xs:maxLength value="120"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="RECNO_Type">
		<xs:annotation>
			<xs:documentation>Тип "Номер записи" / Type "Record number"</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:integer">
			<xs:totalDigits value="11"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="FIRMID_Type">
		<xs:annotation>
			<xs:documentation>Тип: "Идентификатор фирмы" / Type: "Clearing Member Identifier"</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:minLength value="0"/>
			<xs:maxLength value="12"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="FIRMNAME_Type">
		<xs:annotation>
			<xs:documentation>Тип: "Краткое наименование фирмы" / Type: "Short name of member"</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:minLength value="0"/>
			<xs:maxLength value="512"/>
		</xs:restriction>
	</xs:simpleType>

  <xs:simpleType name="FIRMNAME_LONG_Type">
    <xs:annotation>
      <xs:documentation>Тип: "Hаименование фирмы" / Type: "Clearing Member name"</xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:minLength value="0"/>
      <xs:maxLength value="1024"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="FIRMTYPE_Type">
    <xs:annotation>
      <xs:documentation>Тип: "Тип участника клиринга" / Type: "Clearing Member type"</xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:minLength value="0"/>
      <xs:maxLength value="20"/>
      <xs:enumeration value="Некредитная"/>
      <xs:enumeration value="Кредитная"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="FIRM_INN_Type">
		<xs:annotation>
			<xs:documentation>Тип: "ИНН / TIN участника клиринга" / Type: "Clearing Member INN / TIN"</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:maxLength value="128"/>
		</xs:restriction>
	</xs:simpleType>
  
  <xs:simpleType name="WEEKDAY_Type">
    <xs:annotation>
      <xs:documentation>Тип: "Наименование дня недели" / Type: "Weekday"</xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:maxLength value="20"/>
      <xs:enumeration value="Понедельник"/>
      <xs:enumeration value="Вторник"/>
      <xs:enumeration value="Среда"/>
      <xs:enumeration value="Четверг"/>
      <xs:enumeration value="Пятница"/>
      <xs:enumeration value="Суббота"/>
      <xs:enumeration value="Воскресенье"/>
	  <xs:enumeration value="Monday"/>
	  <xs:enumeration value="Tuesday"/>
	  <xs:enumeration value="Wednesday"/>
	  <xs:enumeration value="Thursday"/>
	  <xs:enumeration value="Friday"/>
	  <xs:enumeration value="Saturday"/>
	  <xs:enumeration value="Sunday"/>	  
    </xs:restriction>
  </xs:simpleType>

  
	<xs:simpleType name="SECURITYID_Type">
		<xs:annotation>
			<xs:documentation>Тип: "Идентификатор ценной бумаги" / Type: "Security Identifier of the supplied asset" / Type: "Security Identifier"</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:maxLength value="12"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="SEC_SHORT_NAME_Type">
		<xs:annotation>
			<xs:documentation>Тип: "Краткое наименование ценной бумаги" /  Type: "Short name of the supplied asset "</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:maxLength value="256"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="STRING16_Type">
		<xs:annotation>
			<xs:documentation>Тип: "Строка длиной не более 16 символов"/ Type : "String not over 16 characters" </xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:maxLength value="16"/>
		</xs:restriction>
	</xs:simpleType>

	<xs:simpleType name="SEC_TYPE_Type">
		<xs:annotation>
			<xs:documentation>Тип: "Тип ценной бумаги" / Type: "Security type"</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:maxLength value="2"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="TRDACCID_Type">
		<xs:annotation>
			<xs:documentation>Тип: "Идентификатор ценной бумаги" / Type: "Trade account identifier"</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:maxLength value="12"/>
		</xs:restriction>
	</xs:simpleType>
  <xs:simpleType name="DepositaryName_Type">
    <xs:annotation>
      <xs:documentation>
        Тип: "Код депозитария, в котором открыт субсчет
		BEBSD - ПАО "СПБ Банк" для рынка СПБ
		BEBSK - ПАО "СПБ Банк" для рынка Казахстан
		/ Type: "Code of the depositary in which a sub-account is opened: BEBSD – PJSC "SPB Bank" for market SPB, BEBSD – PJSC "SPB Bank" for market Kazakhstan"
     "</xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:maxLength value="16"/>
      <xs:enumeration value="BEBSD"/>
	  <xs:enumeration value="BEBSK"/>
    </xs:restriction>
  </xs:simpleType>
	<xs:simpleType name="CURRENCYID_Type">
		<xs:annotation>
			<xs:documentation>Тип: "Идентификатор вылюты" / Type: "Currency identifier"</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:maxLength value="4"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="CURRENCYNAME_Type">
		<xs:annotation>
			<xs:documentation>Тип "Наименование валюты" / Type "Currency name"</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:maxLength value="30"/>
		</xs:restriction>
	</xs:simpleType>

  <xs:simpleType name="REALACCOUNT_Type">
    <xs:annotation>
      <xs:documentation>Тип "Номер счета или идентификатор денежного регистра" / Type: "Cash Register ID"</xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:maxLength value="64"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="YES_NO_Type">
		<xs:annotation>
			<xs:documentation>Тип: " "Y"-YES, "N"-NO" / Type: " "Y"-YES, "N"-NO"</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:minLength value="1"/>
			<xs:maxLength value="1"/>
			<xs:enumeration value="Y"/>
			<xs:enumeration value="N"/>
		</xs:restriction>
	</xs:simpleType>

  <xs:simpleType name="POSTYPE_Type">
    <xs:annotation>
      <xs:documentation>Тип: "Информация по типам обязательств: C - информация о нетто
				обязательствах/требованиях по денежной позиции; S - информация о нетто
				обязательствах/требованиях по депозитарным разделам "
				Type: "Type of deposited ICC assets: C - cash, S - securities"</xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:minLength value="1"/>
      <xs:maxLength value="1"/>
      <xs:enumeration value="C"/>
      <xs:enumeration value="S"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="FLOAT_20.0_Type">
    <xs:annotation>
      <xs:documentation>Тип: "Вещественное число с длиной дробной части = 0" / Type: "Real number with fractional length = 0</xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:decimal">
      <xs:totalDigits value="20"/>
      <xs:fractionDigits value="0"/>
    </xs:restriction>
  </xs:simpleType>
	
	<xs:simpleType name="FLOAT_20.2_Type">
		<xs:annotation>
			<xs:documentation>Тип: "Вещественное число с длиной дробной части = 2"   / Type: "Real number with fractional length = 2</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:decimal">
			<xs:totalDigits value="20"/>
			<xs:fractionDigits value="2"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="FLOAT_20.4_Type">
		<xs:annotation>
			<xs:documentation>Тип: "Вещественное число с длиной дробной части = 4" /  Type: "Real number with fractional length = 4</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:decimal">
			<xs:totalDigits value="20"/>
			<xs:fractionDigits value="4"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="PRICE_Type">
		<xs:annotation>
			<xs:documentation>Тип: "Цена, ставка" / Type: "Price, rate"</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:decimal">
			<xs:totalDigits value="20"/>
			<xs:fractionDigits value="6"/>
		</xs:restriction>
	</xs:simpleType>
  <xs:simpleType name="ClrAccCode_Type">
    <xs:annotation>
      <xs:documentation>Тип "Код ТКС" / Type: "TCA code"</xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:maxLength value="12"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="CLRACCTYPE_Type">
    <xs:annotation>
      <xs:documentation>
		  Тип "Тип ТКС: 
		  p – собственный некредитной организации
		  b – собственный кредитной организации
		  c – клиентский р
		  m – раздел ДУ
		  i – для учета обзательств Участника клиринга-продавца (для размещения ценных бумаг)
		  n - для учета обязательств по договорам, заключенным без участия ЦК
		  g - ТКС ГФ
		  t - кустовый ТКС (с группой субсчетов, привязанных к клиентам)
		  e - ТКС для учета дополнительного обеспечения
		  x - ТКС для учета клиентов ДУ второго уровня
		 Type: "TCA type"
		  p – own non-credit organisation
		  b – own credit organisation
		  c – client
		  m – trustee section
		  i - for accounting obligations of the Selling Clearing Member (for placement of securities)
		  g - for accounting collective clearing collateral
		  e - for accounting claims for additional collateral
		  t - TCA with a group of sub-accounts linked to clients
		  x – client TCA for trustee's client(s)

		  "</xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:maxLength value="1"/>
      <xs:enumeration value="p"/>
      <xs:enumeration value="b"/>
      <xs:enumeration value="c"/>
      <xs:enumeration value="m"/>
      <xs:enumeration value="i"/>
      <xs:enumeration value="n"/>
      <xs:enumeration value="g"/>
      <xs:enumeration value="t"/>
      <xs:enumeration value="e"/>
      <xs:enumeration value="x"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="BANKACCCODE_Type">
    <xs:annotation>
      <xs:documentation>Тип "Код денежного регистра" /  Type: "Cash Register code"</xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:maxLength value="32"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="DEPUNITID_Type">
    <xs:annotation>
      <xs:documentation>Тип "Счет (субсчет) депо для учета ценных бумаг" / Type: "Custody (sub-account) account for securities record"</xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:maxLength value="17"/>
    </xs:restriction>
  </xs:simpleType>

    <xs:simpleType name="OtcSettlementCurrency_Type">
        <xs:annotation>
            <xs:documentation>
                Валюта расчетов обязательств, возникших на основании Внебиржевых договоров ОТС/ Внебиржевых договоров репо ОТС
                    RUB
                    USD      
				Currency of settlement of obligations arisen out of OTC Contracts/OTC Repurchase Agreements
					RUB
					USD

            </xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:string">
            <xs:maxLength value="3"/>
            <xs:enumeration value="RUB"/>
            <xs:enumeration value="USD"/>
        </xs:restriction>
    </xs:simpleType>


	<xs:simpleType name="DepoAccountType_Type">
		<xs:annotation>
			<xs:documentation>
				'Собственный'
				'Номинальное держание'
				'Доверительное управление'
				'Иностранный уполномоченный держатель'
				'Owner'
				'Nominee holder'
				'Trust management'
				'Foreign Authorized Holder'
				
			</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:maxLength value="128"/>
			<xs:enumeration value="Собственный"/>
			<xs:enumeration value="Номинальное держание"/>
			<xs:enumeration value="Доверительное управление"/>
			<xs:enumeration value="Иностранный уполномоченный держатель"/>
			<xs:enumeration value="Owner"/>
			<xs:enumeration value="Nominee holding"/>
			<xs:enumeration value="Trust management"/>
			<xs:enumeration value="Foreign Authorized Holder"/>
		</xs:restriction>
	</xs:simpleType>


  <xs:simpleType name = "DepoAccountNumber_Type">
    <xs:restriction base="xs:string">
      <xs:minLength value="0"/>
      <xs:maxLength value="12"/>
      <!--Счет (субсчет) депо для учета ценных бумаг-->
    </xs:restriction>
  </xs:simpleType>

  <xs:complexType name="DOC_REQUISITES_Type">
		<xs:annotation>
			<xs:documentation>Реквизиты документа в системе электронного документооборота / Details of the document in the electronic document management system</xs:documentation>
		</xs:annotation>
		<xs:attribute name="DOC_DATE" type="xs:date" use="required"> 

	<!--Дата формирования документа-->
	</xs:attribute>
	<xs:attribute name="DOC_TIME" type="xs:time" use="required">
		<!--Время формирования документа MSK-->
	</xs:attribute>
	<xs:attribute name="DOC_NO" type="DOCNO_Type" use="required">
		<!--Уникальный учетный номер документа-->
	</xs:attribute>
	<xs:attribute name="DOC_TYPE_ID" type="DOCTYPEID_Type"  use="optional">
		<!--Идентификатор типа документа-->
	</xs:attribute>
	<xs:attribute name="SENDER_ID" type="SENDERID_Type" use="required">
		<!--Идентификатор фирмы-отправителя документа-->
	</xs:attribute>
	<xs:attribute name="SENDER_NAME" type="SENDERNAME_Type" default="ОАО Отправитель" use="optional">
		<!--Краткое наименование отправителя-->
	</xs:attribute>
	<xs:attribute name="RECEIVER_ID" type="SENDERID_Type" use="required">
		<!--Код ЭДО РТС получателя -->
	</xs:attribute>
	<xs:attribute name="REMARKS" type="REMARKS_Type" use="optional">
		<!--Текст примечания к документу-->
	</xs:attribute>
	</xs:complexType>
	<xs:element name="RTS_DOC">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="DOC_REQUISITES"/>
				<xs:element ref="MFB20"/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="DOC_REQUISITES" type="DOC_REQUISITES_Type"/>
	<xs:element name="MFB20">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="FIRM" minOccurs="0" maxOccurs="unbounded"/>
			</xs:sequence>
			<xs:attribute name="ReportDate" type="xs:date" use="required"/>
			<xs:attribute name="ReportDesc" type="xs:string" use="optional"/>
			<xs:attribute name="ReportVersion" type="xs:string" use="optional"/>
			<xs:attribute name="Weekday" type="WEEKDAY_Type" use="optional"/>
			<xs:attribute name="MainFirmId" type="FIRMID_Type" use="required"/>
			<xs:attribute name="MainFirmINN" type="FIRM_INN_Type" use="optional"/>
		    <xs:attribute name="MainFirmName" type="FIRMNAME_LONG_Type" use="required"/>
		    <xs:attribute name="Volume" type="xs:positiveInteger" use="optional"/>
		    <xs:attribute name="VolumeTotal" type="xs:positiveInteger" use="optional"/>
		    <xs:attribute name="ReportNumber" type="xs:string" use="optional"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="FIRM">
    <xs:complexType>
      <xs:sequence>
            <xs:element ref="CLEARING_ACC" maxOccurs="unbounded"/>
      </xs:sequence>
      <xs:attribute name="FirmID" type="FIRMID_Type" use="required"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="CLEARING_ACC">
    <xs:complexType>
        <xs:sequence>
            <xs:element ref="BANK_ACC"   minOccurs="0" maxOccurs="unbounded"/>
            <xs:element ref="DEPO_ACC"   minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>    
        <xs:attribute name="ClrAccCode" type="ClrAccCode_Type" use="required"/>
        <xs:attribute name="ClrAccStatus" use ="required">
        <xs:simpleType>
            <xs:restriction base="xs:string">
                <xs:minLength value="1"/>
                <xs:maxLength value="32"/>
        </xs:restriction>
        </xs:simpleType>
    </xs:attribute>
        <xs:attribute name="ClrAccType" type="CLRACCTYPE_Type" use ="required"/>
        <xs:attribute name="DataChanged" type="YES_NO_Type" use ="required"/>
        <xs:attribute name="DateCreated" type="xs:date" use ="required"/>
        <xs:attribute name="DateDeleted" type="xs:date" use ="optional"/>
        <xs:attribute name="DefaultClient" type="ClrAccCode_Type" use ="optional"/>
        <xs:attribute name="ExtraDefaultClient" type="ClrAccCode_Type" use ="optional"/>		
        <xs:attribute name="CommPaymentAcc" type="YES_NO_Type" use ="optional"/>
        <xs:attribute name="BrokerFeeAccount" type="ClrAccCode_Type" use ="optional"/>
        <xs:attribute name="SeparateAccounting" type="YES_NO_Type" use ="required"/>
        <xs:attribute name="TrustClientIdentifier" type="xs:string" use ="optional"/>
        <xs:attribute name="FeeClutch" type="YES_NO_Type" use ="optional"/>
		<xs:attribute name="RepoUnavailable" type="YES_NO_Type" use="optional"/>
       </xs:complexType>
  </xs:element>
  
  
  <xs:element name="BANK_ACC">
    <xs:complexType>
      <xs:attribute name="CurrencyId" type="CURRENCYID_Type" use="required"/>
      <xs:attribute name="CurrencyName" type="CURRENCYNAME_Type" use="optional"/>
      <xs:attribute name="AccountNumber" type="REALACCOUNT_Type" use="optional"/>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="DEPO_ACC">
    <xs:complexType>     
      <xs:sequence>
        <xs:element ref="CLIENT"   minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence> 
      	<xs:attribute name="DepositaryName" type="DepositaryName_Type" use="required"/>
      	<xs:attribute name="DepoAccountNumber" type="DepoAccountNumber_Type" use ="required" />
    	<xs:attribute name="DepoAccountCastodianCode" type="FIRMID_Type" use ="optional" />
    	<xs:attribute name="DepoAccountOwnerName" type="xs:string" use ="optional" />
    	<xs:attribute name="DepoAccountType" type="DepoAccountType_Type" use ="optional" />
     </xs:complexType>  
  </xs:element>
   
  <xs:element name="CLIENT">
    <xs:complexType>           
      <xs:attribute name="ClientCode" type="ClrAccCode_Type" use="required"/>
      <xs:attribute name="ClientIdentification" type="xs:string" use ="required" />
    </xs:complexType>  
  </xs:element> 
   
</xs:schema>