<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
  ~ Copyright (C) 2015 MarketFactory, Inc. All rights reserved.
  ~ Use in source and binary forms, with or without modification, is permitted provided that
  ~ the following conditions are met:
  ~  1.You may only use this software for internal evaluation and testing purposes and may
  ~  not use the software for engaging in live trades, unless and until you have entered into
  ~   a separate agreement with MarketFactory governing the use of MarketFactory
  ~   software in a production environment.
  ~  2. You may not distribute the software (in either source or binary forms) to third parties.
  ~  3. All copies of source code must retain the above copyright notice, this list of conditions
  ~  and the following disclaimer.
  ~
  ~     THIS SOFTWARE IS PROVIDED BY MARKETFACTORY AND ITS LICENSORS "AS IS" AND
  ~     ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  ~     IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  ~     PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MARKETFACTORY OR ITS LICENSORS
  ~     BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  ~     CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  ~     SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  ~     INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  ~     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  ~     ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  ~     THE POSSIBILITY OF SUCH DAMAGE.
  ~
  -->

<sbe:messageSchema xmlns:sbe="http://www.fixprotocol.org/ns/simple/RC3"
                   package="mftradedaterollover"
                   id="4"
                   version="0"
                   semanticVersion="MF-FIX5.0SP2"
                   description="Schema for trade date roll service messages.  Based on the FIX50SP2.
                                The protocol is designed to run over various transports (TCP, UDP unicast, shared memory, and UDP multicast)."
                   byteOrder="littleEndian">

    <!-- SBE defined types -->
    <types>
        <composite name="messageHeader" description="The SBE header that is part of each message.">
            <type name="blockLength" primitiveType="uint16" description="The length of the message root block before repeating groups or variable data commences."/>
            <type name="templateId"  primitiveType="uint16" description="The identifier for the template type of the message that is to follow."/>
            <type name="schemaId"    primitiveType="uint16" description="The identifier for the schema that defines the message."/>
            <type name="version"     primitiveType="uint16" description="The version of the schema allowing for extension."/>
        </composite>
        <composite name="varDataEncoding" description="Definition for a variable length string.">
            <type name="length"  primitiveType="uint8" description="Length of string." maxValue="1300"/>
            <type name="varData" primitiveType="uint8" description="Array of UTF-8 characters." length="0" characterEncoding="UTF-8"/>
        </composite>
        <composite name="groupSizeEncoding" description="Repeating group dimensions." semanticType="NumInGroup">
            <type name="blockLength" description="Length of element."                  primitiveType="uint8"/>
            <type name="numInGroup"  description="Number of items in repeating group." primitiveType="uint8"/>
        </composite>
    </types>

    <types>
        <type name="LocalMktDate" description="Local calendar date in days since epoch."   presence="optional" nullValue="65535" primitiveType="uint16" semanticType="LocalMktDate"/>

        <type name="Text"              description="Free format text string."                  length="64"  primitiveType="char" semanticType="String"/>
        <type name="Username"          description="Id given to user for logging on."          length="32"  primitiveType="char" semanticType="String"/>
        <type name="Password"          description="Password used to logon."                   length="32"  primitiveType="char" semanticType="String"/>

    </types>

    <types>
        <enum name="TradeDateType" encodingType="char">
            <validValue name="STANDARD">0</validValue>
            <validValue name="NZD">1</validValue>
        </enum>
    </types>

    <!-- Session messages -->
    <sbe:message name="Logon" id="2" description="Used to logon to a market data session." semanticType="A">
        <field name="Username" id="533" type="Username" semanticType="String"/>
        <field name="Password" id="554" type="Password" semanticType="String"/>
    </sbe:message>
    <sbe:message name="LogonResponse" id="3" description="An acknowledgement from the server that the logon was successful as well as the expected heartbeat interval." semanticType="A">
    </sbe:message>
    <sbe:message name="Logout" id="4" description="A request to stop the session." semanticType="5">
        <field name="Text" id="58" type="Text" description="Free format text string. May include reason for logout." semanticType="String"/>
    </sbe:message>
    <sbe:message name="LogoutResponse" id="5" description="An acknowledgement that the session has been terminated." semanticType="5"/>
    <sbe:message name="Heartbeat" id="6" description="This is sent from each side of the connection after x seconds of inactivity." semanticType="0"/>

    <sbe:message name="TradeDateRequest" id="20030" description="Subscription to current and future Trade datechanges."
                 semanticType="TradeDateRequest">
    </sbe:message>

    <sbe:message name="TradeDateReport" id="20031"
                 description="Current trade date information. The group entry for 'STANDARD' is the default value. Any security with a different trade date is included as a different group entry.">
        <group name="NoTradeDates" id="20032" description="Current trade date information." dimensionType="groupSizeEncoding">
            <field name="Type" id="20033" type="TradeDateType" description="Type of security this trade date applies to."/>
            <field name="TradeDate" id="75" type="LocalMktDate" description="Trade Session Date of security." semanticType="LocalMktDate"/>
        </group>
    </sbe:message>

</sbe:messageSchema>