question

Upvotes
Accepted
3 0 0 2

[EMA API] Nondeterministic values during contribution to RICs in ATS

Hello,

I have a strange problem when I contribute data to RICs on ATS using EMA API. Sometimes data on 1 (or even more) RICs are incorrect/mixed - diffrent from values I sent to ATS via PostMsg. I noticed the problem occurs only during 2-nd, or more contribution to there RICs - during first contribution I haven't seen this error yet.

I open a stream (LOGIN) only once when service starting and send all PostMsgs to that stream one by one. Is it possible it is the problem and in some cases value are mixed on stream? In addition I have only one instance of OMMConsumer for LOGIN stream to contribute data and other streams to collect data from RICs.

Below I attach a part of my source code, and log describing the problem.

Code:

var postMsg = new PostMsg();
var nestedRefreshMsg = new UpdateMsg();

int serviceId = _marketDataSettings.ServiceId;
int peOperator = AuthorizationLock.OperatorEnum.AND;
var peList = new List<uint> { _marketDataSettings.PPE };

var authLock = new AuthorizationLock(serviceId, peOperator, peList);
var lockData = new AuthorizationLockData();
var lockStatus = new AuthorizationLockStatus();
var lockResult = authLock.GetLock(lockData, lockStatus);
if (lockResult != AuthorizationLockData.LockResultEnum.LOCK_SUCCESS)
{
    authLock.Dispose();
}

var permissionBuffer = new EmaBuffer(lockData.LockData, 0, lockData.Size);

var nestedFieldList = new FieldList();
foreach (var field in fields)
{
    if (field.Value is decimal)
    {
        decimal? val = field.Value as decimal?;
        if (val.HasValue)
        {
            _logger.LogInformation($"Contributing value {val} to RIC {ric}");
            nestedFieldList.AddReal(field.Key, (long)(val.Value * 100), MagnitudeTypes.EXPONENT_NEG_2);
        }
    }
}
nestedFieldList.Complete();

nestedRefreshMsg.Payload(nestedFieldList);
                        

postMsg.PermissionData(permissionBuffer);
postMsg.PostId(_postId++)
    .ServiceName(serviceName)
    .Name(ric)
    .SolicitAck(true)
    .Complete(true)
    .Payload(nestedRefreshMsg)

 _consumer.Submit(postMsg, _handleSendId.Value)


Log:

2024-03-20 17:05:37.0722|INFO|Contributing value 5.62000 to RIC GTRWIPLNSW=
2024-03-20 17:05:37.2097|INFO|AckMsg
    streamId="1"
    domain="MarketPrice Domain"
    ackId="19"
    text="[2]: Contribution Partially Accepted"
    name="GTRWIPLNSW="
    nameType="1"
    serviceId="258"
    Payload dataType="NoData"
        NoData
        NoDataEnd
    PayloadEnd
AckMsgEnd

2024-03-20 17:05:37.2097|INFO|PowerRates.MarketData.MarketData.MarketDataHandler|UpdateMsg
    streamId="15"
    domain="MarketPrice Domain"
    updateTypeNum="0"
    name="GTRWIPLNSW="
    serviceId="258"
    serviceName="DTS"
    Payload dataType="FieldList"
        FieldList
            FieldEntry fid="16" name="TRADE_DATE" dataType="Date" value="20 MAR 2024 "
            FieldEntry fid="5" name="TIMACT" dataType="Time" value="16:05:37:115:000:000"
            FieldEntry fid="393" name="PRIMACT_1" dataType="Real" value="5.65"
            FieldEntry fid="875" name="VALUE_DT1" dataType="Date" value="20 MAR 2024 "
            FieldEntry fid="1010" name="VALUE_TS1" dataType="Time" value="16:05:37:115:000:000"
            FieldEntry fid="2672" name="A_LEVEL_1" dataType="UInt" value="(blank data)"
            FieldEntry fid="2673" name="A_LEVEL_2" dataType="UInt" value="(blank data)"
        FieldListEnd
    PayloadEnd
UpdateMsgEnd

As you can see above, I sent value 5.62 to field PRIMACT_1, received ACK and then received UpdateMsg with value 5.65. I sent values to 8 RICs one by one in 1 second deay between each contribution.

Do you have any idea, what is the problem? I would be grateful for your help.

Best regards.

#technologyema-apiricscontributionsATS
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hello @kowalikw

Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?


If so please can you click the 'Accept' text next to the appropriate reply? This will guide all community members who have a similar question.

Thanks,


AHS

Upvotes
Accepted
24.7k 54 17 14

Hello @kowalikw

Alternatively, you may submit this issue to the RTSDK team via the GitHub - Issue page.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
79.2k 251 52 74

@kowalikw

Thank you for reaching out to us.

I tried to replicate this issue by posting that value with the following code.

Decimal? val = Decimal.Parse("5.62000");
Console.WriteLine($"Contribute {val.Value}");
...
nestedFieldList.AddReal(22, (long)(val.Value * 100), MagnitudeTypes.EXPONENT_NEG_2);

Then, I enabled the XmlTraceToStdout configuration in the EMA configuation file (EmaConfig.xml) to verify the incoming and outgoing messages.

    <ConsumerList>
        <Consumer>
            <Name value="Consumer_1"/>
            <Channel value="Channel_1"/>
            <Logger value="Logger_1"/>
            <Dictionary value="Dictionary_2"/>
            <XmlTraceToStdout value="1"/>
        </Consumer>

The post message in the trace file is:

<POST domainType="MARKET_PRICE" streamId="1" containerType="MSG" flags="0x66 (HAS_POST_ID|HAS_MSG_KEY|POST_COMPLETE|ACK)" postId="1" postUserId="0" postUserAddr="0.0.0.0" dataSize="35">
        <key flags="0x03 (HAS_SERVICE_ID|HAS_NAME)" serviceId="5000" name="TRI.N"/>
        <dataBody>
                <UPDATE domainType="MARKET_PRICE" streamId="0" containerType="FIELD_LIST" flags="0x00" updateType="0" dataSize="24">
                        <dataBody>
                                <fieldList flags="0x08 (HAS_STANDARD_DATA)">
                                        <fieldEntry fieldId="22" data="0C02 32"/>
                                        <fieldEntry fieldId="25" data="0F23"/>
                                        <fieldEntry fieldId="18" data="0B1D 1E"/>
                                        <fieldEntry fieldId="37" data="03"/>
                                </fieldList>
                        </dataBody>
                </UPDATE>
        </dataBody>
</POST>

The consumer retrieved the following data.

<UPDATE domainType="MARKET_PRICE" streamId="3" containerType="FIELD_LIST" flags="0x200 (HAS_POST_USER_INFO)" updateType="0" postUserId="0" postUserAddr="0.0.0.0" dataSize="24">
        <dataBody>
                <fieldList flags="0x08 (HAS_STANDARD_DATA)">
                        <fieldEntry fieldId="22" data="0C02 32"/>
                        <fieldEntry fieldId="25" data="0F23"/>
                        <fieldEntry fieldId="18" data="0B1D 1E"/>
                        <fieldEntry fieldId="37" data="03"/>
                </fieldList>
        </dataBody>
</UPDATE>
Received Update. Item Handle: 2 Closure: LSEG.Ema.Access.OmmConsumer
Item Name: TRI.N
Service Name: DIST_CACHE
Fid: 22 Name = BID DataType: Real Value: 5.62
Fid: 25 Name = ASK DataType: Real Value: 350
Fid: 18 Name = TRDTIM_1 DataType: Time Value: 11:29:30:0
Fid: 37 Name = DIVIDENDTP DataType: Enum Value: +X

To verify what the problem is, please enable the XmlTraceToStdout configuration in the EMA configuation file (EmaConfig.xml) to verify the incoming and outgoing messages.

If the post message is correct, the problem could be on the server side (RTDS or ATS).

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
3 0 0 2

I turned on XmlTraceToStdout and I guess we have a problem inside LSEG EMA library. I pass one value to FieldList using method AddReal, but when message is complete and it is sending to ATS, the value in the field i diffrent. I attach parts of logs below:

2024-03-22 14:37:41.9396|INFO|Contributing value 5,66000 to RIC GTRWIPLN3M=
2024-03-22 14:37:42.0420|INFO|UpdateMsg
    streamId="18"
    domain="MarketPrice Domain"
    updateTypeNum="0"
    name="GTRWIPLN3M="
    serviceId="258"
    serviceName="DTS"
    Payload dataType="FieldList"
        FieldList
            FieldEntry fid="16" name="TRADE_DATE" dataType="Date" value="22 MAR 2024 "
            FieldEntry fid="5" name="TIMACT" dataType="Time" value="13:37:41:983:000:000"
            FieldEntry fid="393" name="PRIMACT_1" dataType="Real" value="5,65"
            FieldEntry fid="875" name="VALUE_DT1" dataType="Date" value="22 MAR 2024 "
            FieldEntry fid="1010" name="VALUE_TS1" dataType="Time" value="13:37:41:983:000:000"
            FieldEntry fid="2672" name="A_LEVEL_1" dataType="UInt" value="(blank data)"
            FieldEntry fid="2673" name="A_LEVEL_2" dataType="UInt" value="(blank data)"
        FieldListEnd
    PayloadEnd
UpdateMsgEnd

And trace from XmlTrace:

<!-- 22.03.2024 14:37:41 -->

<!-- rwfMajorVer="14" rwfMinorVer="1" -->
<POST domainType="MARKET_PRICE" streamId="1" containerType="MSG" flags="0xE6 (HAS_POST_ID|HAS_MSG_KEY|POST_COMPLETE|ACK|HAS_PERM_DATA)" postId="85" permData="0301 0230 00C0" postUserId="0" postUserAddr="0.0.0.0" dataSize="25">
        <key flags="0x03 (HAS_SERVICE_ID|HAS_NAME)" serviceId="258" name="GTRWIPLN3M="/>
        <dataBody>
                <REFRESH domainType="MARKET_PRICE" streamId="0" containerType="FIELD_LIST" flags="0x40 (REFRESH_COMPLETE)" groupId="0" state="State: Open/Ok/None - text: ''" dataSize="9">
                        <dataBody>
                                <fieldList flags="0x08 (HAS_STANDARD_DATA)">
                                        <fieldEntry fieldId="393" data="0C 0235"/>
                                </fieldList>
                        </dataBody>
                </REFRESH>
        </dataBody>
</POST>

As you can see in trace we have wrong value. So now we are sure it is not a problem with server side (ATS, etc.)

Do you have any idea for workaruond? Should I create always new instance of consumer to send data to RIC instead using one instance, which lifetime is service lifetime?

Thanks.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
79.2k 251 52 74

@kowalikw

It coud be the problem in the application or EMA.

You should have one instance of consumer to send data.

As this forum is aimed at answering "how to" types of questions about using Refinitiv APIs, to investigate this kind of issue, please contact the API support team direclty via Contact Premium Support. If you didn't see the Contact Premium Support, please contact your LSEG account team or Sales team regardig the API Premium Support.

The API support team can verify if it is the problem in the application or EMA.


icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
3 0 0 2

Ok, thank you for your responses.


Best regards.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.