diff --git a/.gitignore b/.gitignore index 2762bb4..3463097 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .settings .project -*.docx +target +.DS_Store diff --git a/README.md b/README.md index 9aadb0c..81f4ac4 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,11 @@ # fix-simple-binary-encoding This project contains specifications and resources for Simple Binary Encoding (SBE). -SBE is a FIX standard for binary message encoding. +SBE is a FIX standard for binary message encoding. + +## *News* + +[application/sbe](https://www.iana.org/assignments/media-types/application/sbe) has been registered as a media type (formerly MIME type) at Internet Assigned Numbers Authority (IANA). A media type defines the format of the contents of an Internet message. ## Protocol stack SBE is part of a family of protocols created by the High Performance Working Group @@ -13,16 +17,16 @@ SBE is part of a family of protocols created by the High Performance Working Gro The planned lifecycle of this project is to roll out new features in a series of release candidates. After each release candidate is approved, it will be exposed to public review. Issues may be entered here in GitHub or in a discussion forum on the FIX Trading Community site. When a version is considered complete, the last release candidate will be promoted to Draft Standard. Following further public review, a Draft Standard may be promoted to the final specification for that version. Only minor errata are permitted. To reach the final stage, the Draft Standard must be reviewed for no less than 6 months, and at least two interoperable implementations must be certified. That version is henceforth immutable. -SBE version 1.0 has reached the final technical specification stage while release candidates have been developed for proposed version 2.0. +SBE version 1.0 has reached the final technical specification stage while release candidates have been developed for proposed version 2.0. ### Version 2.0 Release Candidate 2 -Version 2.0 RC2 was approved by the Global Technical Committee on August 15, 2019 for 90 day public review. +Version 2.0 RC2 was approved by the Global Technical Committee on August 15, 2019 for 90 day public review. Themes of this release: * Clarification about single-byte character sets -* Improvement of the XML schema, including support for XIinclude +* Improvement of the XML schema, including support for XInclude ### Version 2.0 Release Candidate 1 @@ -39,9 +43,9 @@ Version 1.0 Draft Standard was promoted to SBE version 1.0 Technical Specificati The standard met these criteria for promotion: * More than 6 months public review. During the period, some minor errors were found, and the errata were incorporated into the final specification. Thanks to users who detected those errors. -* At least two interopable implementations. This was demonstrated with the conformance test suite described below. +* At least two interoperable implementations. This was demonstrated with the conformance test suite described below. -SBE standards are available here in GitHub and on the [FIX Trading Community](http://www.fixtradingcommunity.org/pg/structure/tech-specs/simple-binary-encoding) site. +SBE standards are available here in GitHub and on the [FIX Trading Community](http://www.fixtradingcommunity.org/pg/structure/tech-specs/simple-binary-encoding) site. SBE version 1.0 specification with errata was posted July 27, 2018. @@ -57,10 +61,6 @@ Interested parties who wish to participate in the FIX High Performance Working G The [SBE Conformance project](https://github.com/FIXTradingCommunity/fix-sbe-conformance) provides a conformance test suite to verify interoperability of SBE implementations. All implementors are invited to demonstrate their conformance to the standard. ## License -FIX Simple Binary Encoding specifications are © Copyright 2014-2019 FIX Protocol Ltd. +FIX Simple Binary Encoding specifications are © Copyright 2014-2020 FIX Protocol Ltd. Creative Commons License
FIX Simple Binary Encoding by FIX Protocol Ltd. is licensed under a Creative Commons Attribution-NoDerivatives 4.0 International License.
Based on a work at https://github.com/FIXTradingCommunity/fix-simple-binary-encoding - - - - diff --git a/v1-0-RC1/doc/publication/FIX-Simple-Binary-Encoding-Specification-v0.9.2_RC1.pdf b/v1-0-RC1/doc/publication/FIX-Simple-Binary-Encoding-Specification-v0.9.2_RC1.pdf new file mode 100644 index 0000000..011b763 Binary files /dev/null and b/v1-0-RC1/doc/publication/FIX-Simple-Binary-Encoding-Specification-v0.9.2_RC1.pdf differ diff --git a/v1-0-RC2/doc/publication/Simple-Binary-Encoding-Release-Candidate-2.pdf b/v1-0-RC2/doc/publication/Simple-Binary-Encoding-Release-Candidate-2.pdf new file mode 100644 index 0000000..ba6bdfd Binary files /dev/null and b/v1-0-RC2/doc/publication/Simple-Binary-Encoding-Release-Candidate-2.pdf differ diff --git a/v1-0-RC3/doc/04MessageSchema.md b/v1-0-RC3/doc/04MessageSchema.md index d9e89a1..1a2e7fa 100644 --- a/v1-0-RC3/doc/04MessageSchema.md +++ b/v1-0-RC3/doc/04MessageSchema.md @@ -312,7 +312,7 @@ The `name` attribute of the `` uniquely identifies it. | sinceVersion | Documents the version of a schema in which a choice was added | nonNegativeInteger | default = 0 | | | deprecated | Documents the version of a schema in which a choice was deprecated. It should no longer be used in new messages. | nonnegativeInteger | optional | Must be less than or equal to the version of the message schema. | -#### `< choice >` element content +#### `` element content The element is required to carry a value, which is an unsigned integer representing a zero-based index to a bit within a bitset. Zero is the @@ -558,4 +558,4 @@ Reserved element names | unit | timestamp, TZ time | | version | messageHeader | | week | MonthYear | -| year | MonthYear | \ No newline at end of file +| year | MonthYear | diff --git a/v1-0-RC3/doc/publication/Simple-Binary-Encoding-Release-Candidate-3.pdf b/v1-0-RC3/doc/publication/Simple-Binary-Encoding-Release-Candidate-3.pdf new file mode 100644 index 0000000..a8d36af Binary files /dev/null and b/v1-0-RC3/doc/publication/Simple-Binary-Encoding-Release-Candidate-3.pdf differ diff --git a/v1-0-RC4/doc/publication/Simple-Binary-Encoding-Release-Candidate-4.pdf b/v1-0-RC4/doc/publication/Simple-Binary-Encoding-Release-Candidate-4.pdf new file mode 100644 index 0000000..463871c Binary files /dev/null and b/v1-0-RC4/doc/publication/Simple-Binary-Encoding-Release-Candidate-4.pdf differ diff --git a/v1-0-STANDARD/doc/00Title.md b/v1-0-STANDARD/doc/00Title.md deleted file mode 100644 index a81e663..0000000 --- a/v1-0-STANDARD/doc/00Title.md +++ /dev/null @@ -1,24 +0,0 @@ -![](./media/image1.jpeg) - -# Simple Binary Encoding -## Technical Specification - -Version 1.0 – February 9, 2017 - -THIS DOCUMENT IS THE FINAL VERSION OF A FIX TECHNICAL STANDARD. THIS VERSION HAS BEEN APPROVED BY THE GLOBAL TECHNICAL COMMITTEE AS THE FINAL STEP IN CREATING A NEW FIX TECHNICAL STANDARD OR A NEW VERSION OF AN EXISTING FIX TECHNICAL STANDARD. POTENTIAL ADOPTERS ARE STRONGLY ENCOURAGED TO USE ONLY THE FINAL VERSION. EXISTING ADOPTERS ARE STRONGLY ENCOURAGED TO UPGRADE TO THE FINAL VERSION. - -DISCLAIMER - -THE INFORMATION CONTAINED HEREIN AND THE FINANCIAL INFORMATION EXCHANGE PROTOCOL (COLLECTIVELY, THE "FIX PROTOCOL") ARE PROVIDED "AS IS" AND NO PERSON OR ENTITY ASSOCIATED WITH THE FIX PROTOCOL MAKES ANY REPRESENTATION OR WARRANTY, EXPRESS OR IMPLIED, AS TO THE FIX PROTOCOL (OR THE RESULTS TO BE OBTAINED BY THE USE THEREOF) OR ANY OTHER MATTER AND EACH SUCH PERSON AND ENTITY SPECIFICALLY DISCLAIMS ANY WARRANTY OF ORIGINALITY, ACCURACY, COMPLETENESS, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SUCH PERSONS AND ENTITIES DO NOT WARRANT THAT THE FIX PROTOCOL WILL CONFORM TO ANY DESCRIPTION THEREOF OR BE FREE OF ERRORS. THE ENTIRE RISK OF ANY USE OF THE FIX PROTOCOL IS ASSUMED BY THE USER. - -NO PERSON OR ENTITY ASSOCIATED WITH THE FIX PROTOCOL SHALL HAVE ANY LIABILITY FOR DAMAGES OF ANY KIND ARISING IN ANY MANNER OUT OF OR IN CONNECTION WITH ANY USER'S USE OF (OR ANY INABILITY TO USE) THE FIX PROTOCOL, WHETHER DIRECT, INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL (INCLUDING, WITHOUT LIMITATION, LOSS OF DATA, LOSS OF USE, CLAIMS OF THIRD PARTIES OR LOST PROFITS OR REVENUES OR OTHER ECONOMIC LOSS), WHETHER IN TORT (INCLUDING NEGLIGENCE AND STRICT LIABILITY), CONTRACT OR OTHERWISE, WHETHER OR NOT ANY SUCH PERSON OR ENTITY HAS BEEN ADVISED OF, OR OTHERWISE MIGHT HAVE ANTICIPATED THE POSSIBILITY OF, SUCH DAMAGES. - -**DRAFT OR NOT RATIFIED PROPOSALS** (REFER TO PROPOSAL STATUS AND/OR SUBMISSION STATUS ON COVER PAGE) ARE PROVIDED "AS IS" TO INTERESTED PARTIES FOR DISCUSSION ONLY. PARTIES THAT CHOOSE TO IMPLEMENT THIS DRAFT PROPOSAL DO SO AT THEIR OWN RISK. IT IS A DRAFT DOCUMENT AND MAY BE UPDATED, REPLACED, OR MADE OBSOLETE BY OTHER DOCUMENTS AT ANY TIME. THE FIX GLOBAL TECHNICAL COMMITTEE WILL NOT ALLOW EARLY IMPLEMENTATION TO CONSTRAIN ITS ABILITY TO MAKE CHANGES TO THIS SPECIFICATION PRIOR TO FINAL RELEASE. IT IS INAPPROPRIATE TO USE FIX WORKING DRAFTS AS REFERENCE MATERIAL OR TO CITE THEM AS OTHER THAN “WORKS IN PROGRESS”. THE FIX GLOBAL TECHNICAL COMMITTEE WILL ISSUE, UPON COMPLETION OF REVIEW AND RATIFICATION, AN OFFICIAL STATUS ("APPROVED") OF/FOR THE PROPOSAL AND A RELEASE NUMBER. - -No proprietary or ownership interest of any kind is granted with respect to the FIX Protocol (or any rights therein). - -Copyright 2013-2017 FIX Protocol Ltd., all rights reserved. - - -FIX Simple Binary Encoding by [FIX Protocol Ltd.](http://www.fixtradingcommunity.org/) is licensed under a [Creative Commons Attribution-NoDerivatives 4.0 International License](http://creativecommons.org/licenses/by-nd/4.0/). -Based on a work at diff --git a/v1-0-STANDARD/doc/01Introduction.md b/v1-0-STANDARD/doc/01Introduction.md index 27509e1..466c854 100644 --- a/v1-0-STANDARD/doc/01Introduction.md +++ b/v1-0-STANDARD/doc/01Introduction.md @@ -1,26 +1,95 @@ -Introduction -========================================================================================================================================================= +# Scope -FIX Simple Binary Encoding (SBE) targets high performance trading -systems. It is optimized for low latency of encoding and decoding while -keeping bandwidth utilization reasonably small. For compatibility, it is -intended to represent all FIX semantics. +This document provides the normative specification of Simple Binary Encoding (SBE), which is one of the possible syntaxes for FIX messages, but not limited to FIX messages. The scope comprises the encoding (wire format) and the message schema for SBE. + +# Normative references + +The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies. + +--- IETF RFC 2119 -- *Key words for use in RFCs to Indicate Requirement Levels* March 1997 + +# Terms and definitions + +For the purposes of this document, the terms and definitions given in ISO/IEC 11404 and the following apply. + +ISO and IEC maintain terminological databases for use in standardization at the following addresses: + +—-- ISO Online browsing platform: available at [https://www.iso.org/obp](https://www.iso.org/obp) + +—-- IEC Electropedia: available at [http://www.electropedia.org/](http://www.electropedia.org/) + + +## datatype +field type with its associated encoding attributes + +Note 1 to entry: Includes backing primitive types and valid values or range. Some types +have additional attributes, e.g. epoch of a date. + +## encoding +message format for interchange + +Note 1 to entry: The term is commonly used +to mean the conversion of one data format to another, such as text to +binary. However, SBE strives to use native binary +datatypes in order to make conversion unnecessary, or at least trivial. + +Note 2 to entry: Encoding also refers to the act of formatting a message, as opposed to decoding. + +## field +unit of data contained by a message + +## message schema +metadata that specifies messages and their data types and identifiers + +Note 1 to entry: Message schemas may be disseminated out of band. + +Note 2 to entry: For SBE, message schemas are expressed as an XML +document that conforms to an XML schema that is published as part of this standard. + +## message template +metadata that specifies the fields that belong to one particular message type + +Note 1 to entry: A message template is contained by a +message schema. + +## session protocol +protocol concerned with the reliable delivery of messages over a transport. + +Note 1 to entry: FIX makes a distinction between +session protocol and the encoding of a message payload, as described by +this document. See the [specifications section](https://www.fixtrading.org/standards/) of the FIX Protocol web site +for supported session protocols and encodings. + +## XML schema +defines the elements and attributes that may appear in an XML document. + +Note 1 to entry: The SBE message schema is defined in W3C (XSD) schema +language since it is the most widely adopted format for XML schemas. + +## Specification terms +These key words in this document are to be interpreted as described in IETF RFC 2119. + +# Objectives + +## General + +SBE was designed to meet the needs of high performance trading systems, but it may also be applicable to other applications with similar performance characteristics. It is optimized for low latency of encoding and decoding while +keeping bandwidth utilization reasonably small. For compatibility, it is intended to represent all FIX semantics. This encoding specification describes the wire protocol for messages. Thus, it provides a standard for interoperability between communicating parties. Users are free to implement the standard in a way that best suits their needs. -The encoding standard is complimentary to other FIX standards for +The encoding standard is complementary to other FIX standards for session protocol and application level behavior. -Binary type system ----------------------------------------------------------------------------------------------------------------- +## Binary type system In order to support traditional FIX semantics, all the documented field types are supported. However, instead of printable character representations of tag-value encoding, the type system binds to native -binary data types, and defines derived types as needed. +binary datatypes, and defines derived types as needed. The binary type system has been enhanced in these ways: @@ -34,21 +103,19 @@ The binary type system has been enhanced in these ways: - Provides a consistent system of enumerations, Boolean switches and multiple-choice fields. -Design principles ---------------------------------------------------------------------------------------------------------------- +## Design principles The message design strives for direct data access without complex transformations or conditional logic. This is achieved by: -- Usage of native binary data types and simple types derived from +- Usage of native binary datatypes and simple types derived from native binaries, such as prices and timestamps. - Preference for fixed positions and fixed length fields, supporting direct access to data and avoiding the need for management of heaps of variable-length elements which must be sequentially processed. -Message schema ------------------------------------------------------------------------------------------------------------- +## Message schema This standard describes how fields are encoded and the general structure of messages. The content of a message type is specified by a message @@ -57,46 +124,12 @@ their location within a message. Additionally, the metadata describes valid value ranges and information that need not be sent on the wire, such as constant values. -Message schemas may be based on standard FIX message specifications, or +Message schemas may be based on standard FIX message specifications or may be customized as needed by agreement between counterparties. -Glossary ------------------------------------------------------------------------------------------------------- - -**Data type** - A field type with its associated encoding attributes, -including backing primitive types and valid values or range. Some types -have additional attributes, e.g. epoch of a date. - -**Encoding** - a message format for interchange. The term is commonly used -to mean the conversion of one data format to another, such as text to -binary. However, Simple Binary Encoding strives to use native binary -data types in order to make conversion unnecessary, or at least trivial. -Encoding also refers to the act of formatting a message, as opposed to -decoding. - -**Message schema** - metadata that specifies messages and their data -types and identifiers. Message schemas may be disseminated out of band. -For Simple Binary Encoding, message schemas are expressed as an XML -document that conforms to an XML schema that is published as part of -this standard. - -**Message template** - metadata that specifies the fields that belong to -one particular message type. A message template is contained by a -message schema. +## Documentation -**Session protocol** - a protocol concerned with the reliable delivery of -messages over a transport. FIX protocol makes a distinction between -session protocol and the encoding of a message payload, as described by -this document. See the specifications section of FIX protocol web site -for supported protocols. The original FIX session protocol is known as -FIXT. - -**XML schema** - defines the elements and attributes that may appear in an -XML document. The SBE message schema is defined in W3C (XSD) schema -language since it is the most widely adopted format for XML schemas. - -Documentation ------------------------------------------------------------------------------------------------------------ +### General This document explains: @@ -106,28 +139,7 @@ This document explains: and relationship to a message header that may be provided by a session protocol. -- The Simple Binary Encoding message schema. - -### Specification terms - -These key words in this document are to be interpreted as described in -[Internet Engineering Task Force RFC2119](http://www.apps.ietf.org/rfc/rfc2119.html). These terms indicate -an absolute requirement for implementations of the standard: "**must**", -or "**required**". - -This term indicates an absolute prohibition: "**must not**". - -These terms indicate that a feature is allowed by the standard but not -required: "**may**", "**optional**". An implementation that does not -provide an optional feature must be prepared to interoperate with one -that does. - -These terms give guidance, recommendation or best practices: -"**should**" or "**recommended**". A recommended choice among -alternatives is described as "**preferred**". - -These terms give guidance that a practice is not recommended: "**should not**" -or "**not recommended**". +- The SBE message schema. ### Document format @@ -137,52 +149,9 @@ and data examples. This is a sample encoding specification ```xml - + ``` This is sample data as it would be transmitted on the wire `10270000` - -References -------------------------------------------------------------------------------------------------------------------------------------------------------- - -### Related FIX Standards - -*Simple Open Framing Header*, FIX Protocol, Limited. Version 1.0 Draft Standard -specification has been published at - - -For FIX semantics, see the current FIX message specification, which is -currently [FIX 5.0 Service Pack 2](http://www.fixtradingcommunity.org/pg/structure/tech-specs/fix-version/50-service-pack-2) -with Extension Packs. - -### Dependencies on other standards - -SBE is dependent on several industry standards. Implementations must -conform to these standards to interoperate. Therefore, they are -normative for SBE. - -[IEEE 754-2008](http://ieeexplore.ieee.org/servlet/opac?punumber=4610933) A -Standard for Binary Floating-Point Arithmetic - -[ISO 639-1:2002](http://www.iso.org/iso/home/store/catalogue_tc/catalogue_detail.htm?csnumber=22109) -Codes for the representation of names of languages - Part 1: Alpha-2 -code - -[ISO 3166-1:2013](http://www.iso.org/iso/home/store/catalogue_tc/catalogue_detail.htm?csnumber=63545) -Codes for the representation of names of countries and their -subdivisions - Part 1: Country codes - -[ISO 4217:2015](https://www.iso.org/standard/64758.html) -Codes for the representation of currencies and funds - -[ISO 8601:2004](http://www.iso.org/iso/home/store/catalogue_tc/catalogue_detail.htm?csnumber=40874) -Data elements and interchange formats - Information interchange - -Representation of dates and times - -[ISO 10383:2012](http://www.iso.org/iso/home/store/catalogue_tc/catalogue_detail.htm?csnumber=61067) -Securities and related financial instruments - Codes for exchanges and -market identification (MIC) - -XML 1.1 schema standards are located here [W3C XML Schema](http://www.w3.org/XML/Schema.html#dev) diff --git a/v1-0-STANDARD/doc/02FieldEncoding.md b/v1-0-STANDARD/doc/02FieldEncoding.md index 4ebe190..4226ee7 100644 --- a/v1-0-STANDARD/doc/02FieldEncoding.md +++ b/v1-0-STANDARD/doc/02FieldEncoding.md @@ -1,47 +1,55 @@ -Field Encoding -=========================================================================================================================================================== +# Field Encoding -Field aspects ------------------------------------------------------------------------------------------------------------ +## Field aspects -A field is a unit of data contained by a FIX message. Every field has -the following aspects: semantic data type, encoding, and metadata. They -will be specified in more detail in the sections on data type encoding +### General + +Every field has +the following aspects: semantic datatype, encoding, and metadata. They +will be specified in more detail in the sections on datatype encoding and message schema but are introduced here as an overview. -### Semantic data type +### Semantic datatype + +#### FIX datatype -The FIX semantic data type of a field tells a data domain in a broad +The FIX semantic datatype of a field tells a data domain in a broad sense, for example, whether it is numeric or character data, or whether it represents a time or price. Simple Binary Encoding represents all of -the semantic data types that FIX protocol has defined across all -encodings. In message specifications, FIX data type is declared with -attribute semanticType. See the section 2.2 below for a listing of those -FIX types. +the semantic datatypes that FIX protocol has defined across all +encodings. In message specifications, FIX datatype is declared with +attribute semanticType. See the section [*FIX datatype summary*](#fix-data-type-summary) for details. + +#### Generic datatype + +A datatype is defined as a combination of a value space and a lexical space. Value +space is the range of its possible values while lexical space is how those values are represented in a message encoding, in this case SBE. +Value space of datatypes is defined using the vocabulary in ISO/IEC 11404:2007 *Information technology – General-Purpose Datatypes (GPD)*. +That standard defines types independently of platform and programming language. ### Encoding -Encoding tells how a field of a specific data type is encoded on the -wire. An encoding maps a FIX data type to either a simple, primitive -data type, such as a 32 bit signed integer, or to a composite type. A +Encoding tells how a field of a specific datatype is encoded on the +wire. An encoding maps a FIX datatype to either a simple, primitive +datatype, such as a 32-bit signed integer, or to a composite type. A composite type is composed of two or more simple primitive types. For -example, the FIX data type Price is encoded as a decimal, a composite +example, the FIX datatype Price is encoded as a decimal, a composite type containing a mantissa and an exponent. Note that many fields may -share a data type and an encoding. The sections that follow explain the -valid encodings for each data type. +share a datatype and an encoding. The sections that follow explain the +valid encodings for each datatype. ### Metadata Field metadata, part of a message schema, describes a field to application developers. Elements of field metadata are: -- Field ID, also known as FIX tag, is a unique identifier of a field +- Field ID, also known as FIX tag number, is a unique identifier of a field for semantic purposes. For example, tag 55 identifies the Symbol field of an instrument. - Field name, as it is known in FIX specifications -- The FIX semantic data type and encoding type that it maps to +- The FIX semantic datatype and encoding type that it maps to - Valid values or data range accepted @@ -53,14 +61,14 @@ encode a message in order to decode it. In other words, Simple Binary Encoding messages are not self-describing. Rather, message schemas are typically exchanged out-of-band between counterparties. -See section 4 below for a detailed message schema specification. +See section [*Message Schema*](#message-schema-1) for details. ### Field presence By default, fields are assumed to be required in a message. However, fields may be specified as optional. To indicate that a value is not set, a special null indicator value is sent on the wire. The null value -varies according to data type and encoding. Global defaults for null +varies according to datatype and encoding. Global defaults for null value may be overridden in a message schema by explicitly specifying the value that indicates nullness. @@ -75,72 +83,70 @@ value of an optional field does not necessarily imply that a default value should be applied. Rather, default handling is left to application layer specifications. -FIX data type summary ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ +## FIX datatype summary FIX semantic types are mapped to binary field encodings as follows. See sections below for more detail about each type. Schema attributes may restrict the range of valid values for a field. -See Common field schema attributes below. - -| FIX semantic type | Binary type | Section | Description | -|----------------------------------|-------------------------------------------------------------------------------------------|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| int | Integer encoding | 2.4 | An integer number | -| Length | Integer encoding | 2.4 | Field length in octets. Value must be non-negative. | -| TagNum | Integer encoding | 2.4 | A field's tag number. Value must be positive. | -| SeqNum | Integer encoding | 2.4 | A field representing a message sequence number. Value must be positive | -| NumInGroup | Group dimension encoding | 3.4.8 | A counter representing the number of entries in a repeating group. Value must be positive. | -| DayOfMonth | Integer encoding | 2.4 | A field representing a day during a particular month (values 1 to 31). | -| Qty | Decimal encoding | 2.5 | A number representing quantity of a security, such as shares. The encoding may constrain values to integers, if desired. | -| float | Float encoding | 2.5 | A real number with binary representation of specified precision | -| Price | Decimal encoding | 2.5 | A decimal number representing a price | -| PriceOffset | Decimal encoding | 2.5 | A decimal number representing a price offset, which can be mathematically added to a Price. | -| Amt | Decimal encoding | 2.5 | A field typically representing a Price times a Qty. | -| Percentage | Decimal encoding | 2.5 | A field representing a percentage (e.g. 0.05 represents 5% and 0.9525 represents 95.25%). | -| char | Character | 2.7.1 | Single US-ASCII character value. Can include any alphanumeric character or punctuation. All char fields are case sensitive (i.e. m != M). | -| String | Fixed-length character array | 2.7.2 | A fixed-length character array of ASCII encoding | -| String | Variable-length data encoding | 2.7.3 | Alpha-numeric free format strings can include any character or punctuation. All String fields are case sensitive (i.e. morstatt != Morstatt). ASCII encoding. | -| String—EncodedText | String encoding | 2.7.3 | Non-ASCII string. The character encoding may be specified by a schema attribute. | -| XMLData | String encoding | 2.7.3 | Variable-length XML. Must be paired with a Length field. | -| data | Fixed-length data | 2.8.1 | Fixed-length non-character data | -| data | Variable-length data encoding | 2.8.2 | Variable-length data. Must be paired with a Length field. | -| Country | Fixed-length character array; size = 2 or a subset of values may use Enumeration encoding | 2.7.2 | ISO 3166-1:2013 Country code | -| Currency | Fixed-length character array; size = 3 or a subset of values may use Enumeration encoding | 2.7.2 | ISO 4217:2015 Currency code (3 character) | -| Exchange | Fixed-length character array; size = 4 or a subset of values may use Enumeration encoding | 2.7.2 | ISO 10383:2012 Market Identifier Code (MIC) | -| Language | Fixed-length character array; size = 2 or a subset of values may use Enumeration encoding | 2.7.2 | National language - uses ISO 639-1:2002 standard | -| Implicit enumeration—char or int | Enumeration encoding | 2.12 | A single choice of alternative values | -| Boolean | Boolean encoding | 2.12.6 | Values true or false | -| MultipleCharValue | Multi-value choice encoding | 2.13 | Multiple choice of a set of values | -| MultipleStringValue | Multi-value choice encoding**.** String choices must be mapped to int values. | 2.13 | Multiple choice of a set of values | -| MonthYear | MonthYear encoding | 2.8 | A flexible date format that must include month and year at least, but may also include day or week. | -| UTCTimestamp | Date and time encoding | 2.9 | Time/date combination represented in UTC (Universal Time Coordinated, also known as "GMT") | -| UTCTimeOnly | Date and time encoding | 2.9 | Time-only represented in UTC (Universal Time Coordinated, also known as "GMT") | -| UTCDateOnly | Date and time encoding | 2.9 | Date represented in UTC (Universal Time Coordinated, also known as "GMT") | -| LocalMktDate | Local date encoding | 2.9 | Local date(as oppose to UTC) | -| TZTimeOnly | TZTimeOnly | 2.11.3 | Time of day | -| TZTimestamp | TZTimestamp | 2.11.1 | Time/date combination representing local time with an offset to UTC to allow identification of local time and timezone offset of that time. The representation is based on ISO 8601:2004 | +See section [*Common field schema attributes*](#common-field-schema-attributes) for details. + +| FIX semantic type | Binary type | Value space (ISO/IEC 11404:2007) | Description | +|--------------|-------------------------|-------------|-------------------| +| int | [Integer encoding](#integer-encoding) | integer range | An integer number | +| Length | [Integer encoding](#integer-encoding) | size | Field length in octets. Value must be non-negative. | +| TagNum | [Integer encoding](#integer-encoding) | ordinal | A field's tag number. Value must be positive. | +| SeqNum | [Integer encoding](#integer-encoding) | ordinal | A field representing a message sequence number. Value must be positive | +| NumInGroup | [Group dimension encoding](#group-dimension-encoding) | size | A counter representing the number of entries in a repeating group. Value must be positive. | +| DayOfMonth | [Integer encoding](#integer-encoding) | integer range 1..31 | A field representing a day during a particular month (values 1 to 31). | +| Qty | [Decimal encoding](#decimal-encoding) | Scaled | A number representing quantity of a security, such as shares. The encoding may constrain values to integers, if desired. | +| float | [Float encoding](#float-encoding) | real | A real number with binary representation of specified precision | +| Price | [Decimal encoding](#decimal-encoding) | Scaled | A decimal number representing a price | +| PriceOffset | [Decimal encoding](#decimal-encoding) | Scaled | A decimal number representing a price offset, which can be mathematically added to a Price. | +| Amt | [Decimal encoding](#decimal-encoding) | Scaled | A field typically representing a Price times a Qty. | +| Percentage | [Decimal encoding](#decimal-encoding) | Scaled | A field representing a percentage (e.g. 0.05 represents 5% and 0.9525 represents 95.25%). | +| char | [Character](#character) | character | Single US-ASCII character value. Can include any alphanumeric character or punctuation. All char fields are case sensitive (i.e. m != M). | +| String | [Fixed-length character array](#fixed-length-character-array) | array element = character | A fixed-length character array of ASCII encoding | +| String | [Variable-length data encoding](#variable-length-string-encoding) | characterstring | Alpha-numeric free format strings can include any character or punctuation. All String fields are case sensitive (i.e. morstatt != Morstatt). ASCII encoding. | +| String—EncodedText | [String encoding](#variable-length-string-encoding) | characterstring | Non-ASCII string. The character encoding may be specified by a schema attribute. | +| XMLData | [String encoding](#variable-length-string-encoding) | characterstring |Variable-length XML. Must be paired with a Length field. | +| data | [Fixed-length data](#fixed-length-data) | array element=octet | Fixed-length non-character data | +| data | [Variable-length data encoding](#variable-length-data-encoding) | octetstring | Variable-length data. Must be paired with a Length field. | +| Country | [Fixed-length character array](#fixed-length-character-array); size = 2 or a subset of values may use [Enumeration encoding](#enumeration-encoding) | array (1..2) of character | ISO 3166-1:2013 Country code | +| Currency | [Fixed-length character array](#fixed-length-character-array); size = 3 or a subset of values may use [Enumeration encoding](#enumeration-encoding) | array (1..3) of character | ISO 4217:2015 Currency code (3 character) | +| Exchange | [Fixed-length character array](#fixed-length-character-array); size = 4 or a subset of values may use [Enumeration encoding](#enumeration-encoding) | array (1..4) of character | ISO 10383:2012 Market Identifier Code (MIC) | +| Language | [Fixed-length character array](#fixed-length-character-array); size = 2 or a subset of values may use [Enumeration encoding](#enumeration-encoding) | array (1..2) of character | National language - uses ISO 639-1:2002 standard | +| Implicit enumeration—char or int | [Enumeration encoding](#enumeration-encoding) | state | A single choice of alternative values | +| Boolean | [Boolean encoding](#boolean-encoding) | boolean | Values true or false | +| MultipleCharValue | [Multi-value choice encoding](#multi-value-choice-encoding) | set element = character | Multiple choice of a set of values | +| MultipleStringValue| [Multi-value choice encoding](#multi-value-choice-encoding). String choices must be mapped to int values. | set element = characterstring | Multiple choice of a set of values | +| MonthYear | [MonthYear encoding](#monthyear-encoding) | record | A flexible date format that must include month and year at least but may also include day or week. | +| UTCTimestamp | [Date and time encoding](#date-and-time-encoding) | time | Time/date combination represented in UTC (Universal Time Coordinated, also known as "GMT") | +| UTCTimeOnly | [Date and time encoding](#date-and-time-encoding) | time | Time-only represented in UTC (Universal Time Coordinated, also known as "GMT") | +| UTCDateOnly | [Date and time encoding](#date-and-time-encoding) | time | Date represented in UTC (Universal Time Coordinated, also known as "GMT") | +| LocalMktDate | [Local date encoding](#local-date-encoding) | time | Local date (as opposed to UTC) | +| TZTimeOnly | [TZTimeOnly encoding](#tztimeonly-encoding) | time | Time of day | +| TZTimestamp | [TZTimestamp encoding](#tztimestamp-encoding) | time | Time/date combination representing local time with an offset to UTC to allow identification of local time and timezone offset of that time. The representation is based on ISO 8601:2004 | The FIX semantic types listed above are spelled and capitalized exactly as they are in the FIX repository from which official FIX documents and references are derived. -Common field schema attributes ------------------------------- +## Common field schema attributes -Schema attributes alter the range of valid values for a field. -Attributes are optional unless specified otherwise. +### General +Schema attributes alter the range of valid values for a field. Attributes are optional unless specified otherwise. -| Schema attribute | Description | -|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| presence=required | The field must always be set. This is the default presence. Mutually exclusive with nullValue. | -| presence=constant | The field has a constant value that need not be transmitted on the wire. Mutually exclusive with value attributes. | -| presence=optional | The field need not be populated. A special null value indicates that a field is not set. The presence attribute may be specified on either on a field or its encoding. | +| Schema attribute | Description | +|-------------------|-------------------------------------------------------------------| +| presence=required | The field must always be set. This is the default presence. Mutually exclusive with nullValue. | +| presence=constant | The field has a constant value that need not be transmitted on the wire. Mutually exclusive with value attributes. | +| presence=optional | The field need not be populated. A special null value indicates that a field is not set. The presence attribute may be specified on either on a field or its encoding. | | nullValue | A special value that indicates that an optional value is not set. See encodings below for default nullValue for each type. Mutually exclusive with presence=required and constant. | -| minValue | The lowest valid value of a range. Applies to scalar data types, but not to String or data types. | -| maxValue | The highest valid value of a range (inclusive unless specified otherwise). Applies to scalar data types, but not to String or data types. | -| semanticType | Tells the FIX semantic type of a field or encoding. It may be specified on either a field or its encoding. | +| minValue | The lowest valid value of a range. Applies to scalar datatypes, but not to String or datatypes. | +| maxValue | The highest valid value of a range (inclusive unless specified otherwise). Applies to scalar datatypes, but not to String or datatypes. | +| semanticType | Specifies the FIX semantic type of a field or encoding. It may be specified on either a field or its encoding. | ### Inherited attributes @@ -151,25 +157,26 @@ fields that use that encoding. ### Non-FIX types Encodings may be added to SBE messages that do not correspond to listed -FIX data types. In that case, the encoding and fields that use the +FIX datatypes. In that case, the encoding and fields that use the encoding will not have a semanticType attribute. -Integer encoding -------------------------------------------------------------------------------------------------------------------------------------------------------------- +## Integer encoding + +### General Integer encodings should be used for cardinal or ordinal number fields. Signed integers are encoded in a two's complement binary format. ### Primitive type encodings -Numeric data types may be specified by range and signed or unsigned +Numeric datatypes may be specified by range and signed or unsigned attribute. Integer types are intended to convey common platform -primitive data types as they reside in memory. An integer type should be +primitive datatypes as they reside in memory. An integer type should be selected to hold the maximum range of values that a field is expected to hold. | Primitive type | Description | Length (octets) | -|----------------|---------------------------------------|----------------:| +|----------------|---------------------------------------|:---------------:| | int8 | Signed byte | 1 | | uint8 | Unsigned byte / single-byte character | 1 | | int16 | 16-bit signed integer | 2 | @@ -181,7 +188,7 @@ hold. ### Range attributes for integer fields -The default data ranges and null indicator are listed below for each +The default data range and null indicator are listed below for each integer encoding. A message schema may optionally specify a more restricted range of valid @@ -194,11 +201,11 @@ overridden by a message schema. Required and optional fields of the same primitive type have the same data range. The null value must not be set for a required field. - Schema attribute | int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | -|------------------|-----:|------:|-------:|-------:|--------------------:|-------------------:|--------------------:|-------------------:| -| minValue | –127 | 0 | –32767 | 0 | –231 + 1 | 0 | –263 + 1 | 0 | -| maxValue | 127 | 254 | 32767 | 65534 | 231 – 1 | 232 – 2 | 263 – 1 | 264 – 2 | -| nullValue | –128 | 255 | –32768 | 65535 | –231 | 232 – 1 | –263 | 264 – 1 | + Schema attribute | int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | +|-----------|-----:|------:|-------:|-------:|--------:|-------:|--------:|-------:| +| minValue | –127 | 0 | –32767 | 0 | –2^31^ + 1 | 0 | –2^63^ + 1 | 0 | +| maxValue | 127 | 254 | 32767 | 65534 | 2^31^ – 1 | 2^32^ – 2 | 2^63^ – 1 | 2^64^ – 2 | +| nullValue | –128 | 255 | –32768 | 65535 | –2^31^ | 2^32^ – 1 | –2^63^ | 2^64^ – 1 | ### Byte order @@ -207,7 +214,7 @@ components, is specified globally in a message schema. Little-Endian order is the default encoding, meaning that the least significant byte is serialized first on the wire. -See section 4.3.1 for specification of message schema attributes, +See section [*Message schema attributes*](#messageschema-attributes) for the specification, including byteOrder. Message schema designers should specify the byte order most appropriate to their system architecture and that of their counterparties. @@ -236,8 +243,7 @@ hexadecimal digits in Little-Endian byte order. Example integer field specification ```xml - + ``` Value on the wire - uint32 value decimal 10,000, hexadecimal 2710. @@ -247,10 +253,8 @@ Value on the wire - uint32 value decimal 10,000, hexadecimal 2710. Optional field with a valid range 0-6 ```xml - - + + ``` Wire format of uint8 value decimal 3. @@ -260,8 +264,7 @@ Wire format of uint8 value decimal 3. Sequence number field with integer encoding ```xml - + ``` Wire format of uint64 value decimal 100,000,000,000, hexadecimal @@ -273,12 +276,13 @@ Wire format of uint16 value decimal 10000, hexadecimal 2710. `1027` -Wire format of uint32 null value 232 - 1 +Wire format of uint32 null value 2^32^ - 1 `ffffffff` -Decimal encoding ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +## Decimal encoding + +### General Decimal encodings should be used for prices and related monetary data types like PriceOffset and Amt. @@ -289,6 +293,8 @@ is appropriate to the application or market. ### Composite encodings +#### General + Prices are encoded as a scaled decimal, consisting of a signed integer mantissa and signed exponent. For example, a mantissa of 123456 and exponent of -4 represents the decimal number 12.3456. @@ -310,16 +316,16 @@ fixed-point decimal specifies a fixed exponent in a message schema. A constant negative exponent specifies a number of assumed decimal places to the right of the decimal point. -Implementations should support both 32 bit and 64 bit mantissa. The +Implementations should support both 32-bit and 64-bit mantissa. The usage depends on the data range that must be represented for a -particular application. It is expected that an 8 bit exponent should be +particular application. It is expected that an 8-bit exponent should be sufficient for all FIX uses. | Encoding type | Description | Backing primitives | Length (octets) | -|---------------|------------------------|--------------------|----------------:| -| decimal | Floating-point decimal | Composite: int64 mantissa, int8 exponent | 9 | -| decimal64 | Fixed-point decimal | int64 mantissa, constant exponent | 8 | -| decimal32 | Fixed-point decimal | int32 mantissa, constant exponent | 4 | +|---------------|------------------------|--------------------|:---------------:| +| decimal | Floating-point decimal | Composite: int64 mantissa, int8 exponent | 9 | +| decimal64 | Fixed-point decimal | int64 mantissa, constant exponent | 8 | +| decimal32 | Fixed-point decimal | int32 mantissa, constant exponent | 4 | Optionally, implementations may support any other signed integer types for mantissa and exponent. @@ -333,14 +339,13 @@ A message schema may optionally specify a more restricted range of valid values for a field. For optional fields, a special mantissa value is used to indicate that a field value is null. -| Schema attribute | decimal | decimal64 | decimal32 | -|------------------|------------------------------------------:|------------------------------------------:|------------------------------------------:| -| exponent range | –128 to 127 | –128 to 127 | –128 to 127 | -| mantissa range | –263 + 1 to 263 – 1 | –263 + 1 to 263 – 1 | –231 + 1 to 231 – 1 | -| minValue | (–263 + 1) \* 10127 | (–263 + 1) \* 10127 | (–231 + 1) \* 10127 | -| maxValue | (263 – 1) \* 10127 | (263 – 1) \* 10127 | (231 – 1) \* 10127 | -| nullValue | mantissa=–263, exponent=–128 | mantissa =–263 | mantissa =–231 | - +| Schema attribute | decimal | decimal64 | decimal32 | +|------------------|------------------------:|-------------------:|-------------------:| +| exponent range | –128 to 127 | –128 to 127 | –128 to 127 | +| mantissa range | –2^63^ + 1 to 2^63^ – 1 | –2^63^ + 1 to 2^63^ – 1 | –2^31^ + 1 to 2^31^ – 1 | +| minValue | (–2^63^ + 1) \* 10^127^ | (–2^63^ + 1) \* 10^127^ | (–2^31^ + 1) \* 10^127^ | +| maxValue | (2^63^ – 1) \* 10^127^ | (2^63^ – 1) \* 10^127^ | (2^31^ – 1) \* 10^127^ | +| nullValue | mantissa=–2^63^, exponent=–128 | mantissa =–2^63^ | mantissa =–2^31^ | ### Encoding specifications for decimal types @@ -359,14 +364,12 @@ Decimal encoding specifications that an implementation must support - -2 + -2 - -2 + -2 ``` @@ -375,29 +378,27 @@ Decimal encoding specifications that an implementation must support When both mantissa and exponent are sent on the wire for a decimal, the elements are packed by default. However, byte alignment may be controlled by specifying offset of the exponent within the composite -encoding. See section 4.4.4.3 below. +encoding. See section [*Element offset within a composite type*](#element-offset-within-a-composite-type) for details. ### Examples of decimal fields Examples show encoded bytes on the wire as hexadecimal digits, little-endian. -FIX Qty data type is a float type, but a decimal may be constrained to +FIX Qty datatype is a float type, but a decimal may be constrained to integer values by setting exponent to zero. ```xml - 0 + 0 ``` -Field inherits semanticType from encoding +Field inherits attribute semanticType from encoding ```xml - + ``` Wire format of decimal 123.45 with 2 significant decimal places. @@ -414,24 +415,25 @@ Schema attribute exponent = -2 `39300000` -Float encoding ------------------------------------------------------------------------------------------------------------- +## Float encoding + +### General Binary floating point encodings are compatible with IEEE Standard for -Floating-Point Arithmetic (IEEE 754-2008). They should be used for +Floating-Point Arithmetic (IEEE 754-2019). They should be used for floating point numeric fields that do not represent prices or monetary amounts. Examples include interest rates, volatility and dimensionless quantities such as ratios. On the other hand, decimal prices should be -encoded as decimals; see section 2.5 above. +encoded as decimals; see section [*Decimal encoding*](#decimal-encoding) for details. ### Primitive types Both single and double precision encodings are supported as primitive -data types. See the IEEE 754-2008 standard for ranges and details of the +datatypes. See the IEEE 754-2019 standard for ranges and details of the encodings. -| Primitive type | Description | IEEE 754-2008 format | Length (octets) | -|----------------|---------------------------------|----------------------|----------------:| +| Primitive type | Description | IEEE 754-2019 format | Length (octets) | +|----------------|---------------------------------|----------------------|:---------------:| | float | Single precision floating point | binary32 | 4 | | double | Double precision floating point | binary64 | 8 | @@ -443,9 +445,7 @@ encoding. Technically, it indicated by the so-called quiet NaN. ### Byte order -Like integer encodings, floating point encodings follow the byte order -specified by message schema. See section 4.3.1 for specification of -message schema attributes, including byteOrder. +Like integer encodings, floating point encodings follow the byte order specified by message schema. See section [*Message schema attributes*](#messageschema-attributes) for the specification, including byteOrder. ### Float encoding specifications @@ -467,8 +467,7 @@ A single precision ratio ```xml - + ``` Wire format of float 255.678 @@ -479,8 +478,9 @@ Wire format of double 255.678 `04560e2db2f56f40` -String encodings ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ +## String encodings + +### General Character data may either be of fixed size or variable size. In Simple Binary Encoding, fixed-length fields are recommended in order to support @@ -490,13 +490,14 @@ also be used for non-ASCII encoded strings. ### Character +#### General + Character fields hold a single character. They are most commonly used -for field with character code enumerations. See section 2.12 below for -discussion of enum fields. +for field with character code enumerations. See section [*Enumeration encoding*](#enumeration-encoding) for details. -| FIX data type | Description | Backing primitive | Length (octet) | -|---------------|-----------------------------|-------------------|---------------:| -| char | A single US-ASCII character | char | 1 | +| FIX datatype | Description | Backing primitive | Length (octet) | +|--------------|-----------------------------|-------------------|:--------------:| +| char | A single US-ASCII character | char | 1 | #### Range attributes for char fields @@ -524,17 +525,19 @@ Wire format of char encoding of "A" (ASCII value 65, hexadecimal 41) ### Fixed-length character array +#### General + Character arrays are allocated a fixed space in a message, supporting direct access to fields. A fixed size character array is distinguished from a variable length string by the presence of a length schema attribute or a constant attribute. -| FIX data type | Description | Backing primitives | Length (octets) | Required schema attribute | -|---------------|-----------------|-----------------------------------------------------------------------------------------------------------------------------|-------------------------------|--------------------------------------------------------------------| -| String | character array | Array of char of specified length, delimited by NUL character if a string is shorter than the length specified for a field. | Specified by length attribute | length (except may be inferred from a constant value, if present). | +| FIX datatype | Description | Backing primitives | Length (octets) | Required schema attribute| +|-----------------|-----------------|---------------------------------|--------------------------|-------------------------------| +| String | character array | Array of char of specified length, padded by NUL character if a string is shorter than the length specified for a field. | Specified by length attribute | length (except may be inferred from a constant value, if present). | A length attribute set to zero indicates variable length. See section -2.7.3 below for variable-length data encoding. +[*Variable-length string encoding*](#variable-length-string-encoding) for details. #### Encoding specifications for fixed-length character array @@ -553,8 +556,7 @@ encoding. A typical string encoding specification ```xml - + ``` @@ -568,9 +570,7 @@ M S F T A character array constant specification ```xml -XEUR +XEUR ``` @@ -589,10 +589,10 @@ is made at an encoding layer between an empty string and a null string. Semantics of an empty variable-length string should be specified at an application layer. -| FIX data type | Description | Backing primitives | Length (octets) | -|---------------|---------------------------------------|----------------------------------------------------------------------------------------------------------------------------|-----------------| -| Length | The length of variable data in octets | primitiveType="uint8" or "uint16" May not hold null value. | 1 or 2 | -| data | Raw data | Array of octet of size specified in associated Length field. The data field itself should be specified as variable length. primitiveType="uint8" length="0" indicates variable length | variable | +| FIX datatype | Description | Backing primitives | Length (octets) | +|---------------|------------------|------------------------------------|-----------------| +| Length | The length of variable data in octets | primitiveType="uint8" or "uint16" May not hold null value. | 1 or 2 | +| data | Raw data | Array of octet of size specified in associated Length field. The data field itself should be specified as variable length. primitiveType="uint8" length="0" indicates variable length | variable | Optionally, implementations may support any other unsigned integer types for length. @@ -629,8 +629,7 @@ Encoding specification for variable length data up to 65535 octets ```xml - + @@ -652,8 +651,9 @@ M S F T `04004d534654` -Data encodings --------------- +## Data encodings + +### General Raw data is opaque to SBE. In other words, it is not constrained by any value range or structure known to the messaging layer other than length. @@ -661,20 +661,22 @@ Data fields simply convey arrays of octets. Data may either be of fixed-length or variable-length. In Simple Binary Encoding, fixed-length data encoding may be used for data of -predetermined length, even though it does not represent a FIX data type. +predetermined length, even though it does not represent a FIX datatype. Variable-length encoding should be reserved for raw data when its length is not known until run-time. ### Fixed-length data +#### General + Data arrays are allocated as a fixed space in a message, supporting direct access to fields. A fixed size array is distinguished from a variable length data by the presence of a length schema attribute rather than sending length on the wire. -| FIX data type | Description | Backing primitives | Length (octets) | Required schema attribute | -|---------------|-------------|-------------------------------------|-------------------------------|---------------------------| -| data | octet array | Array of uint8 of specified length. | Specified by length attribute | length | +| FIX datatype | Description | Backing primitives | Length (octets) | Required schema attribute | +|--------------|----------------|-------------------------------------|-------------------------|---------------------| +| data | octet array | Array of uint8 of specified length. | Specified by length attribute | length | #### Encoding specifications for fixed-length data @@ -707,10 +709,10 @@ case, no space is reserved for the data. Semantics of an empty variable-length data element should be specified at an application layer. -| FIX data type | Description | Backing primitives | Length (octets) | -|---------------|---------------------------------------|----------------------------------------------------------------------------------------------------------------------------|-----------------| -| Length | The length of variable data in octets | primitiveType="uint8" or "uint16" May not hold null value. | 1 or 2 | -| data | Raw data | Array of octet of size specified in associated Length field. The data field itself should be specified as variable length. primitiveType="uint8" | variable +| FIX datatype | Description | Backing primitives | Length (octets) | +|---------------|-------------------|--------------------------|------------| +| Length | The length of variable data in octets | primitiveType="uint8" or "uint16" May not hold null value. | 1 or 2 | +| data | Raw data | Array of octet of size specified in associated Length field. The data field itself should be specified as variable length. primitiveType="uint8" | variable | Optionally, implementations may support any other unsigned integer types for length. @@ -761,8 +763,9 @@ M S F T `04004d534654` -MonthYear encoding ---------------------------------------------------------------------------------------------------------------------------------------------------------------- +## MonthYear encoding + +### General MonthYear encoding contains four subfields representing respectively year, month, and optionally day or week. A field of this type is not @@ -776,10 +779,10 @@ special value indicating null if not present. If Year is set to the null value, then the entire field is considered null. | Subfield | Primitive type | Length (octets) | Null value | -|----------------------------------|----------------|----------------:|-----------:| +|----------------------------------|----------------|:---------------:|-----------:| | Year | uint16 | 2 | 65535 | | Month (1-12) | uint8 | 1 | — | -| Day of the month(1-31) optional | uint8 | 1 | 255 | +| Day of the month (1-31) optional | uint8 | 1 | 255 | | Week of the month (1-5) optional | uint8 | 1 | 255 | @@ -787,24 +790,21 @@ value, then the entire field is considered null. The four subfields of MonthYear are packed at an octet level by default. However, byte alignment may be controlled by specifying offset of the -elements within the composite encoding. See section 4.4.4.3 below. +elements within the composite encoding. See section [*Element offset within a composite type*](#element-offset-within-a-composite-type) for details. ### Encoding specifications for MonthYear -MonthYear data type is based on a composite encoding that carries its +MonthYear datatype is based on a composite encoding that carries its required and optional elements. The standard encoding specification for MonthYear ```xml - + - - + + ``` @@ -816,8 +816,9 @@ Wire format of MonthYear 2014 June week 3 as hexadecimal `de0706ff03` -Date and time encoding ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +## Date and time encoding + +### General Dates and times represent Coordinated Universal Time (UTC). This is the preferred date/time format, except where regulations require local time @@ -825,7 +826,7 @@ with time zone to be reported (see time zone encoding below). ### Epoch -Each time type has an epoch, or start of a time period to count values. +Each time type has an epoch or start of a time period to count values. For timestamp and date, the standard epoch is the UNIX epoch, midnight January 1, 1970 UTC. @@ -841,19 +842,19 @@ the other hand, if all timestamps have the same precision, then time unit may be set to a constant in the message schema. Then it need not be sent on the wire. -| FIX data type | Description | Backing primitives | Length (octets) | Schema attributes | -|---------------|--------------------------------------------------------------------------|--------------------|----------------:|------------------------| -| UTCTimestamp | UTC date/time Default: nanoseconds since Unix epoch Range Jan. 1, 1970 - July 21, 2554 | uint64 time | 8 | epoch=”unix” (default) | | | | -| | timeUnit = second or millisecond or microsecond or nanosecond May be constant | uint8 unit | 1 | | -| UTCTimeOnly | UTC time of day only Default: nanoseconds since midnight today | uint64 time | 8 | | -| | timeUnit = second or millisecond or microsecond or nanosecond May be constant | uint8 unit | 1 | | -| UTCDateOnly | UTC calendar date Default: days since Unix epoch. Range: Jan. 1, 1970 - June 7, 2149 | uint16 | 2 | epoch=”unix” (default) | +| FIX datatype | Description | Backing primitives | Length (octets) | Schema attributes | +|------------------|---------------------------------------|--------------------|:-----------:|---------------| +| UTCTimestamp | UTC date/time Default: nanoseconds since Unix epoch. Range January 1, 1970 - July 21, 2554 | uint64 time | 8 | epoch="unix" (default) | +| | timeUnit = second or millisecond or microsecond or nanosecond. May be constant | uint8 unit | 1 | | +| UTCTimeOnly | UTC time of day only Default: nanoseconds since midnight today | uint64 time | 8 | | +| | timeUnit = second or millisecond or microsecond or nanosecond. May be constant | uint8 unit | 1 | | +| UTCDateOnly | UTC calendar date Default: days since Unix epoch. Range: January 1, 1970 - June 7, 2149 | uint16 | 2 | epoch="unix" (default) | ### Encoding specifications for date and time -Time specifications use an enumeration of time units. See section 2.13 -below for a fuller explanation of enumerations. +Time specifications use an enumeration of time units. See section [*Enumeration encoding*](#enumeration-encoding) +for details. Enumeration of time units: @@ -916,15 +917,15 @@ schema attributes ```xml - - + + ``` Wire format of UTCTimestamp with constant time unit in little-Endian byte order -`4047baa145fb17` +`004047baa145fb17` **time** 10:24:39.123456000 (37,479 seconds and 123456000 nanoseconds since midnight UTC) with default schema attributes @@ -938,7 +939,7 @@ since midnight UTC) with default schema attributes Wire format of UTCTimeOnly -`10d74916220000` +`0010d74916220000` **date** Friday, October 4, 2024 (20,000 days since UNIX epoch) with default schema attributes @@ -951,15 +952,14 @@ Wire format of UTCDateOnly `204e` -Local date encoding ----------------------------------------------------------------------------------------------------------------------------------------------------------------- +## Local date encoding Local date is encoded the same as UTCDateOnly, but it represents local time at the market instead of UTC time. -| FIX data type | Description | Backing primitives | Length (octets) | Schema attributes | -|---------------|-------------------------------------------------------------------------------|--------------------|----------------:|------------------------------------| -| LocalMktDate | Local calendar date Default: days since Unix epoch. Range: Jan. 1, 1970 - June 7, 2149 local time | uint16 | 2 | epoch=”unix” (default) +| FIX datatype | Description | Backing primitives | Length (octets) | Schema attributes | +|------------------|-----------------------------|----------------|:----------:|------------------| +| LocalMktDate | Local calendar date Default: days since Unix epoch. Range: January 1, 1970 - June 7, 2149 local time | uint16 | 2 | epoch="unix" (default) | The standard encoding specification for LocalMktDate @@ -967,8 +967,9 @@ The standard encoding specification for LocalMktDate ``` -Local time encoding ------------------------------------------------------------------------------------------------------------------ +## Local time encoding + +### General Time with time zone encoding should only be used when required by market regulations. Otherwise, use UTC time encoding (see above). @@ -981,18 +982,18 @@ format ±hhmm. A binary UTCTimestamp followed by a number representing the time zone indicator as defined in ISO 8601:2004. -| FIX data type | Description | Backing primitives | Length (octets) | Schema attributes | -|---------------|--------------------------------------------------------------------------|--------------------|----------------:|------------------------------------| -| TZTimestamp | date/time with timezone Default: nanoseconds since Unix epoch Range Jan. 1, 1970 - July 21, 2554 | uint64 | 8 | epoch=”unix” (default) Represents Jan. 1, 1970 local time | -| | timeUnit = second or millisecond or microsecond or nanosecond May be constant | uint8 | 1 | | -| | Time zone hour offset | int8 | 1 | None | -| | Time zone minute offset | uint8 | 1 | None | +| FIX datatype | Description | Backing primitives | Length (octets) | Schema attributes | +|------------------|-----------------------------|----------------|:----------:|------------------| +| TZTimestamp | date/time with timezone Default: nanoseconds since Unix epoch. Range January 1, 1970 - July 21, 2554 | uint64 | 8 | epoch="unix" (default) Represents January 1, 1970 local time | +| | timeUnit = second or millisecond or microsecond or nanosecond. May be constant | uint8 | 1 | | +| | Time zone hour offset | int8 | 1 | None | +| | Time zone minute offset | uint8 | 1 | None | ### Composite encoding padding The subfields of TZTimestamp are packed at an octet level by default. However, byte alignment may be controlled by specifying offset of the -elements within the composite encoding. See section 4.4.4.3 below. +elements within the composite encoding. See section [*Element offset within a composite type*](#element-offset-within-a-composite-type) for details. Standard TZTimestamp encoding specification @@ -1007,9 +1008,9 @@ Standard TZTimestamp encoding specification ``` Wire format of TZTimestamp 8:30 17 September 2013 with Chicago time zone -offset (-6:00) +offset (-6:00) and nanosecond timeunit -`0050d489fea22413fa00` +`0050d489fea2241309fa00` ### TZTimeOnly encoding @@ -1020,10 +1021,10 @@ The time zone hour offset tells the number of hours different to UTC time. The time zone minute tells the number of minutes different to UTC. The sign telling ahead or behind UTC is on the hour subfield. -| FIX data type | Description | Backing primitives | Length (octets) | Schema attributes | -|---------------|------------------------------------------------------------|--------------------|----------------:|-------------------| +| FIX datatype | Description | Backing primitives | Length (octets) | Schema attributes | +|------------------|-----------------------------|----------------|:----------:|------------------| | TZTimeOnly | Time of day only with time zone Default: nanoseconds since midnight today, local time | uint64 | 8 | None | -| | timeUnit = second or millisecond or microsecond or nanosecond May be constant | uint8 | 1 | None | +| | timeUnit = second or millisecond or microsecond or nanosecond. May be constant | uint8 | 1 | None | | | Time zone hour offset | int8 | 1 | None | | | Time zone minute offset | uint8 | 1 | None | @@ -1031,7 +1032,7 @@ The sign telling ahead or behind UTC is on the hour subfield. The subfields of TZTimeOnly are packed at an octet level by default. However, byte alignment may be controlled by specifying offset of the -elements within the composite encoding. See section 4.4.4.3 below. +elements within the composite encoding. See section [*Element offset within a composite type*](#element-offset-within-a-composite-type) for details. Standard TZTimeOnly encoding specification @@ -1040,10 +1041,8 @@ Standard TZTimeOnly encoding specification - - + + ``` @@ -1051,11 +1050,11 @@ Wire format of TZTimeOnly 8:30 with Chicago time zone offset (-6:00) `006c5ebe76000000fa00` -Enumeration encoding ------------------------------------------------------------------------------------------------------------------------------------------------------------------ +## Enumeration encoding -An enumeration conveys a single choice of mutually exclusive valid -values. +### General + +An enumeration conveys a single choice of mutually exclusive valid values. ### Primitive type encodings @@ -1065,21 +1064,21 @@ types. They may additionally support other unsigned integer types to allow more choices. | Primitive type | Description | Length (octets) | Maximum number of choices | -|----------------|------------------------|----------------:|--------------------------:| -| char | character | 1 | 95 | -| uint8 | 8-bit unsigned integer | 1 | 255 | +|----------------|------------------------|:-----------:|:-------------:| +| char | character | 1 | 95 | +| uint8 | 8-bit unsigned integer | 1 | 255 | ### Value encoding -If a field is of FIX data type char, then its valid values are -restricted to US-ASCII printable characters. See section 2.7.1 above. +If a field is of FIX datatype char, then its valid values are +restricted to US-ASCII printable characters. See section [*Character*](#character) for details. -If the field is of FIX data type int, then a primitive integer data type +If the field is of FIX datatype int, then a primitive integer datatype should be selected that can contain the number of choices. For most -cases, an 8 bit integer will be sufficient, allowing 255 possible +cases, an 8-bit integer will be sufficient, allowing 255 possible values. -Enumerations of other data types, such as String valid values specified +Enumerations of other datatypes, such as String valid values specified in FIX, should be mapped to an integer wire format in SBE. ### Encoding specification of enumeration @@ -1088,13 +1087,13 @@ In a message schema, the choices are specified a `` members of an ``. An `` specification must contain at least one ``. -The name and value of a validValue element must be unique within an +The name and value of a `` element must be unique within an enumeration. An `` element must have an encodingType attribute to specify the type of its values. Two formats of encodingType are acceptable: -- In-line style: the value of encodingType is its primitive data type. +- In-line style: the value of encodingType is its primitive datatype. - Reference style: the value of encodingType is the name of a `` element that specifies the wire format. @@ -1153,9 +1152,7 @@ Example of a char field using a constant enum value D - + ``` ### Boolean encoding @@ -1199,8 +1196,9 @@ Wire format of null Boolean (or N/A) value as hexadecimal `ff` -Multi-value choice encoding --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +## Multi-value choice encoding + +### General A multi-value field conveys a choice of zero or more non-exclusive valid values. @@ -1212,17 +1210,14 @@ choices. The encoding is backed by an unsigned integer. The smallest unsigned primitive type should be selected that can contain the number of valid choices. -| Primitive type | Description | Length (octets) | Maximum number of choices | -|----------------|-------------------------|----------------:|--------------------------:| -| uint8 | 8-bit unsigned integer | 1 | 8 | -| uint16 | 16-bit unsigned integer | 2 | 16 | -| uint32 | 32-bit unsigned integer | 4 | 32 | -| uint64 | 64-bit unsigned integer | 8 | 64 | +| Primitive type | Description | Length (octets) | Maximum number of choices | +|----------------|-------------------------|:---------:|:---------------:| +| uint8 | 8-bit unsigned integer | 1 | 8 | +| uint16 | 16-bit unsigned integer | 2 | 16 | +| uint32 | 32-bit unsigned integer | 4 | 32 | +| uint64 | 64-bit unsigned integer | 8 | 64 | -Like other integer-backed encodings, multi-value encodings follow the -byte order specified by message schema when serializing to the wire. See -section 4.3.1 for specification of message schema attributes, including -byteOrder. +Like other integer-backed encodings, multi-value encodings follow the byte order specified by message schema when serializing to the wire. See section [*Message schema attributes*](#messageschema-attributes) for the specification, including byteOrder. ### Value encoding @@ -1239,21 +1234,21 @@ than to set all bits off when no choices are selected. ### Encoding specification of multi-value choice In a message schema, the choices are specified as `` members of -an `` element. Choices are assigned values as an ordinal of bits in +a `` element. Choices are assigned values as an ordinal of bits in the bit set. The first Choice "0" is assigned the least significant bit; choice "1" is the second bit, and so forth. The name and value (bit position) must be unique for element of a set. A `` element must have an encodingType attribute to specify the -wire format of its values. Two formats of encodingType are recognized : +wire format of its values. Two formats of encodingType are recognized: -- In-line style: the value of encodingType is its primitive data type. +- In-line style: the value of encodingType is its primitive datatype. - Reference style: the value of encodingType is the name of a `` element that specifies the wire format. -The length of a `` associated to an bitset must be 1. That is, +The length of a `` associated to a bitset must be 1. That is, bitsets should not be specified as arrays. ### Multi-value example @@ -1282,8 +1277,7 @@ Reference to type. This is equivalent to the example above. A field using the multi-choice encoding ```xml - + ``` Wire format of choices "Bankrupt" + "Pending delisting" (first and @@ -1291,8 +1285,7 @@ second bits set) `03` -Field value validation --------------------------------------------------------------------------------------------------------------------- +## Field value validation These validations apply to message field values. @@ -1300,13 +1293,13 @@ If a value violation is detected on a received message, the message should be rejected back to the counterparty in a way appropriate to the session protocol. -| Error condition | Error description | -|-------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------| -| Field value less than minValue | The encoded value falls below the specified valid range. | -| Field value greater than maxValue | The encoded value exceeds the specified valid range. | -| Null value set for required field | The null value of a data type is invalid for a required field. | +| Error condition | Error description | +|----------------------|-----------------------------------------------| +| Field value less than minValue | The encoded value falls below the specified valid range. | +| Field value greater than maxValue | The encoded value exceeds the specified valid range. | +| Null value set for required field | The null value of a datatype is invalid for a required field. | | String contains invalid characters | A String contains non-US-ASCII printable characters or other invalid sequence if a different characterEncoding is specified. | -| Required subfields not populated in MonthYear | Year and month must be populated with non-null values, and the month must be in the range 1-12. | -| UTCTimeOnly exceeds day range | The value must not exceed the number of time units in a day, e.g. greater than 86400 seconds. | +| Required subfields not populated in MonthYear | Year and month must be populated with non-null values, and the month must be in the range 1-12. | +| UTCTimeOnly exceeds day range | The value must not exceed the number of time units in a day, e.g. greater than 86400 seconds. | | TZTimestamp and TZTimeOnly has missing or invalid time zone | The time zone hour and minute offset subfields must correspond to an actual time zone recognized by international standards. | -| Value must match valid value of an enumeration field | A value is invalid if it does not match one of the explicitly listed valid values. | +| Value must match valid value of an enumeration field | A value is invalid if it does not match one of the explicitly listed valid values. | diff --git a/v1-0-STANDARD/doc/03MessageStructure.md b/v1-0-STANDARD/doc/03MessageStructure.md index 25cce12..36d1930 100644 --- a/v1-0-STANDARD/doc/03MessageStructure.md +++ b/v1-0-STANDARD/doc/03MessageStructure.md @@ -1,11 +1,11 @@ -Message Structure -=============================================================================================================== +# Message Structure -Message Framing ------------------------------------------------------------------------------------------------------------------------------------------------------------- +## Message Framing -SBE messages have no defined message delimiter. Version 2.0 of SBE makes it possible to walk the elements of a message to determine its limit, even when the message has been extended. Nevertheless, since internal framing depends on a correct starting point and not encountering malformed messages, it may be desirable to use an external framing protocol when used with transports that do not preserve message boundaries, such as when they are transmitted on a streaming -session protocol or when persisting messages in storage. +### General + +SBE messages have no defined message delimiter. SBE makes it possible to walk the elements of a message to determine its limit, even when the message has been extended. Nevertheless, since internal framing depends on a correct starting point and not encountering malformed messages, it may be desirable to use an external framing protocol when used with transports that do not preserve message boundaries, such as when they are transmitted on a streaming +session protocol or when persisting messages in storage. ### Simple Open Framing Header @@ -31,7 +31,7 @@ be encoded in big-endian byte order, also known as network byte order. Simple Open Framing Header as an SBE composite encoding (big-endian) ```xml - + @@ -48,14 +48,14 @@ defined as: The Simple Open Framing Header specification also lists values for other wire formats. -SBE Message Encoding Header ---------------------------- +## SBE Message Encoding Header + +### General The purpose of the message encoding header is to tell which message template was used to encode the message and to give information about the size of the message body to aid in decoding, even when a message -template has been extended in a later version. See section 5 below for -an explanation of the schema extension mechanism. +template has been extended in a later version. See section [*Schema Extension Mechanism*](#schema-extension-mechanism) for details. The fields of the SBE message header are: @@ -78,7 +78,7 @@ The fields of the SBE message header are: Block length is specified in a message schema, but it is also serialized on the wire. By default, block length is set to the sum of the sizes of body fields in the message. However, it may be increased to force -padding at the end of block. See section 3.3.3.3 below. +padding at the end of block. See section [*Padding at end of a message or group*](#padding-at-end-of-a-message-or-group) for details. ### Message header schema @@ -87,7 +87,7 @@ position as shown below. Each of these fields must be encoded as an unsigned integer type. The encoding must carry the name "messageHeader". The message header is encoded in the same byte order as the message -body, as specified in a message schema. See section 4.3.1. +body, as specified in a message schema. See section [*Message schema attributes*](#messageschema-attributes) for the specification. Recommended message header encoding @@ -97,7 +97,7 @@ Recommended message header encoding - + ``` @@ -105,12 +105,12 @@ Recommended message header encoding The recommended header encoding is 12 octets. | Element | Description | Primitive type | Length (octets) | Offset | -|-------------|-------------------|----------------|----------------:|-------:| +|------------------|-------------------|----------------|:---------------:|:------:| | blockLength | Root block length | uint16 | 2 | 0 | | templateId | Template ID | uint16 | 2 | 2 | | schemaId | Schema ID | uint16 | 2 | 4 | | version | Schema Version | uint16 | 2 | 6 | -| numGroups |Number of repeating groups | uint16 | 2 | 8 | +| numGroups | Number of repeating groups | uint16 | 2 | 8 | | numVarDataFields | Number of variable-length fields | uint16 | 2 | 10 | Optionally, implementations may support any other unsigned integer types @@ -120,9 +120,9 @@ for blockLength. The total space reserved for the root level of the message not counting any repeating groups or variable-length fields. (Repeating groups have -their own block length; see section 3.4 below. Length of a +their own block length; see section [*Repeating groups*](#repeating-groups) for details. Length of a variable-length Data field is given by its corresponding Length field; -see section 2.7.3 above.) Block length only represents message body +see section [*Variable-length string encoding*](#variable-length-string-encoding) for details.) Block length only represents message body fields; it does not include the length of the message header itself, which is a fixed size. @@ -130,22 +130,20 @@ The block size must be at least the sum of lengths of all fields at the root level of the message, and that is its default value. However, it may be set larger to reserve more space to effect alignment of blocks. This is specified by setting the blockLength attribute in a message -schema. +schema. ### Template ID -The identifier of a message type in a message schema. See section 4.5.2 -below for schema attributes of a message. +The identifier of a message type in a message schema. See section [*Message schema attributes*](#messageschema-attributes) for the specification. ### Schema ID -The identifier of a message schema. See section 4.3.1 below for schema -attributes. +The identifier of a message schema. See section [*Message schema attributes*](#messageschema-attributes) for the specification. ### Schema version The version number of the message schema that was used to encode a -message. See section 4.3.1 below for schema attributes. +message. See section [*Message schema attributes*](#messageschema-attributes) for the specification. ### Number of repeating groups @@ -156,8 +154,9 @@ A count of repeating groups at the root level of the message. The count does not A count of the variable-length fields at the root level of the message. The count does not include variable-length fields within repeating groups. -Message Body ----------------------------------------------------------------------------------------------------------- +## Message Body + +### General The message body conveys the business information of the message. @@ -197,16 +196,14 @@ sum of the sizes of prior fields, as they are defined by the message schema. ```xml - + - + ``` | Field | Size | Offset | -|----------|-----:|-------:| +|----------|:----:|:------:| | ClOrdID | 14 | 0 | | Side | 1 | 14 | | OrderQty | 4 | 15 | @@ -230,18 +227,14 @@ business data. They should be filled with binary zeros. Example of fields with specified offsets ```xml - - - - + + + + ``` | Field | Size | Padding preceding field | Offset | -|----------|------|------------------------:|-------:| +|----------|:----:|:-----------------------:|:------:| | ClOrdID | 14 | 0 | 0 | | Side | 1 | 0 | 14 | | OrderQty | 4 | 1 | 16 | @@ -265,11 +258,12 @@ Extra octets specified for padding should be filled with binary zeros. Example of blockLength specification for 24 octets ```xml - + ``` -Repeating Groups ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +## Repeating Groups + +### General A repeating group is a message structure that contains a variable number of entries. Each entry contains fields specified by a message schema. @@ -279,7 +273,7 @@ group. That is, the entries are homogeneous. Position of a given field within any entry is fixed, with the exception of variable-length fields. -A message may have no groups or an unlimited number of repeating groups +A message may have no groups, or an unlimited number of repeating groups specified in its schema. ### Schema specification of a group @@ -292,17 +286,15 @@ Example repeating group encoding specification ```xml - - + + ``` ### Group block length -The blockLength part of a group dimension represents total space reserved +The blockLength part of a group dimension represents total space reserved for each group entry, not counting any nested repeating groups or variable-length fields. (Length of a variable-length Data field is given by its corresponding Length field.) Block length only represents message body fields; it does not @@ -324,12 +316,11 @@ value does not include the group dimensions itself. Note that padding will only result in deterministic alignment if the repeating group contains no variable-length fields. -### Entry counter +### Entry counter Each group is associated with a required counter field of semantic data type NumInGroup to tell how many entries are contained by a message. The -value of the counter is a non-negative integer. See "Encoding of repeating group dimensions" section below -for encoding of that counter. +value of the counter is a non-negative integer. See section [*Encoding of repeating group dimensions*](#encoding-of-repeating-group-dimensions) for details. ### Empty group @@ -402,6 +393,8 @@ that case, no NumInGroup is encoded on the wire for the child groups. ### Group dimension encoding +#### General + Every repeating group must be immediately preceded on the wire by its dimensions. The two dimensions are the count of entries in a repeating group and the space reserved for each entry of the group. @@ -415,11 +408,11 @@ unsigned integer types. By default, the minimum number of entries is zero, and the maximum number is the largest value of the primitiveType of the counter. | Primitive type | Description | Length (octets) | Maximum number of entries | -|----------------|-------------------------|----------------:|--------------------------:| -| uint8 | 8-bit unsigned integer | 1 | 255 | -| uint16 | 16-bit unsigned integer | 2 | 65535 | +|----------------|-------------------------|:---------------:|:--------------------:| +| uint8 | 8-bit unsigned integer | 1 | 255 | +| uint16 | 16-bit unsigned integer | 2 | 65535 | -The number of entries may be restricted to a specific range; see "Restricting repeating group entries" below. +The number of entries may be restricted to a specific range; see section [*Restricting repeating group entries*](#restricting-repeating-group-entries) for details. #### Encoding of repeating group dimensions @@ -440,7 +433,7 @@ Recommended encoding of repeating group dimensions - + ``` @@ -454,9 +447,9 @@ any repeating groups or variable-length fields. The number of entries in this repeating group, called NumInGroup in FIX. -##### Number of repeating groups +#### Number of repeating groups -A count nested repeating groups in this repeating group. +A count of the nested repeating groups in this repeating group. #### Number of variable-length fields @@ -476,8 +469,7 @@ Example of a restricted group encoding ``` -Sequence of message body elements ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +## Sequence of message body elements ### Root level elements @@ -486,12 +478,10 @@ specified with this sequence of message body elements: 1. Fixed-length fields that reside at the root level of the message (that is, not members of repeating groups), including any of the - following, in the order specified by the message schema:: + following, in the order specified by the message schema: a. Fixed-length scalar fields, such as integers - b. Fixed-length character arrays - c. Fixed-length composite types, such as MonthYear 2. Repeating groups, if any. @@ -504,10 +494,9 @@ Repeating group entries are recursively organized in the same fashion as the root level: fixed-length fields, then nested repeating groups, and finally, variable-length data fields. -Message structure validation --------------------------------------------------------------------------------------------------------------------------- +## Message structure validation -Aside from message schema validations (see section 4.8 below), these +Aside from message schema validations (see section [*Schema validation*](#schema-validation)), these validations apply to message structure. If a message structure violation is detected on a received message, the diff --git a/v1-0-STANDARD/doc/04MessageSchema.md b/v1-0-STANDARD/doc/04MessageSchema.md index 45d2947..0ccfcc2 100644 --- a/v1-0-STANDARD/doc/04MessageSchema.md +++ b/v1-0-STANDARD/doc/04MessageSchema.md @@ -1,18 +1,17 @@ - Message Schema -========================================================================================================================================================================================================== +# Message Schema -XML schema for SBE message schemas ---------- -See [sbe.xsd](../resources/sbe.xsd) for the normative XML Schema Definition (XSD) for SBE. +## XML schema for SBE message schemas +See [sbe.xsd](https://github.com/FIXTradingCommunity/fix-simple-binary-encoding/blob/master/v1-0-STANDARD/resources/sbe.xsd) for the normative XML Schema Definition (XSD) for SBE. -XML namespace ------------------------------------------------------------------------------------------------------------ +**TODO: XSD file should be added as appendix into the specification for ISO submission.** -The Simple Binary Encoding XML schema is identified by this URL [*tentative*]: +## XML namespace + +The Simple Binary Encoding XML schema is identified by this URL: ```xml -xmlns:sbe=http://fixprotocol.io/2017/sbe +xmlns:sbe=http://fixprotocol.io/2016/sbe ``` Conventionally, the URI of the XML schema is aliased by the prefix @@ -21,16 +20,17 @@ Conventionally, the URI of the XML schema is aliased by the prefix *Caution:* Users should treat the SBE XML namespace as a URI (unique identifier), not as a URL (physical resource locator). Firms should not depend on access to the FIX Trading Community web site to validate XML schemas at -run-time +run-time. + +## Naming convention -Name convention -------------------------------------------------------------------------------------------------------------- +### General All symbolic names in a message schema are restricted to alphanumeric characters plus underscore without spaces. This is the same restriction applied to all names in FIX specifications. -### Capitalization +### Capitalization The value of a field's `semanticType` attribute is a FIX data type. In this document, FIX types are capitalized exactly as in the FIX @@ -39,8 +39,9 @@ derived. Since the capitalization is somewhat inconsistent, however, it is recommended that matching of type names should be case insensitive in schema parsers. -Root element ------------- +## Root element + +### General The root element of the XML document is ``. @@ -48,19 +49,19 @@ The root element of the XML document is ``. The root element provides basic identification of a schema. -The `byteOrder` attribute controls the byte order of integer encodings +The `byteOrder` attribute controls the byte order of integer and float encodings within the schema. It is a global setting for all specified messages and their encodings. -| Schema attribute | Description | XML type | Usage | Valid values | -|------------------|--------------------------------------------------------------------------------------------------|--------------------|------------------------|------------------------------------------------------------------------------| -| package | Name or category of a schema | string | optional | Should be unique between counterparties but no naming convention is imposed. | -| id | Unique identifier of a schema | unsignedInt | | Should be unique between counterparties | -| version | Version of this schema | nonnegativeInteger | | Initial version is zero and is incremented for each version | -| semanticVersion | Version of FIX semantics | string | optional | FIX versions, such as “FIX.5.0\_SP2” | -| byteOrder | Byte order of encoding | token | default = littleEndian | littleEndian bigEndian | -| description | Documentation of the schema | string | optional | | -| headerType | Name of the encoding type of the message header, which is the same for all messages in a schema. | string | default= messageHeader | An encoding with this name must be contained by '`. | +| Schema attribute | Description | XML type | Usage | Valid values | +|------------------|---------------------------------|--------------|--------------|--------------------------| +| package | Name or category of a schema | string | optional | Should be unique between counterparties but no naming convention is imposed. | +| id | Unique identifier of a schema | unsignedInt | | Should be unique between counterparties | +| version | Version of this schema | nonnegativeInteger | | Initial version is zero and is incremented for each version | +| semanticVersion | Version of FIX semantics | string | optional | FIX versions, such as “FIX.5.0\_SP2”| +| byteOrder | Byte order of encoding | token | default = littleEndian | littleEndian bigEndian | +| description | Documentation of the schema | string | optional | | +| headerType | Name of the encoding type of the message header, which is the same for all messages in a schema. | string | default= messageHeader | An encoding with this name must be contained by ``. | ### Schema versioning @@ -75,10 +76,9 @@ the version number. The `package` attribute should remain constant between versions, if it is supplied. -Data encodings ------------------------------------------------------------------------------------------------------------- +## Data encodings -### Encoding sets +### Encoding sets The `` element contains one or more sets of data encodings used for messages within the schema. @@ -96,6 +96,8 @@ sequence: ### Encoding name +#### General + The namespace for encoding names is global across all encodings included in a schema, including simple, composite and enumeration types. That is, the name must be unique among all encoding instances. @@ -118,6 +120,8 @@ Example of XML include usage to import common encoding types ### Simple encodings +### General + A simple encoding is backed by either a scalar type or an array of scalars, such as a character array. One or more simple encodings may be defined, each specified by a `` element. @@ -127,7 +131,7 @@ defined, each specified by a `` element. If the element has a value, it is used to indicate a special value of the encoding. -##### Constant value +#### Constant value The element value represents a constant if attribute `presence="constant"`. In this case, the value is conditionally required. @@ -135,20 +139,20 @@ The element value represents a constant if attribute #### `` attributes -| `` attribute | Description | XML type | Usage | Valid values | -|--------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------|-----------------------------------|----------------------------------------------------------------------------------------| -| name | Name of encoding | symbolicName\_t | required | Must be unique among all encoding types in a schema. | -| description | Documentation of the type | string | optional | | -| presence | Presence of any field encoded with this type | token | | required optional constant | -| nullValue | Override of special value used to indicate null for an optional field | string | Only valid if presence = optional | The XML string must be convertible to the scalar data type specified by primitiveType. | -| minValue | Lowest acceptable value | string | | | -| maxValue | Highest acceptable value | string | | | -| length | Number of elements of the primitive data type | nonnegativeInteger | default = 1 | Value “0” represents variable length. | -| offset | If a member of a composite type, tells the offset from the beginning of the composite. By default, the offset is the sum of preceding element sizes, but it may be increased to effect byte alignment. | unsignedInt | optional | See section 4.4.4.3 below | -| primitiveType | The primitive data type that backs the encoding | token | required | char int8 int16 int32 int64 uint8 uint16 uint32 uint64 float double | -| semanticType | Represents a FIX data type | token | optional | Same as field semanticType – see below. | -| sinceVersion | Documents the version of a schema in which a type was added | nonnegativeInteger | default = 0 | Must be less than or equal to the version of the message schema. | -| deprecated | Documents the version of a schema in which a type was deprecated. It should no longer be used in new messages. | nonnegativeInteger | optional | Must be less than or equal to the version of the message schema. | +| `` attribute | Description | XML type | Usage | Valid values | +|----------------------|-----------------------------------------------|-------------------|-----------------|---------------------------| +| name | Name of encoding | symbolicName\_t | required | Must be unique among all encoding types in a schema. | +| description | Documentation of the type | string | optional | | +| presence | Presence of any field encoded with this type | token | | required optional constant | +| nullValue | Override of special value used to indicate null for an optional field | string | Only valid if presence = optional | The XML string must be convertible to the scalar data type specified by primitiveType. | +| minValue | Lowest acceptable value | string | | | +| maxValue | Highest acceptable value | string | | | +| length | Number of elements of the primitive data type | nonnegativeInteger | default = 1 | Value “0” represents variable length. | +| offset | If a member of a composite type, tells the offset from the beginning of the composite. By default, the offset is the sum of preceding element sizes, but it may be increased to effect byte alignment. | unsignedInt | optional | See section [*Element offset within a composite type*](#element-offset-within-a-composite-type) | +| primitiveType | The primitive data type that backs the encoding | token | required | char int8 int16 int32 int64 uint8 uint16 uint32 uint64 float double | +| semanticType | Represents a FIX data type | token | optional | Same as field semanticType – see below. | +| sinceVersion | Documents the version of a schema in which a type was added | nonnegativeInteger | default = 0 | Must be less than or equal to the version of the message schema. | +| deprecated | Documents the version of a schema in which a type was deprecated. It should no longer be used in new messages. | nonnegativeInteger | optional | Must be less than or equal to the version of the message schema. | #### FIX data type specification @@ -159,28 +163,26 @@ but if it is, the two values must match. Simple type examples ```xml - - -C + + +C ``` ### Composite encodings +#### General + Composite encoding types are composed of two or more simple types. #### `` attributes -| `` attribute | Description | XML type | Usage | Valid values | -|--------------------|----------------------------------------------------------------------------------------------------------------|--------------------|-------------|------------------------------------------------------------------| -| name | Name of encoding | symbolicName\_t | required | Must be unique among all encoding types. | -| offset | The offset from the beginning of the composite. By default, the offset is the sum of preceding element sizes, but it may be increased to effect byte alignment. | unsignedInt | optional | | -| description | Documentation of the type | string | optional | | -| semanticType | Represents a FIX data type | token | optional | Same as field semanticType – see below. | -| sinceVersion | Documents the version of a schema in which a type was added | nonnegativeInteger | default = 0 | Must be less than or equal to the version of the message schema. | +| `` attribute | Description | XML type | Usage | Valid values | +|----------------------|-----------------------------------------------|-------------------|-----------------|---------------------------| +| name | Name of encoding | symbolicName\_t | required | Must be unique among all encoding types. | +| offset | The offset from the beginning of the composite. By default, the offset is the sum of preceding element sizes, but it may be increased to effect byte alignment. | unsignedInt | optional | | +| description | Documentation of the type | string | optional | | +| semanticType | Represents a FIX data type | token | optional | Same as field semanticType – see below. | +| sinceVersion | Documents the version of a schema in which a type was added | nonnegativeInteger | default = 0 | Must be less than or equal to the version of the message schema. | | deprecated | Documents the version of a schema in which a type was deprecated. It should no longer be used in new messages. | nonnegativeInteger | optional | Must be less than or equal to the version of the message schema. | #### Composite type elements @@ -193,14 +195,13 @@ stand-alone types. Composite type example -In this example, a Price is encoded as 32 bit integer mantissa and a +In this example, a Price is encoded as 32-bit integer mantissa and a constant exponent, which is not sent on the wire. ```xml - -4 + -4 ``` @@ -223,23 +224,25 @@ mantissa element indicates that the price is null. ### Reference to reusable types +#### General + A composite type often has its elements defined in-line within the `` XML element as shown in the example above. Alternatively, a common type may be defined once on its own, and then referred to by name with the composite type using a `` element. #### `` attributes -| `` attribute | Description | XML type | Usage | Valid values | -|--------------------|----------------------------------------------------------------------------------------------------------------|--------------------|-------------|------------------------------------------------------------------| -| name | Usage of the type in this composite | symbolicName\_t | required | | -| type | Name of referenced encoding | symbolicName\_t | required | Must match a defined type, enum or set or composite name attribute. | -| offset | The offset from the beginning of the composite. By default, the offset is the sum of preceding element sizes, but it may be increased to effect byte alignment. | unsignedInt | optional | | -| sinceVersion | Documents the version of a schema in which a type was added | nonnegativeInteger | default = 0 | Must be less than or equal to the version of the message schema. | -| deprecated | Documents the version of a schema in which a type was deprecated. It should no longer be used in new messages. | nonnegativeInteger | optional | Must be less than or equal to the version of the message schema. | +| `` attribute | Description | XML type | Usage | Valid values | +|----------------------|-----------------------------------------------|-------------------|-----------------|---------------------------| +| name | Usage of the type in this composite | symbolicName\_t | required | | +| type | Name of referenced encoding | symbolicName\_t | required | Must match a defined type, enum or set or composite name attribute. | +| offset | The offset from the beginning of the composite. By default, the offset is the sum of preceding element sizes, but it may be increased to effect byte alignment. | unsignedInt | optional | | +| sinceVersion | Documents the version of a schema in which a type was added | nonnegativeInteger | default = 0 | Must be less than or equal to the version of the message schema. | +| deprecated | Documents the version of a schema in which a type was deprecated. It should no longer be used in new messages. | nonnegativeInteger | optional | Must be less than or equal to the version of the message schema. | #### Type reference examples **Reference to an enum** -In this example, a futuresPrice is encoded as 64 bit integer mantissa, 8 bit exponent, and a reused enum type. +In this example, a futuresPrice is encoded as 64-bit integer mantissa, 8-bit exponent, and a reused enum type. ```xml @@ -251,27 +254,29 @@ In this example, a futuresPrice is encoded as 64 bit integer mantissa, 8 bit ex - + ``` **Reference to a composite type** -In this example, a nested composite is formed by using a reference to another composite type. It supports the expresson of a monetary amount with its currency, such as USD150.45. Note that a reference may carry an offset within the composite encoding that contains it. +In this example, a nested composite is formed by using a reference to another composite type. It supports the expression of a monetary amount with its currency, such as USD 150.45. Note that a reference may carry an offset within the composite encoding that contains it. ```xml - + - + ``` ### Enumeration encodings +#### General + An enumeration explicitly lists the valid values of a data domain. Any number of fields may share the same enumeration. @@ -283,25 +288,25 @@ number of `` elements. The `encodingType` attribute refers to a simple encoding of scalar type. The encoding of an enumeration may be char or any unsigned integer type. -| `` attribute | Description | XML type | Usage | Valid values | -|--------------------|----------------------------------------------------------------------------------------------------------------|--------------------|-------------|-----------------------------------------------------------------------------------| -| name | Name of encoding | symbolicName\_t | required | Must be unique among all encoding types. | -| description | Documentation of the type | string | optional | | -| encodingType | Name of a simple encoding type | symbolicName\_t | required | Must match the name attribute of a scalar `` element *or* a primitive type: char uint8 uint16 uint32 uint64 | -| sinceVersion | Documents the version of a schema in which a type was added | nonnegativeInteger | default = 0 | Must be less than or equal to the version of the message schema. | -| deprecated | Documents the version of a schema in which a type was deprecated. It should no longer be used in new messages. | nonnegativeInteger | optional | Must be less than or equal to the version of the message schema. | -| offset | If a member of a composite type, tells the offset from the beginning of the composite. By default, the offset is the sum of preceding element sizes, but it may be increased to effect byte alignment. | unsignedInt | optional | +| `` attribute | Description | XML type | Usage | Valid values | +|----------------------|-----------------------------------------------|-------------------|-----------------|---------------------------| +| name | Name of encoding | symbolicName\_t | required | Must be unique among all encoding types. | +| description | Documentation of the type | string | optional | | +| encodingType | Name of a simple encoding type | symbolicName\_t | required | Must match the name attribute of a scalar `` element *or* a primitive type: char uint8 uint16 uint32 uint64 | +| sinceVersion | Documents the version of a schema in which a type was added | nonnegativeInteger | default = 0 | Must be less than or equal to the version of the message schema. | +| deprecated | Documents the version of a schema in which a type was deprecated. It should no longer be used in new messages. | nonnegativeInteger | optional | Must be less than or equal to the version of the message schema. | +| offset | If a member of a composite type, tells the offset from the beginning of the composite. By default, the offset is the sum of preceding element sizes, but it may be increased to effect byte alignment. | unsignedInt | optional | #### `` element attributes The name attribute of the `` uniquely identifies it. -| `` attribute | Description | XML type | Usage | Valid values | -|--------------------|-----------------------------------------------------------------------------------------------------------------|--------------------|-------------|------------------------------------------------------------------| -| name | Symbolic name of value | symbolicName\_t | required | Must be unique among valid values in the enumeration. | -| description | Documentation of the value | string | optional | | -| sinceVersion | Documents the version of a schema in which a value was added | nonNegativeInteger | default = 0 | | -| deprecated | Documents the version of a schema in which a value was deprecated. It should no longer be used in new messages. | nonnegativeInteger | optional | Must be less than or equal to the version of the message schema. | +| `` attribute | Description | XML type | Usage | Valid values | +|------------------------|-----------------------------------------------|-------------------|-----------------|---------------------------| +| name | Symbolic name of value | symbolicName\_t | required | Must be unique among valid values in the enumeration. | +| description | Documentation of the value | string | optional | | +| sinceVersion | Documents the version of a schema in which a value was added | nonNegativeInteger | default = 0 | | +| deprecated | Documents the version of a schema in which a value was deprecated. It should no longer be used in new messages. | nonnegativeInteger | optional | Must be less than or equal to the version of the message schema. | #### `` element content @@ -313,7 +318,7 @@ the encoding, such as an integer. Enumeration example (not all valid values listed) -This enumeration is encoded as an 8 bit unsigned integer value. Others +This enumeration is encoded as an 8-bit unsigned integer value. Others are encoded as char codes. ```xml @@ -329,6 +334,8 @@ are encoded as char codes. ### Multi-value choice encodings (bitset) +#### General + An enumeration explicitly lists the valid values of a data domain. Any number of fields may share the same set of choices. @@ -342,27 +349,27 @@ uint64 encoding. The `encodingType` attribute refers to a simple encoding of scalar type. The encoding of a bitset should be an unsigned integer type. -| `` attribute | Description | XML type | Usage | Valid values | -|-------------------|----------------------------------------------------------------------------------------------------------------|--------------------|-------------|-----------------------------------------------------------------------------------| -| name | Name of encoding | symbolicName\_t | required | Must be unique among all encoding types. | -| description | Documentation of the type | string | optional | | -| encodingType | Name of a simple encoding type | string | required | Must match the name attribute of a scalar `` element *or* a primitive type: uint8 uint16 uint32 uint64 | -| sinceVersion | Documents the version of a schema in which a type was added | nonnegativeInteger | default = 0 | Must be less than or equal to the version of the message schema. | -| deprecated | Documents the version of a schema in which a type was deprecated. It should no longer be used in new messages. | nonnegativeInteger | optional | Must be less than or equal to the version of the message schema. -| offset | If a member of a composite type, tells the offset from the beginning of the composite. By default, the offset is the sum of preceding element sizes, but it may be increased to effect byte alignment. | unsignedInt | optional | +| `` attribute | Description | XML type | Usage | Valid values | +|----------------------|-----------------------------------------------|-------------------|-----------------|---------------------------| +| name | Name of encoding | symbolicName\_t | required | Must be unique among all encoding types. | +| description | Documentation of the type | string | optional | | +| encodingType | Name of a simple encoding type | string | required | Must match the name attribute of a scalar `` element *or* a primitive type: uint8 uint16 uint32 uint64 | +| sinceVersion | Documents the version of a schema in which a type was added | nonnegativeInteger | default = 0 | Must be less than or equal to the version of the message schema. | +| deprecated | Documents the version of a schema in which a type was deprecated. It should no longer be used in new messages. | nonnegativeInteger | optional | Must be less than or equal to the version of the message schema. | +| offset | If a member of a composite type, tells the offset from the beginning of the composite. By default, the offset is the sum of preceding element sizes, but it may be increased to effect byte alignment. | unsignedInt | optional | #### `` element attributes The `name` attribute of the `` uniquely identifies it. -| `` attribute | Description | XML type | Usage | Valid values | -|----------------------|------------------------------------------------------------------------------------------------------------------|--------------------|-------------|------------------------------------------------------------------| -| name | Symbolic name of value | symbolicName\_t | required | Must be unique among choices in the set. | -| description | Documentation of the value | string | optional | | -| sinceVersion | Documents the version of a schema in which a choice was added | nonNegativeInteger | default = 0 | | -| deprecated | Documents the version of a schema in which a choice was deprecated. It should no longer be used in new messages. | nonnegativeInteger | optional | Must be less than or equal to the version of the message schema. | +| `` attribute | Description | XML type | Usage | Valid values | +|----------------------|-----------------------------------------------|-------------------|-----------------|---------------------------| +| name | Symbolic name of value | symbolicName\_t | required | Must be unique among choices in the set. | +| description | Documentation of the value | string | optional | | +| sinceVersion | Documents the version of a schema in which a choice was added | nonNegativeInteger | default = 0 | | +| deprecated | Documents the version of a schema in which a choice was deprecated. It should no longer be used in new messages. | nonnegativeInteger | optional | Must be less than or equal to the version of the message schema. | -#### `< choice >` element content +#### `` element content The element is required to carry a value, which is an unsigned integer representing a zero-based index to a bit within a bitset. Zero is the @@ -370,7 +377,7 @@ least significant bit. `` and `` XML elements -Multi-value choice example, The choice is encoded as a bitset. +Multi-value choice example, the choice is encoded as a bitset. ```xml @@ -382,8 +389,9 @@ Multi-value choice example, The choice is encoded as a bitset. ``` -Message template --------------------------------------------------------------------------------------------------------------- +## Message template + +### General To define a message type, add a `` element to the root element of the XML document, ``. @@ -405,9 +413,7 @@ A `` element contains its field definitions in three categories, which must appear in this sequence: 1. Element `` defines a fixed-length field - 2. Element `` defines a repeating group - 3. Element `` defines a variable-length field, such as raw data The number of members of each type is unbound. @@ -417,21 +423,21 @@ The number of members of each type is unbound. The order that fields are listed in the message schema governs the order that they are encoded on the wire. -**`` element attributes** - -| `` attribute | Description | XML type | Usage | Valid values | -|-----------------------|--------------------------------------------------------------------------------------------------------------------------------------------|--------------------|-------------|--------------------------------------------------------------------------| -| name | Name of a message | symbolicName\_t | required | Must be unique among all messages in a schema | -| id | Unique message template identifier | unsignedInt | required | Must be unique within a schema | -| description | Documentation | string | optional | | -| blockLength | Reserved size in number of octets for root level of message body | unsignedInt | optional | If specified, must be greater than or equal to the sum of field lengths. | -| semanticType | Documents value of FIX MsgType for a message | token | optional | Listed in FIX specifications | -| sinceVersion | Documents the version of a schema in which a message was added | nonNegativeInteger | default = 0 | | -| deprecated | Documents the version of a schema in which a message was deprecated. It should no longer be sent but is documented for back-compatibility. | nonnegativeInteger | optional | Must be less than or equal to the version of the message schema. | +### `` element attributes + +| `` attribute | Description | XML type | Usage | Valid values | +|----------------------|-----------------------------------------------|-------------------|-----------------|---------------------------| +| name | Name of a message | symbolicName\_t | required | Must be unique among all messages in a schema | +| id | Unique message template identifier | unsignedInt | required | Must be unique within a schema | +| description | Documentation | string | optional | | +| blockLength | Reserved size in number of octets for root level of message body | unsignedInt | optional | If specified, must be greater than or equal to the sum of field lengths. | +| semanticType | Documents value of FIX MsgType(35) field for a message | token | optional | Listed in FIX specifications | +| sinceVersion | Documents the version of a schema in which a message was added | nonNegativeInteger | default = 0 | | +| deprecated | Documents the version of a schema in which a message was deprecated. It should no longer be sent but is documented for back-compatibility. | nonnegativeInteger | optional | Must be less than or equal to the version of the message schema. | Note that there need not be a one-to-one relationship between message template (identified by `id` attribute) and `semanticType` attribute. You -might design multiple templates for the same FIX MsgType to optimize +might design multiple templates for the same FIX MsgType(35) value to optimize different scenarios. Example `` element @@ -440,26 +446,24 @@ Example `` element ``` -Field attributes --------------------------------------------------------------------------------------------------------------- +## Field attributes -Fields are added to a `` element as child elements. See Field -Encoding section above for a listing of all field types. +Fields are added to a `` element as child elements. See section [*Field Encoding*](#field-encoding) for a listing of all field types. These are the common attributes of all field types. -| Schema attribute | Description | XML type | Usage | Valid values | -|------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------|------------------------------------|-------------------------------------------------------------------------------------------------------| -| name | Name of a field | symbolicName\_t | required | Name and id must uniquely identify a field type within a message schema. | -| id | Unique field identifier (FIX tag) | unsignedShort | required | | -| description | Documentation | string | optional | | -| type | Encoding type name, one of simple type, composite type or enumeration. | string | required | Must match the name attribute of a simple ``, `` encoding type, `` or ``. | -| offset | Offset to the start of the field within a message or repeating group entry. By default, the offset is the sum of preceding field sizes, but it may be increased to effect byte alignment. | unsignedInt | optional | Must be greater than or equal to the sum of preceding field sizes. | -| presence | Field presence | enumeration | Default = required | required = field value is required; not tested for null. optional = field value may be null. constant = constant value not sent on wire. | -| valueRef | Constant value of a field as a valid value of an enumeration | qualifiedName\_t | optional Valid only if presence= ”constant” | If provided, the qualified name must match the name attribute of a `` within an `` | -| sinceVersion | The version of a message schema in which this field was added. | InonnegativeInteger | default=0 | Must not be greater than version attribute of `` element. | -| deprecated | Documents the version of a schema in which a field was deprecated. It should no longer be used in new messages. | nonnegativeInteger | optional | Must be less than or equal to the version of the message schema. | +| Schema attribute | Description | XML type | Usage | Valid values | +|----------------------|-----------------------------------------------|-------------------|-----------------|---------------------------| +| name | Name of a field | symbolicName\_t | required | Name and id must uniquely identify a field type within a message schema. | +| id | Unique field identifier (FIX tag number) | unsignedShort | required | | +| description | Documentation | string | optional | | +| type | Encoding type name, one of simple type, composite type or enumeration. | string | required | Must match the name attribute of a simple ``, `` encoding type, `` or ``. | +| offset | Offset to the start of the field within a message or repeating group entry. By default, the offset is the sum of preceding field sizes, but it may be increased to effect byte alignment. | unsignedInt | optional | Must be greater than or equal to the sum of preceding field sizes. | +| presence | Field presence | enumeration | Default = required | required = field value is required; not tested for null. optional = field value may be null. constant = constant value not sent on wire. | +| valueRef | Constant value of a field as a valid value of an enumeration | qualifiedName\_t | optional Valid only if presence= ”constant” | If provided, the qualified name must match the name attribute of a `` within an `` | +| sinceVersion | The version of a message schema in which this field was added. | InonnegativeInteger | default=0 | Must not be greater than version attribute of `` element. | +| deprecated | Documents the version of a schema in which a field was deprecated. It should no longer be used in new messages. | nonnegativeInteger | optional | Must be less than or equal to the version of the message schema. | Example field schemas @@ -469,19 +473,17 @@ Field that uses a composite encoding ```xml - 0\ + 0\ - + ``` -Repeating group schema --------------------------------------------------------------------------------------------------------------------- +## Repeating group schema A `` has the same attributes as a `` element since they -both inherit attributes from the blockType XML type. A group has the +both inherit attributes from the blockType XML type. See section +[*Message element attributes*](#message-element-attributes) for details. A group has the same child members as a message, and they must appear in the same order: 1. Element `` defines a fixed-length field @@ -494,23 +496,19 @@ same child members as a message, and they must appear in the same order: The number of members of each type is unbound. -| `` attribute | Description | XML type | Usage | Valid values | -|---------------------|-----------------------------------|-----------------|-----------------------------|--------------------------------------------------------------------------| +| `` attribute | Description | XML type | Usage | Valid values | +|----------------------|-------------------------------|------------------------|--------------|---------------------------| | name | Name of a group | symbolicName\_t | required | Name and id must uniquely identify a group type within a message schema. | | id | Unique group identifier | unsignedShort | required | | | description | Documentation | string | optional | | | dimensionType | Dimensions of the repeating group | symbolicName\_t | default = groupSizeEncoding | If specified, must be greater than or equal to the sum of field lengths. | -`` element inherits attributes of blockType. See `` -above. - *Example group schema with default dimension encoding* ```xml - + @@ -519,36 +517,35 @@ above. ``` -Schema validation --------------------------------------------------------------------------------------------------------------------------------------------------------------- +## Schema validation + +### General The first level of schema validation is enforced by XML schema validation tools to make sure that a schema is well-formed according to XSD schema rules. Well-formed XML is necessary but insufficient to prove that a schema is correct according to FIX Simple Binary Encoding rules. -Additional conditions that render a schema invalid include the -following. - -| Error condition | Error description | -|----------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| Missing field encoding | A field or `` references a type name that is undefined. | -| Missing message header encoding | Missing encoding type for headerType specified in ``. Default name is “messageHeader”. | -| Duplicate encoding name | An encoding name is non-unique, rendering a reference ambiguous. | -| nullValue specified for non-null encoding | Attribute nullValue is inconsistent with presence=required or constant | -| Attributes nullValue, minValue or maxValue of wrong data range | The specified values must be convertible to a scalar value consistent with the encoding. For example, if the primitive type is uint8, then the value must be in the range 0 through 255. | -| semanticType mismatch | If the attribute is specified on both a field and the encoding that it references, the values must be identical. | -| presence mismatch | If the attribute is specified on both a field and the encoding that it references, the values must be identical. | -| Missing constant value | If presence=constant is specified for a field or encoding, the element value must contain the constant value. | -| Missing validValue content | A `` element is required to carry its value. | -| Incompatible offset and blockLength | A field offset greater than message or group blockLength is invalid | +Additional conditions that render a schema invalid include the following. + +| Error condition | Error description | +|--------------------------|--------------------------------------------------------------------------------------| +| Missing field encoding | A field or `` references a type name that is undefined. | +| Missing message header encoding | Missing encoding type for headerType specified in ``. Default name is “messageHeader”. | +| Duplicate encoding name | An encoding name is non-unique, rendering a reference ambiguous. | +| nullValue specified for non-null encoding | Attribute nullValue is inconsistent with presence=required or constant | +| Attributes nullValue, minValue or maxValue of wrong data range | The specified values must be convertible to a scalar value consistent with the encoding. For example, if the primitive type is uint8, then the value must be in the range 0 through 255. | +| semanticType mismatch | If the attribute is specified on both a field and the encoding that it references, the values must be identical. | +| presence mismatch | If the attribute is specified on both a field and the encoding that it references, the values must be identical. | +| Missing constant value | If presence=constant is specified for a field or encoding, the element value must contain the constant value. | +| Missing validValue content | A `` element is required to carry its value. | +| Incompatible offset and blockLength | A field offset greater than message or group blockLength is invalid | | Duplicate ID or name of field or group | Attributes id and name must uniquely identify a type within a message schema. This applies to fields and groups. To be clear, the same field or group ID may be used in multiple messages, but each instance must represent the same type. Each of those instances must match on both id and name attributes. | ### Message with a repeating group ```xml - + @@ -570,8 +567,7 @@ following. - + @@ -581,8 +577,7 @@ following. ``` -Reserved element names ----------------------- +## Reserved element names ### Composite types diff --git a/v1-0-STANDARD/doc/05SchemaExtensionMechanism.md b/v1-0-STANDARD/doc/05SchemaExtensionMechanism.md index eb067a5..9977c0d 100644 --- a/v1-0-STANDARD/doc/05SchemaExtensionMechanism.md +++ b/v1-0-STANDARD/doc/05SchemaExtensionMechanism.md @@ -1,8 +1,8 @@ -Schema Extension Mechanism -===================================================================================================================================================================================================================================================================== +# Schema Extension Mechanism -Objective ---------- +## Objective + +### General It is not always practical to update all message publishers and consumers simultaneously. Within certain constraints, message schemas @@ -34,8 +34,7 @@ wire format does not change. Changes that break those constraints require consumers to update to the current schema used by publishers. An message template that has changed in an incompatible way must be assinged a new template "id" attribute. -Message schema features for extension -------------------------------------- +## Message schema features for extension ### Schema version @@ -48,7 +47,7 @@ Version applies to the schema as a whole, not to individual elements. Version is sent in the message header so the consumer can determine which version of the message schema was used to encode the message. -See section 4.3.1 above for schema attributes. +See section [*Message schema attributes*](#messageschema-attributes) for the specification. ### Since version @@ -68,7 +67,7 @@ appended in proper order. The length of the root level of the message may optionally be documented on a `` element in the schema using the blockLength attribute. -See section 4.5.3 above for message attributes. If not set in the +See section [*Message element attributes*](#message-element-attributes) for details. If not set in the schema, block length of the message root is the sum of its field lengths. Whether it is set in the schema or not, the block length is sent on the wire to consumers. @@ -76,7 +75,7 @@ sent on the wire to consumers. Likewise, a repeating group has a blockLength attribute to tell how much space is reserved for group entries, and the value is sent on the wire. It is encoded in the schema as part of the NumInGroup field encoding. -See section 3.4.8.2 above. +See section [*Encoding of repeating group dimensions*](#encoding-of-repeating-group-dimensions) for details. ### Deprecated elements @@ -86,13 +85,12 @@ Updated applications should not publish deprecated messages or values, but declarations may remain in the message schema during a staged migration to replacement message layouts. -Wire format features for extension ----------------------------------- +## Wire format features for extension ### Block size The length of the root level of the message is sent on the wire in the -SBE message header. See section 3.2.2 above. Therefore, if new fields +SBE message header. See section [*Root block length*](#root-block-length) for details. Therefore, if new fields were appended in a later version of the schema, the consumer would still know how many octets to consume to find the next message element, such as repeating group or variable-length Data field. Without the current @@ -106,30 +104,29 @@ encoding. Message headers and repeating group dimensions carry a count of the number of repeating groups and a count of variable-length data fields on the wire. This supports a walk by a decoder of all the elements of a message, even when the decoder was built with an older version of a schema. As for added fixed-length fields, new repeating groups cannot be interpreted by the decoder, but it still can process the ones it knows, and it can correctly reach the end of a message. -Comaptibility strategy ------------------------ +## Compatibility strategy + *This suggested strategy is non-normative.* A message decoder compares the schema version in a received message header to the version that the decoder was built with. If the *received version is equal to the decoder's version*, then all fields known to the decoder may be parsed, and no further analysis is required. -If the *received version is greater than the decoder's version* (that is, the producer's encoder is newer than the consumer's decoder), then all fields known to the decoder may be parsed but it will be unable to parse added fields. +If the *received version is greater than the decoder's version* (that is, the producer's encoder is newer than the consumer's decoder), then all fields known to the decoder may be parsed but it will be unable to parse added fields. -Also, an old decoder may encounter unexpected enumeration values. The application layer determines whether an unexpected value is a fatal error. Probably so for a required field since the business meaning is unknown, but it may choose to allow an unknown value of an optional field to pass through. For example, if OrdType value J="Market If Touched" is added to a schema, and the consumer does not recognize it, then the application returns an order rejection with reason "order type not supported", even if it does not know what "J" represents. Note that this is not strictly a versioning problem, however. This exception handling is indistinguishable from the case where "J" was never added to the enum but was simply sent in error. +Also, an old decoder may encounter unexpected enumeration values. The application layer determines whether an unexpected value is a fatal error. Probably so for a required field since the business meaning is unknown, but it may choose to allow an unknown value of an optional field to pass through. For example, if OrdType(40)=J (Market If Touched (MIT)) is added to a schema, and the consumer does not recognize it, then the application returns an order rejection with reason "order type not supported", even if it does not know what "J" represents. Note that this is not strictly a versioning problem, however. This exception handling is indistinguishable from the case where "J" was never added to the enum but was simply sent in error. -If the *received version is less than the decoder's version* (that is, the producer's encoder is older than the consumer's decoder), then only the fields of the older version may be parsed. This information is available through metadata as "sinceVersion" attribute of a field. If sinceVersion is greater than received schema version, then the field is not available. How a decoder signals an application that a field is unavailable is an implementation detail. One strategy is for an application to provide a default value for unavailable fields. +If the *received version is less than the decoder's version* (that is, the producer's encoder is older than the consumer's decoder), then only the fields of the older version may be parsed. This information is available through metadata as sinceVersion attribute of a field. If sinceVersion is greater than received schema version, then the field is not available. How a decoder signals an application that a field is unavailable is an implementation detail. One strategy is for an application to provide a default value for unavailable fields. -Message schema extension example --------------------------------- +## Message schema extension example -Initial version of a message schema +### Initial version of a message schema ```xml - - - + + + @@ -138,52 +135,44 @@ Initial version of a message schema ``` -Second version - a new message is added +### Second version - a new message is added ```xml - + - + - - + + ``` -Third version - a field is added +### Third version - a field is added ```xml - + - - + + - + - + diff --git a/v1-0-STANDARD/doc/06UsageGuidelines.md b/v1-0-STANDARD/doc/06UsageGuidelines.md index 31979eb..deeaadb 100644 --- a/v1-0-STANDARD/doc/06UsageGuidelines.md +++ b/v1-0-STANDARD/doc/06UsageGuidelines.md @@ -1,8 +1,6 @@ -Usage Guidelines -================ +# Usage Guidelines -Identifier encodings -------------------------------------------------------------------------------------------------------------------- +## Identifier encodings FIX specifies request and entity identifiers as String type. Common practice is to specify an identifier field as fixed-length character of @@ -10,21 +8,19 @@ a certain size. Optionally, a message schema may restrict such identifiers to numeric encodings. - -Example of an identifier field with character encoding +\ +**Example of an identifier field with character encoding** ```xml - + ``` - -Example of an identifier field with numeric encoding +\ +**Example of an identifier field with numeric encoding** ```xml - + ``` diff --git a/v1-0-STANDARD/doc/07Examples.md b/v1-0-STANDARD/doc/07Examples.md index 4dcb290..41f2634 100644 --- a/v1-0-STANDARD/doc/07Examples.md +++ b/v1-0-STANDARD/doc/07Examples.md @@ -1,14 +1,16 @@ -Examples -======== +# Examples -The example messages are preceded by Simple Open Framing Header. Note +## General + +The example messages are preceded by Simple Open Framing Header (SOFH). Note that SOFH encoding is always big-endian, regardless of the byte order of the SBE message body. See that FIX standard for details. Not all FIX enumeration values are listed in the samples. -Flat, fixed-length message --------------------------- +## Flat, fixed-length message + +### General This is an example of a simple, flat order message without repeating groups or variable-length data. @@ -18,7 +20,7 @@ groups or variable-length data. ```xml - > - - - 2 - 4 - 6 + 0 + 1 + 2 + 4 + 6 - - + ``` @@ -339,13 +343,13 @@ Hexadecimal and ASCII representations (little-endian byte order): ### Interpretation |Wire format|Field ID|Name|Offset|Length|Interpreted value| -|-----------|-------:|----|-----:|-----:|-----------------| +|------------------|:------:|---------------------|:------:|:------:|-------------| | `00000040` | | SOFH message length | 0 | 4 | 64 | | `eb50` | | SOFH encoding | 4 | 2 | SBE little-endian | | `0900` | | SBE block length | 0 | 2 | 9 | | `6100` | | SBE template ID | 2 | 2 | 97 | | `5b00` | | SBE schema ID | 4 | 2 | 91 | | `0000` | | SBE schema version | 6 | 2 | 0 | -| `4f52443030303031` | 379 | BusinesRejectRefId | 0 | 8 | ORD00001 | +| `4f52443030303031` | 379 | BusinessRejectRefID | 0 | 8 | ORD00001 | | `06` | 380 | BusinessRejectReason | 8 | 1 | NotAuthorized | -| `4e6f74206175...` | 58 | Text | 0 | 39 | Not authorized to trade that instrument | \ No newline at end of file +| `4e6f74206175...` | 58 | Text | 0 | 39 | Not authorized to trade that instrument | diff --git a/v1-0-STANDARD/doc/08ReleaseNotes.md b/v1-0-STANDARD/doc/08ReleaseNotes.md deleted file mode 100644 index 090af06..0000000 --- a/v1-0-STANDARD/doc/08ReleaseNotes.md +++ /dev/null @@ -1,16 +0,0 @@ -Release Notes -============= - -These are the changes made since SBE version 1.0. - -SBE version 2.0 Release Candidate 1 -------------------- -These issues were resolved and accepted for version 2.0 Release Candidate 1. See [issues](https://github.com/FIXTradingCommunity/fix-simple-binary-encoding/issues) and [pull requests](https://github.com/FIXTradingCommunity/fix-simple-binary-encoding/pulls) in GitHub for details and changes. - -| Issue | Description | -|------:|----------------------------------------------------------------| -| 26 | Adding new variable length field in a repeating group | - -### Compatibility - -Version 2.0 is not back-compatible SBE version 1.0, either in wire format or XML schema. diff --git a/v1-0-STANDARD/doc/FIXDisclaimerTechStd.md b/v1-0-STANDARD/doc/FIXDisclaimerTechStd.md new file mode 100644 index 0000000..48f3c6e --- /dev/null +++ b/v1-0-STANDARD/doc/FIXDisclaimerTechStd.md @@ -0,0 +1,27 @@ +::: {custom-style=Disclaimer} +DISCLAIMER +::: + +THE INFORMATION CONTAINED HEREIN AND THE FINANCIAL INFORMATION EXCHANGE PROTOCOL (COLLECTIVELY, THE "FIX PROTOCOL") ARE PROVIDED "AS IS" AND NO PERSON OR ENTITY ASSOCIATED WITH THE FIX PROTOCOL MAKES ANY REPRESENTATION OR WARRANTY, EXPRESS OR IMPLIED, AS TO THE FIX PROTOCOL (OR THE RESULTS TO BE OBTAINED BY THE USE THEREOF) OR ANY OTHER MATTER AND EACH SUCH PERSON AND ENTITY SPECIFICALLY DISCLAIMS ANY WARRANTY OF ORIGINALITY, ACCURACY, COMPLETENESS, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SUCH PERSONS AND ENTITIES DO NOT WARRANT THAT THE FIX PROTOCOL WILL CONFORM TO ANY DESCRIPTION THEREOF OR BE FREE OF ERRORS. THE ENTIRE RISK OF ANY USE OF THE FIX PROTOCOL IS ASSUMED BY THE USER. + +NO PERSON OR ENTITY ASSOCIATED WITH THE FIX PROTOCOL SHALL HAVE ANY LIABILITY FOR DAMAGES OF ANY KIND ARISING IN ANY MANNER OUT OF OR IN CONNECTION WITH ANY USER'S USE OF (OR ANY INABILITY TO USE) THE FIX PROTOCOL, WHETHER DIRECT, INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL (INCLUDING, WITHOUT LIMITATION, LOSS OF DATA, LOSS OF USE, CLAIMS OF THIRD PARTIES OR LOST PROFITS OR REVENUES OR OTHER ECONOMIC LOSS), WHETHER IN TORT (INCLUDING NEGLIGENCE AND STRICT LIABILITY), CONTRACT OR OTHERWISE, WHETHER OR NOT ANY SUCH PERSON OR ENTITY HAS BEEN ADVISED OF, OR OTHERWISE MIGHT HAVE ANTICIPATED THE POSSIBILITY OF, SUCH DAMAGES. + +**DRAFT OR NOT RATIFIED PROPOSALS** (REFER TO PROPOSAL STATUS AND/OR SUBMISSION STATUS ON COVER PAGE) ARE PROVIDED "AS IS" TO INTERESTED +PARTIES FOR DISCUSSION ONLY. PARTIES THAT CHOOSE TO IMPLEMENT THIS DRAFT PROPOSAL DO SO AT THEIR OWN RISK. IT IS A DRAFT DOCUMENT AND MAY BE +UPDATED, REPLACED, OR MADE OBSOLETE BY OTHER DOCUMENTS AT ANY TIME. THE FIX GLOBAL TECHNICAL COMMITTEE WILL NOT ALLOW EARLY IMPLEMENTATION TO +CONSTRAIN ITS ABILITY TO MAKE CHANGES TO THIS SPECIFICATION PRIOR TO FINAL RELEASE. IT IS INAPPROPRIATE TO USE FIX WORKING DRAFTS AS +REFERENCE MATERIAL OR TO CITE THEM AS OTHER THAN “WORKS IN PROGRESS”. THE FIX GLOBAL TECHNICAL COMMITTEE WILL ISSUE, UPON COMPLETION OF REVIEW +AND RATIFICATION, AN OFFICIAL STATUS ("APPROVED") OF/FOR THE PROPOSAL AND A RELEASE NUMBER. + +No proprietary or ownership interest of any kind is granted with respect to the FIX Protocol (or any rights therein), except as expressly set out in FIX Protocol Limited's Copyright and Acceptable Use Policy. + +© Copyright 2013-2020 FIX Protocol Limited, all rights reserved + +\ + +![](https://i.creativecommons.org/l/by-nd/4.0/88x31.png) + +FIX Technical Standard Specifications by [FIX Protocol Ltd.](https://www.fixtradingcommunity.org/) are licensed under a [Creative Commons Attribution-NoDerivatives 4.0 International License](http://creativecommons.org/licenses/by-nd/4.0/). Based on a work at [https://github.com/FIXTradingCommunity/](https://github.com/FIXTradingCommunity/). + + +1. diff --git a/v1-0-STANDARD/doc/FIX_TechStd_Style_MASTER.docx b/v1-0-STANDARD/doc/FIX_TechStd_Style_MASTER.docx new file mode 100644 index 0000000..6b28d28 Binary files /dev/null and b/v1-0-STANDARD/doc/FIX_TechStd_Style_MASTER.docx differ diff --git a/v1-0-STANDARD/doc/ISOBiblio.md b/v1-0-STANDARD/doc/ISOBiblio.md new file mode 100644 index 0000000..712215f --- /dev/null +++ b/v1-0-STANDARD/doc/ISOBiblio.md @@ -0,0 +1,25 @@ +::: {custom-style="Annex"} +**Bibliography** +::: + +[1] Simple Open Framing Header (SOFH) Draft Standard v1.0, *Message framing standard for FIX messages* [https://www.fixtrading.org/standards/fix-sofh/](https://www.fixtrading.org/standards/fix-sofh/) + +[2] FIX Latest, *Normative specification of the FIX Protocol* [https://www.fixtrading.org/online-specification/](https://www.fixtrading.org/online-specification/) + +[3] IEEE 754, *IEEE Standard for Binary Floating-Point Arithmetic* [https://ieeexplore.ieee.org/document/8766229](https://ieeexplore.ieee.org/document/8766229) + +[4] ISO 639-1, *Codes for the representation of names of languages — Part 1: Alpha-2 code* [https://www.iso.org/standard/22109.html](https://www.iso.org/standard/22109.html) + +[5] ISO 3166-1, *Codes for the representation of names of countries and their subdivisions — Part 1: Country codes* [https://www.iso.org/standard/63545.html](https://www.iso.org/standard/63545.html) + +[6] ISO 4217, *Codes for the representation of currencies and funds* [https://www.iso.org/standard/64758.html](https://www.iso.org/standard/64758.html) + +[7] ISO 8601, *Data elements and interchange formats - Information interchange — Representation of dates and times* [https://www.iso.org/standard/40874.html](https://www.iso.org/standard/40874.html) + +[8] ISO 10383, *Securities and related financial instruments — Codes for exchanges and market identification (MIC)* [https://www.iso.org/standard/61067.html](https://www.iso.org/standard/61067.html) + +[9] ISO/IEC 11404, *Information technology — General-Purpose Datatypes (GPD)* [https://www.iso.org/standard/39479.html](https://www.iso.org/standard/39479.html) + +[10] W3C XML Schema, *XML 1.1 schema standards* [http://www.w3.org/XML/Schema.html#dev](http://www.w3.org/XML/Schema.html#dev) + +[11] IETF RFC 2119, *Keywords for use in RFCs to Indicate Requirement Levels March 1997* [https://datatracker.ietf.org/doc/html/rfc2119](https://datatracker.ietf.org/doc/html/rfc2119) diff --git a/v1-0-STANDARD/doc/ISOCopyright.md b/v1-0-STANDARD/doc/ISOCopyright.md new file mode 100644 index 0000000..5be0485 --- /dev/null +++ b/v1-0-STANDARD/doc/ISOCopyright.md @@ -0,0 +1,15 @@ +::: {custom-style="TextBox"} +© ISO 2022\ +\ +All rights reserved. Unless otherwise specified, or required in the context of its implementation, no part of this publication may be reproduced or utilized otherwise in any form or by any means, electronic or mechanical, including photocopying, or posting on the internet or an intranet, without prior written permission. Permission can be requested from either ISO at the address below or ISO’s member body in the country of the requester.\ +\ +        ISO copyright office\ +        CP 401 • Ch. de Blandonnet 8\ +        CH-1214 Vernier, Geneva\ +        Phone: +41 22 749 01 11\ +        Fax: +41 22 749 09 47\ +        Email: copyright@iso.org\ +        Website: www.iso.org\ +\ +Published in Switzerland +::: diff --git a/v1-0-STANDARD/doc/ISOForeword.md b/v1-0-STANDARD/doc/ISOForeword.md new file mode 100644 index 0000000..6d100b4 --- /dev/null +++ b/v1-0-STANDARD/doc/ISOForeword.md @@ -0,0 +1,19 @@ +::: {custom-style="NewPageWithTOC"} +**Foreword** +::: + +ISO (the International Organization for Standardization) is a worldwide federation of national standards bodies (ISO member bodies). The work of preparing International Standards is normally carried out through ISO technical committees. Each member body interested in a subject for which a technical committee has been established has the right to be represented on that committee. International organizations, governmental and non-governmental, in liaison with ISO, also take part in the work. ISO collaborates closely with the International Electrotechnical Commission (IEC) on all matters of electrotechnical standardization. + +The procedures used to develop this document and those intended for its further maintenance are described in the ISO/IEC Directives, Part 1. In particular the different approval criteria needed for the different types of ISO documents should be noted. This document was drafted in accordance with the editorial rules of the ISO/IEC Directives, Part 2 (see [www.iso.org/directives](www.iso.org/directives)). + +Attention is drawn to the possibility that some of the elements of this document may be the subject of patent rights. ISO shall not be held responsible for identifying any or all such patent rights. Details of any patent rights identified during the development of the document will be in the Introduction and/or on the ISO list of patent declarations received (see [www.iso.org/patents](www.iso.org/patents)). + +Any trade name used in this document is information given for the convenience of users and does not constitute an endorsement. + +For an explanation on the voluntary nature of standards, the meaning of ISO specific terms and expressions related to conformity assessment, as well as information about ISO's adherence to the World Trade Organization (WTO) principles in the Technical Barriers to Trade (TBT) see the following URL: [www.iso.org/iso/foreword.html](www.iso.org/iso/foreword.html). + +This document was prepared by Technical Committee ISO/TC 68, *Financial Services*, Subcommittee SC 9, *Information Exchange* + +A list of all parts in the ISO ##### series can be found on the ISO website. + +Any feedback or questions on this document should be directed to the user’s national standards body. A complete listing of these bodies can be found at [www.iso.org/members.html](www.iso.org/members.html). diff --git a/v1-0-STANDARD/doc/ISOIntro.md b/v1-0-STANDARD/doc/ISOIntro.md new file mode 100644 index 0000000..b46e934 --- /dev/null +++ b/v1-0-STANDARD/doc/ISOIntro.md @@ -0,0 +1,9 @@ +::: {custom-style="NewPageWithTOC"} +Introduction +::: + +The Financial Information eXchange Simple Binary Encoding (SBE) targets high performance trading systems. It is optimized for low latency of encoding and decoding while keeping bandwidth utilization reasonably small. For compatibility, it is intended to represent all FIX semantics. SBE is primarily a fixed length wire format but also supports variable length fields and repeating groups with fixed length entries. The wire format does not contain any meta-data other than length information for variable elements. The meta-data is a message schema provided out-of-band as an XML Schema Definition (XSD) file. + +::: {custom-style="NewPage"} +**Financial Services -- Financial Information eXchange -- Simple Binary Encoding** +::: diff --git a/v1-0-STANDARD/doc/ISO_TechStd_Style_MASTER.docx b/v1-0-STANDARD/doc/ISO_TechStd_Style_MASTER.docx new file mode 100644 index 0000000..ec57d58 Binary files /dev/null and b/v1-0-STANDARD/doc/ISO_TechStd_Style_MASTER.docx differ diff --git a/v1-0-STANDARD/doc/JTC1Biblio.md b/v1-0-STANDARD/doc/JTC1Biblio.md new file mode 100644 index 0000000..712215f --- /dev/null +++ b/v1-0-STANDARD/doc/JTC1Biblio.md @@ -0,0 +1,25 @@ +::: {custom-style="Annex"} +**Bibliography** +::: + +[1] Simple Open Framing Header (SOFH) Draft Standard v1.0, *Message framing standard for FIX messages* [https://www.fixtrading.org/standards/fix-sofh/](https://www.fixtrading.org/standards/fix-sofh/) + +[2] FIX Latest, *Normative specification of the FIX Protocol* [https://www.fixtrading.org/online-specification/](https://www.fixtrading.org/online-specification/) + +[3] IEEE 754, *IEEE Standard for Binary Floating-Point Arithmetic* [https://ieeexplore.ieee.org/document/8766229](https://ieeexplore.ieee.org/document/8766229) + +[4] ISO 639-1, *Codes for the representation of names of languages — Part 1: Alpha-2 code* [https://www.iso.org/standard/22109.html](https://www.iso.org/standard/22109.html) + +[5] ISO 3166-1, *Codes for the representation of names of countries and their subdivisions — Part 1: Country codes* [https://www.iso.org/standard/63545.html](https://www.iso.org/standard/63545.html) + +[6] ISO 4217, *Codes for the representation of currencies and funds* [https://www.iso.org/standard/64758.html](https://www.iso.org/standard/64758.html) + +[7] ISO 8601, *Data elements and interchange formats - Information interchange — Representation of dates and times* [https://www.iso.org/standard/40874.html](https://www.iso.org/standard/40874.html) + +[8] ISO 10383, *Securities and related financial instruments — Codes for exchanges and market identification (MIC)* [https://www.iso.org/standard/61067.html](https://www.iso.org/standard/61067.html) + +[9] ISO/IEC 11404, *Information technology — General-Purpose Datatypes (GPD)* [https://www.iso.org/standard/39479.html](https://www.iso.org/standard/39479.html) + +[10] W3C XML Schema, *XML 1.1 schema standards* [http://www.w3.org/XML/Schema.html#dev](http://www.w3.org/XML/Schema.html#dev) + +[11] IETF RFC 2119, *Keywords for use in RFCs to Indicate Requirement Levels March 1997* [https://datatracker.ietf.org/doc/html/rfc2119](https://datatracker.ietf.org/doc/html/rfc2119) diff --git a/v1-0-STANDARD/doc/JTC1Copyright.md b/v1-0-STANDARD/doc/JTC1Copyright.md new file mode 100644 index 0000000..31291d3 --- /dev/null +++ b/v1-0-STANDARD/doc/JTC1Copyright.md @@ -0,0 +1,17 @@ +::: {custom-style="TextBox"} +**COPYRIGHT PROTECTED DOCUMENT**\ +\ +© ISO/IEC 2024\ +\ +All rights reserved. Unless otherwise specified, or required in the context of its implementation, no part of this publication may be reproduced or utilized otherwise in any form or by any means, electronic or mechanical, including photocopying, or posting on the internet or an intranet, without prior written permission. Permission can be requested from either ISO at the address below or ISO’s member body in the country of the requester.\ +\ + **ISO copyright office** **IEC Secretariat**\ + CP 401 • Ch. de Blandonnet 8 3, rue de Varembé\ + CH-1214 Vernier, Geneva CH-1211 Geneva 20\ + Phone: +41 22 749 01 11 Phone: +41 22 919 02 11\ + Fax: +41 22 749 09 47 Fax: +41 22 919 03 00\ + Email: copyright@iso.org Email: info@iec.ch\ + Website: [www.iso.org](http://www.iso.org) Website: [www.iec.ch](http://www.iec.ch)\ +\ +Published in Switzerland +::: diff --git a/v1-0-STANDARD/doc/JTC1Foreword.md b/v1-0-STANDARD/doc/JTC1Foreword.md new file mode 100644 index 0000000..2493181 --- /dev/null +++ b/v1-0-STANDARD/doc/JTC1Foreword.md @@ -0,0 +1,17 @@ +::: {custom-style="NewPageWithTOC"} +**Foreword** +::: + +ISO (the International Organization for Standardization) and IEC (the International Electrotechnical Commission) form the specialized system for worldwide standardization. National bodies that are members of ISO or IEC participate in the development of International Standards through technical committees established by the respective organization to deal with particular fields of technical activity. ISO and IEC technical committees collaborate in fields of mutual interest. Other international organizations, governmental and non-governmental, in liaison with ISO and IEC, also take part in the work. + +The procedures used to develop this document and those intended for its further maintenance are described in the ISO/IEC Directives, Part 1. In particular the different approval criteria needed for the different types of ISO documents should be noted. This document was drafted in accordance with the editorial rules of the ISO/IEC Directives, Part 2 (see [www.iso.org/directives](www.iso.org/directives)). + +Attention is drawn to the possibility that some of the elements of this document may be the subject of patent rights. ISO and IEC shall not be held responsible for identifying any or all such patent rights. Details of any patent rights identified during the development of the document will be in the Introduction and/or on the ISO list of patent declarations received (see [www.iso.org/patents](www.iso.org/patents)) or the IEC list of patent declarations received (see [http://patents.iec.ch](http://patents.iec.ch)). + +Any trade name used in this document is information given for the convenience of users and does not constitute an endorsement. + +For an explanation on the voluntary nature of standards, the meaning of ISO specific terms and expressions related to conformity assessment, as well as information about ISO's adherence to the World Trade Organization (WTO) principles in the Technical Barriers to Trade (TBT), see [www.iso.org/iso/foreword.html](www.iso.org/iso/foreword.html). + +This document was prepared by the Joint Development Foundation (as OpenChain Specification) and drafted in accordance with its editorial rules. It was adopted, under the JTC 1 PAS procedure, by Joint Technical Committee ISO/IEC JTC 1, *Information technology*. + +Any feedback or questions on this document should be directed to the user’s national standards body. A complete listing of these bodies can be found at [www.iso.org/members.html](www.iso.org/members.html). diff --git a/v1-0-STANDARD/doc/JTC1Intro.md b/v1-0-STANDARD/doc/JTC1Intro.md new file mode 100644 index 0000000..b46e934 --- /dev/null +++ b/v1-0-STANDARD/doc/JTC1Intro.md @@ -0,0 +1,9 @@ +::: {custom-style="NewPageWithTOC"} +Introduction +::: + +The Financial Information eXchange Simple Binary Encoding (SBE) targets high performance trading systems. It is optimized for low latency of encoding and decoding while keeping bandwidth utilization reasonably small. For compatibility, it is intended to represent all FIX semantics. SBE is primarily a fixed length wire format but also supports variable length fields and repeating groups with fixed length entries. The wire format does not contain any meta-data other than length information for variable elements. The meta-data is a message schema provided out-of-band as an XML Schema Definition (XSD) file. + +::: {custom-style="NewPage"} +**Financial Services -- Financial Information eXchange -- Simple Binary Encoding** +::: diff --git a/v1-0-STANDARD/doc/JTC1_TechStd_Style_MASTER.docx b/v1-0-STANDARD/doc/JTC1_TechStd_Style_MASTER.docx new file mode 100644 index 0000000..60cebf3 Binary files /dev/null and b/v1-0-STANDARD/doc/JTC1_TechStd_Style_MASTER.docx differ diff --git a/v1-0-STANDARD/doc/SBE.cmd b/v1-0-STANDARD/doc/SBE.cmd new file mode 100644 index 0000000..517107a --- /dev/null +++ b/v1-0-STANDARD/doc/SBE.cmd @@ -0,0 +1,44 @@ +echo Compilation started... +:: Script is expected to start running in the folder where it is located (together with the source files) +set SOURCE=%CD% +:: There is only one disclaimer and style docx file for all FIX Technical Standards and it is stored with the FIX Session Layer +:: Repository has local copies with the specific names and dates of the standard +set DISCLAIMER=FIXDisclaimerTechStd.md +set STYLE=FIX_TechStd_Style_MASTER.docx +set TARGET=%SOURCE%\target +set YAML=%SOURCE%\SBE.yaml +set FILES=01Introduction.md 02FieldEncoding.md 03MessageStructure.md 04MessageSchema.md 05SchemaExtensionMechanism.md 06UsageGuidelines.md 07Examples.md +set WPFOLDER=\wp-content\uploads\2020\03\ + +:: Create FIX document version with disclaimer +pandoc "%DISCLAIMER%" %FILES% -o "%TARGET%\docx\Simple_Binary_Encoding_V1.0_with_Errata.docx" --reference-doc="%STYLE%" --metadata-file="%YAML%" --toc --toc-depth=4 +echo SBE document version created for FIX + +:: Create ISO document version with copyright etc. +set ISOYAML=%SOURCE%\SBE_ISO.yaml +set ISOSTYLE=ISO_TechStd_Style_MASTER.docx +set ISOCOPYRIGHT=ISOCopyright.md +set ISOFOREWORD=ISOForeword.md +set ISOINTRO=ISOIntro.md +:: set ISOBIBLIO=ISOBiblio.md + +pandoc %ISOCOPYRIGHT% %ISOFOREWORD% %ISOINTRO% %FILES% -o "%TARGET%\docx\ISOSimple_Binary_Encoding.docx" --reference-doc=%ISOSTYLE% --metadata-file=%ISOYAML% --filter pandoc-plantuml --toc --toc-depth=3 +echo SBE document version created for ISO + +:: Create base online version without disclaimer +:: pandoc $FILES -o "$TARGET/debug/SBEONLINE.html" -s --metadata-file="$YAML" --toc --toc-depth=2 + +:: Remove title as it is redundant to page header +:: sed -i '.bak1' '/

/d' "$TARGET/debug/SBEONLINE.html" + +:: Add header for table of contents +:: sed -i '.bak2' '/