Browse Source

Added some examples of the field types in the XML

master
Julio Biason 2 years ago
parent
commit
af305fdd72
  1. 4
      content/research/decoding-fast-examples.md
  2. 46
      content/research/decoding-fast.md
  3. 44
      content/research/decoding-fast.pt.md

4
content/research/decoding-fast-examples.md

@ -230,6 +230,10 @@ faster now:
not present, but because the previous value was 53, the ID for username "Me" not present, but because the previous value was 53, the ID for username "Me"
is 54. is 54.
# Decimals
# Presence Map Usage
--- ---
Changelog: Changelog:

46
content/research/decoding-fast.md

@ -1,6 +1,7 @@
+++ +++
title = "Decoding the FAST Protocol" title = "Decoding the FAST Protocol"
date = 2022-01-10 date = 2022-01-10
updated = 2022-01-13
[taxonomies] [taxonomies]
tags = ["finance", "binary", "protocol", "fix", "fast"] tags = ["finance", "binary", "protocol", "fix", "fast"]
@ -173,6 +174,13 @@ optional integer with value 0 is, actually, Null; to get the value 0 for the
field, the incoming data will have value 1, which is decremented in 1 and goes field, the incoming data will have value 1, which is decremented in 1 and goes
back to 0. back to 0.
In the template, the fields appear as
- `<uInt32/>`: Unsigned Int of 32 bits.
- `<uInt64/>`: Unsigned Int of 64 bits.
- `<int32/>`: Signed Int of 32 bits.
- `<int64/>`: Signed Int of 64 bits.
### Types: Strings ### Types: Strings
ASCII strings are pretty simple to read: Again, the decoder keeps reading the ASCII strings are pretty simple to read: Again, the decoder keeps reading the
@ -199,6 +207,8 @@ here.
Optional strings are Null when the first byte have a stop bit set and every Optional strings are Null when the first byte have a stop bit set and every
other bit is zero. other bit is zero.
In the template, a string field appears as `<string>`.
### Types: Sequences ### Types: Sequences
Sequences are basically arrays. The first field of a sequence is the "length" Sequences are basically arrays. The first field of a sequence is the "length"
@ -209,6 +219,20 @@ even include more sequences.
Optional sequences affect the way the length is read: If optional, the length Optional sequences affect the way the length is read: If optional, the length
should be treated as an optional Integer and thus the size is decremented by 1. should be treated as an optional Integer and thus the size is decremented by 1.
In the template, the sequence appears as `<sequence>`, with the length
following it. An example is
```xml
<sequence name="Sequence">
<length name="NoSequence" id="123"/>
</sequence>
```
{% note() %}
I describe most of the length fields with a name starting with "No". That's
because the FIX spec defines the lengths with that prefix.
{% end %}
### Types: Decimals ### Types: Decimals
Decimals are formed by two fields: Exponent and Mantissa. The way it works is Decimals are formed by two fields: Exponent and Mantissa. The way it works is
@ -227,6 +251,16 @@ Also, because Exponent and Mantissa are two fields, they can have different
operators. I'll show some examples after the Operator, mostly because I've seen operators. I'll show some examples after the Operator, mostly because I've seen
both with different operators and they make a mess to read. both with different operators and they make a mess to read.
In the template, the decimal field appears as `<decimal>`, with the exponent
and mantissa as internal fields.
```xml
<decimal name="ADecimal" id="123">
<exponent/>
<mantissa/>
</decimal>
```
### Type: Presence Map ### Type: Presence Map
Presence Maps are used in conjunction with operators. They are read like Presence Maps are used in conjunction with operators. They are read like
@ -280,6 +314,8 @@ dealing with the incoming value.
When a field have No Operator, there will be no bit in the Presence Map. When a field have No Operator, there will be no bit in the Presence Map.
All the previous examples of the template have no operator.
### Operator: Constant ### Operator: Constant
A field with the Constant operator will not appear in the incoming data and the A field with the Constant operator will not appear in the incoming data and the
@ -316,6 +352,14 @@ In a way, you can read this: Is the value present in the incoming data
otherwise, use the default value. otherwise, use the default value.
{% end %} {% end %}
Example
```xml
<uInt32 name="Type" id="3">
<default value="1"/>
</uInt32>
```
### Operator: Copy ### Operator: Copy
The copy operator indicates that the value for this record have the same value The copy operator indicates that the value for this record have the same value
@ -589,3 +633,5 @@ mandatory sequences.
- 2022-01-10: First release. - 2022-01-10: First release.
- 2022-01-10: Added information about the template versioning. - 2022-01-10: Added information about the template versioning.
- 2022-01-13: Added examples of the tags in the template for the field types
and examples for operators.

44
content/research/decoding-fast.pt.md

@ -1,6 +1,7 @@
+++ +++
title = "Decodificando o Protocolo FAST" title = "Decodificando o Protocolo FAST"
date = 2022-01-10 date = 2022-01-10
updated = 2022-01-13
[taxonomies] [taxonomies]
tags = ["finanças", "binário", "protocolo", "fix", "fast"] tags = ["finanças", "binário", "protocolo", "fix", "fast"]
@ -177,6 +178,13 @@ em 1. O motivo é que deve haver uma forma de diferenciar entre 0 e Null. Assim,
um inteiro que seja decodificado para 0 é, na verdade, Null; para obter o valor um inteiro que seja decodificado para 0 é, na verdade, Null; para obter o valor
0 num inteiro, é enviado o valor 1, que é decrementando por 1 e volta a zero. 0 num inteiro, é enviado o valor 1, que é decrementando por 1 e volta a zero.
No template, os campos aparecem como
- `<uInt32/>`: Inteiro sem sinal de 32 bits.
- `<uInt64/>`: Inteiro sem sinal de 64 bits.
- `<int32/>`: Inteiro com sinal de 32 bits.
- `<int64/>`: Inteiro sem sinal de 64 bits.
### Tipos: Strings ### Tipos: Strings
Strings em ASCII são bem simples de serem lidas: Novamente, o decodificador Strings em ASCII são bem simples de serem lidas: Novamente, o decodificador
@ -204,6 +212,8 @@ eu decidi não comentar aqui.
Strings opcionais são Null quando o primeiro byte tiver o bit de mais alta Strings opcionais são Null quando o primeiro byte tiver o bit de mais alta
ordem ligado e todos os demais desligados. ordem ligado e todos os demais desligados.
No template, um campo de string aparece como `<string>`.
### Tipos: Sequências ### Tipos: Sequências
Sequências são basicamente arrays. O primeiro campo de uma sequência é o Sequências são basicamente arrays. O primeiro campo de uma sequência é o
@ -215,6 +225,20 @@ Sequências opcionais afetam a forma como o campo de tamanho é lido: Se a
sequência é opcional, o tamanho deve ser tratado como um inteiro opcional e, sequência é opcional, o tamanho deve ser tratado como um inteiro opcional e,
portanto, decrementando em 1. portanto, decrementando em 1.
No template, a sequência aparece como `<sequence>`, com o tamanho logo depois.
Um exemplo é
```xml
<sequence name="Sequence">
<length name="NoSequence" id="123"/>
</sequence>
```
{% note() %}
Eu descrevo a maior parte dos campos de tamanho com um nome que começa com
"No". Isso é porque a especificação do FIX define os tamanhos com esse prefixo.
{% end %}
### Tipos: Decimais ### Tipos: Decimais
Decimais são formados por dois campos: Expoente e Mantissa. A forma como isso Decimais são formados por dois campos: Expoente e Mantissa. A forma como isso
@ -235,6 +259,16 @@ diferentes. Eu vou mostrar exemplos depois de explicar os Operadores,
principalmente porque eu vi os dois com operadores diferentes e a leitura é principalmente porque eu vi os dois com operadores diferentes e a leitura é
complicada. complicada.
No template, um campo decimal aparece como `<decimal>`, com o expoente e a
mantissa como campos internos.
```xml
<decimal name="ADecimal" id="123">
<exponent/>
<mantissa/>
</decimal>
```
### Tipo: Mapa de Presença ### Tipo: Mapa de Presença
Mapas de Presença são usados em conjunto com operadores. Eles são lidos da Mapas de Presença são usados em conjunto com operadores. Eles são lidos da
@ -328,6 +362,14 @@ pelo Mapa de Presença)? Leia o valor dos dados de entrada; caso contrário, use
o valor default. o valor default.
{% end %} {% end %}
Exemplo
```xml
<uInt32 name="Type" id="3">
<default value="1"/>
</uInt32>
```
### Operador: Copy ### Operador: Copy
O operador Copy (Cópia) indica que o valor deste campo neste registro tem o O operador Copy (Cópia) indica que o valor deste campo neste registro tem o
@ -602,6 +644,8 @@ Changelog:
- 2022-01-10: Primeira versão. - 2022-01-10: Primeira versão.
- 2022-01-10: Adicionada informações sobre o versionamento de templates. - 2022-01-10: Adicionada informações sobre o versionamento de templates.
- 2022-01-13: Adicionados exemplos das tags no template para os tipos de campos
e exemplos dos operadores.
<!-- <!--
vim:spelllang=pt: vim:spelllang=pt:

Loading…
Cancel
Save