composite types
Closed this issue · 1 comments
Hello!
I have question about difference between composite type, group and message.
But first thank you for this awesome project!
Can I make shorter a schema contains an entity which I want to be able to send as a message, as a part of another message or as a group.
For example I have an asset. In java classes it will be something like this
public class Asset {
char[] isin;
char[] name;
}Obviously I should able to send asset as message.
But asset can be part of quotation
public class Quotation {
double quotation;
Asset asset;
}and a clients portfolio contains a list of assets
public class Portfolio {
char[] portrolioName;
Collection<Asset> assets;
}if I right understood my schema will be something like this:
<types>
<composite name="groupSizeEncoding" description="Repeating group dimensions">
<type name="blockLength" primitiveType="uint16"/>
<type name="numInGroup" primitiveType="uint16"/>
</composite>
</types>
<types>
<type name="str" primitiveType="char" length="12"/>
<type name="quote" primitiveType="double"/>
<composite name="AssetType">
<type name="isin" primitiveType="char" length="3"/>
<type name="name" primitiveType="char" length="3"/>
</composite>
</types>
<sbe:message name="Asset" id="1">
<field name="isin" id="1" type="str"/>
<field name="name" id="2" type="str"/>
</sbe:message>
<sbe:message name="Quotation" id="2">
<field name="quotation" id="1" type="quote"/>
<field name="asset" id="2" type="AssetType"/>
</sbe:message>
<sbe:message name="Portfolio" id="3">
<field name="portrolioName" id="1" type="str"/>
<group name="assets" id="2" dimensionType="groupSizeEncoding">
<field name="isin" id="1" type="str"/>
<field name="name" id="2" type="str"/>
</group>
</sbe:message>
In this schema fields isin and name repeats 3 times. Can I create a schema a little bit shorter?
Note that this is only example I know there is better way for this task.
It might be better to ask this question on the SBE spec repo. We are providing an implementation.
https://github.com/FIXTradingCommunity/fix-simple-binary-encoding