Skip to content

Commit 6d2cb65

Browse files
authored
Merge pull request #56 from donmendelson/master
Semantic type with Decimal encoding for a field which is not a Price,…
2 parents 81e37dc + 3e61129 commit 6d2cb65

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

v2-0-RC1/doc/02FieldEncoding.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@ and message schema but are introduced here as an overview.
1111

1212
### Semantic data type
1313

14-
The FIX semantic data type of a field tells a data domain interpreted at the application layer, for example, whether it is numeric or character data, or whether it represents a time or price. Simple Binary Encoding represents all of
14+
The FIX semantic data type of a field tells a data domain interpreted at the application layer, for example, whether it is numeric or character data, or whether it represents a time or price. Simple Binary Encoding represents most of
1515
the semantic data types that FIX protocol has defined across all
16-
encodings. In message specifications, FIX data type is declared with
17-
attribute semanticType. See the section 2.2 below for a listing of those
18-
FIX types.
16+
encodings. In field specifications, FIX data type is declared with
17+
attribute `semanticType`.
18+
19+
See the "Data type summary" below for a listing of FIX types with the usual mapping to SBE encodings. Implementations should not restrict a semantic type to a specific encoding. Message designers may wish to imply a conversion or specialized interpretation at the application layer.
1920

2021
### Encoding
2122

@@ -74,10 +75,10 @@ value of an optional field does not necessarily imply that a default
7475
value should be applied. Rather, default handling is left to application
7576
layer specifications.
7677

77-
FIX data type summary
78+
Data type summary
7879
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
7980

80-
FIX semantic types are mapped to binary field encodings as follows. See
81+
FIX semantic types are typically mapped to binary field encodings as follows. See
8182
sections below for more detail about each type.
8283

8384
Schema attributes may restrict the range of valid values for a field.
@@ -92,7 +93,7 @@ See Common field schema attributes below.
9293
| NumInGroup | Group dimension encoding | 3.4.8 | A counter representing the number of entries in a repeating group. Value must be positive. |
9394
| DayOfMonth | Integer encoding | 2.4 | A field representing a day during a particular month (values 1 to 31). |
9495
| Qty | Decimal encoding | 2.5 | A number representing quantity of a security, such as shares. The encoding may constrain values to integers, if desired. |
95-
| float | Float encoding | 2.5 | A real number with binary representation of specified precision |
96+
| float | Float or Decimal | 2.5 | A real number with binary representation of specified precision. Alternatively, Decimal encoding is preferred for exact decimal numbers. |
9697
| Price | Decimal encoding | 2.5 | A decimal number representing a price |
9798
| PriceOffset | Decimal encoding | 2.5 | A decimal number representing a price offset, which can be mathematically added to a Price. |
9899
| Amt | Decimal encoding | 2.5 | A field typically representing a Price times a Qty. |
@@ -139,12 +140,12 @@ Attributes are optional unless specified otherwise.
139140
| 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. |
140141
| minValue | The lowest valid value of a range. Applies to scalar data types, but not to String or data types. |
141142
| maxValue | The highest valid value of a range (inclusive unless specified otherwise). Applies to scalar data types, but not to String or data types. |
142-
| semanticType | Tells the FIX semantic type of a field or encoding. It may be specified on either a field or its encoding. |
143+
| semanticType | Tells the semantic interpretation of a field in the FIX data type taxonomy. |
143144

144145
### Non-FIX types
145146

146147
Encodings may be added to SBE messages that do not correspond to listed
147-
FIX data types. In that case, the fields that use the encoding will not have a semanticType attribute.
148+
FIX data types. In that case, the fields that use the encoding will not have a `semanticType` attribute.
148149

149150
Integer encoding
150151
-------------------------------------------------------------------------------------------------------------------------------------------------------------
@@ -449,6 +450,8 @@ primitive types.
449450
<type name="double" primitiveType="double" />
450451
```
451452

453+
Designers should determine whether a field of FIX data type float should be represented by a binary floating point number or an exact decimal number. If it is the latter, then see "Decimal encoding" above.
454+
452455
### Examples of floating point fields
453456

454457
Examples show encoded bytes on the wire as hexadecimal digits,

0 commit comments

Comments
 (0)