Need clarification on GetTickData
Need clarification on GetTickData
04 Jul 2020, 08:34
Hi, I have some questions with regard to GetTickData request and response. It would be great to have definitive answers. Thank you.
1. In request for tick data type field is BID or ASK. And returned data is for bids or ask side of the transactions only, which means that in response we get only half of transactions for requested period (approximately) .
However, GetTickData definition says type is repeated.
repeated ProtoOAQuoteType type Bid/Ask (1/2).
Does it mean we can submit BID - ASK types in the same message simultaneously to get full set of tick data, not just half? Is it possible to do? How we can do it?
2. The response message length is limited to chunkSize and message could be repeated if necessary. Is it possible to request maximum tick data in one message, like for a two or tree years period? How should I handle repeated message? Does OpenAPI library handle it?
Replies
MZen
06 Jul 2020, 13:46
RE:
PanagiotisCharalampous said:
Hi MZen,
1) You can add two types to the message. In C# it would look like this
var _msg = ProtoOAGetTickDataReq.CreateBuilder(); _msg.SetCtidTraderAccountId(accountId); _msg.SetSymbolId(symbolId); _msg.SetType(ProtoOAQuoteType.ASK); _msg.SetType(ProtoOAQuoteType.BID); _msg.SetFromTimestamp(from); _msg.SetToTimestamp(to);
2) ProtoOAGetTickDataRes has a hasMore field. If this is set to true, it means more messages are following. There is nothing you need to do, just read the next messages until hasMore becomes false.
Best Regards,
Panagiotis
1) Thank you, I will try this.
2) I just do not see hasMore in MessagesFactory:
public ProtoMessage CreateTickDataResponse(string clientMsgId = null)
{
return CreateMessage((uint)ProtoOAPayloadType.PROTO_OA_GET_TICKDATA_RES, ProtoOAGetTickDataRes.CreateBuilder().Build().ToByteString(), clientMsgId);
}
Could you clarify it, please.
@MZen
PanagiotisCharalampous
06 Jul 2020, 14:09
Hi MZen,
It is a property of the message. See below
Best Regards,
Panagiotis
@PanagiotisCharalampous
MZen
12 Jul 2020, 16:15
RE:
PanagiotisCharalampous said:
Hi MZen,
2) ProtoOAGetTickDataRes has a hasMore field. If this is set to true, it means more messages are following. There is nothing you need to do, just read the next messages until hasMore becomes false.
Best Regards,
Panagiotis
Could you please elaborate on how I should read more messages? In the Sample project we have Listener tread, so do you mean I have to watch for more messages as output of Listener?
Yet, there is only one message going in response to TickData Request. Only one and it has HasMore = true. However no other messages follows.
I am lost here. Forgive my inexperience.
@MZen
PanagiotisCharalampous
13 Jul 2020, 09:35
Hi MZen,
Could you please elaborate on how I should read more messages? In the Sample project we have Listener tread, so do you mean I have to watch for more messages as output of Listener?
Yes this is correct. The example project is already programmed to do so.
Best Regards,
Panagiotis
@PanagiotisCharalampous
MZen
13 Jul 2020, 13:10
RE:
PanagiotisCharalampous said:
Hi MZen,
Could you please elaborate on how I should read more messages? In the Sample project we have Listener tread, so do you mean I have to watch for more messages as output of Listener?
Yes this is correct. The example project is already programmed to do so.
Best Regards,
Panagiotis
So, why there is only one message (10000 ticks) and no more messages? First message has HasMore=true.
Thank you.
@MZen
PanagiotisCharalampous
13 Jul 2020, 14:22
Hi MZen,
You are right, my response above was not correct. When the hasMore flag is set to true, it means that the number of records by filter is larger that the ones returned by the message. Therefore you will need to manually request for the rest or break your queries into requests with smaller sizes.
Best Regards,
Panagiotis
@PanagiotisCharalampous
MZen
13 Jul 2020, 15:15
RE:
PanagiotisCharalampous said:
Hi MZen,
You are right, my response above was not correct. When the hasMore flag is set to true, it means that the number of records by filter is larger that the ones returned by the message. Therefore you will need to manually request for the rest or break your queries into requests with smaller sizes.
Best Regards,
Panagiotis
Got it!
Thanks
@MZen
ctid2032775
08 Sep 2020, 10:19
RE:
PanagiotisCharalampous said:
Hi MZen,
1) You can add two types to the message. In C# it would look like this
var _msg = ProtoOAGetTickDataReq.CreateBuilder(); _msg.SetCtidTraderAccountId(accountId); _msg.SetSymbolId(symbolId); _msg.SetType(ProtoOAQuoteType.ASK); _msg.SetType(ProtoOAQuoteType.BID); _msg.SetFromTimestamp(from); _msg.SetToTimestamp(to);
2) ProtoOAGetTickDataRes has a hasMore field. If this is set to true, it means more messages are following. There is nothing you need to do, just read the next messages until hasMore becomes false.
Best Regards,
Panagiotis
Hi Panagiotis,
maybe I'm just to silly to finally get it but for me this is still not 100% clear...
In my application I send a request for tick data for a specific time frame and with both types (ASK, BID) as mentioned above. The received response contains a list of ticks:
Tick: 118063 EURUSD
Timestamp: 1599549334585
Tick: -1 EURUSD
Timestamp: -3807
Tick: -1 EURUSD
Timestamp: -234
Tick: -1 EURUSD
Timestamp: -543
This means 1st tick is at the given timestamp with value is 1.18063 (118063 / 100000) for EURUSD, right?
But how is it possible to get the information if this is the ASK price or the BID price?
Many thanks and regards,
Christian
@ctid2032775
PanagiotisCharalampous
08 Sep 2020, 11:43
Hi Christian,
You can't so if you need to distinguish them, it would be better to request them separately.
Best Regards,
Panagiotis
@PanagiotisCharalampous
ctid2032775
08 Sep 2020, 12:45
RE:
PanagiotisCharalampous said:
Hi Christian,
You can't so if you need to distinguish them, it would be better to request them separately.
Best Regards,
Panagiotis
Hi Panagiotis,
thanks for your reply even if this is a little bit inconvinient as (tick) spots are mostly containing both (ASK, BID)...
As sometimes either ASK or BID and sometimes both values are present at the same timestamp it will be quite laborious to join it - do you have an idea how this could be done in an easy way?
Thanks and regards,
Christian
@ctid2032775
PanagiotisCharalampous
08 Sep 2020, 12:49
Hi Christian,
You should create your own structures that will host the information and have fields that your determine the type of the tick. Then just merge all information in one list and sort it by timestamp.
Best Regards,
Panagiotis
@PanagiotisCharalampous
ctid2032775
08 Sep 2020, 13:02
RE:
PanagiotisCharalampous said:
Hi Christian,
You should create your own structures that will host the information and have fields that your determine the type of the tick. Then just merge all information in one list and sort it by timestamp.
Best Regards,
Panagiotis
Thanks again!
@ctid2032775
PanagiotisCharalampous
06 Jul 2020, 09:07
Hi MZen,
1) You can add two types to the message. In C# it would look like this
2) ProtoOAGetTickDataRes has a hasMore field. If this is set to true, it means more messages are following. There is nothing you need to do, just read the next messages until hasMore becomes false.
Best Regards,
Panagiotis
Join us on Telegram
@PanagiotisCharalampous