Heatbeats not comming when sending your own heartbeats

Created at 20 Sep 2021, 19:54
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
olegchubukov's avatar

olegchubukov

Joined 23.08.2019

Heatbeats not comming when sending your own heartbeats
20 Sep 2021, 19:54


Hi!

I see that the heartbet that usually comes every 30 secconds stopped coming after I started sending ProtoOAReconcileReq every 10 seconds to the API. Is it the right behaviour?

Thanks in advance!


@olegchubukov
Replies

amusleh
21 Sep 2021, 08:33

RE:

olegchubukov said:

Hi!

I see that the heartbet that usually comes every 30 secconds stopped coming after I started sending ProtoOAReconcileReq every 10 seconds to the API. Is it the right behaviour?

Thanks in advance!

Hi,

You shouldn't use ProtoOAReconcileReq to keep your app up to date with account orders, use it only once and then use execution event to remove/modify/add new account orders.

Regarding Heatbeats, its a response to sending heartbeat, if you don't send any heartbeat you will not receive back an heartbeat message.

You should use a queue to send messages on a specific time interval so you will not reach maximum allowed messages number per second, otherwise you will receive an error message.

Please check our WPF sample code, there we have all of what I just said.


@amusleh

olegchubukov
21 Sep 2021, 10:07 ( Updated at: 21 Sep 2021, 10:08 )

RE: RE:

amusleh said:

Hi,

You shouldn't use ProtoOAReconcileReq to keep your app up to date with account orders, use it only once and then use execution event to remove/modify/add new account orders.

Regarding Heatbeats, its a response to sending heartbeat, if you don't send any heartbeat you will not receive back an heartbeat message.

You should use a queue to send messages on a specific time interval so you will not reach maximum allowed messages number per second, otherwise you will receive an error message.

Please check our WPF sample code, there we have all of what I just said.

Well, I need to start with saying that I was accidently sending ProtoOAReconcileReq instead of ProtoHeartbeatEvent. Copy/paste... My bad. Is it that's why you commented about ProtoOAReconcileReq?

I have now changed my scheduler to send ProtoHeartbeatEvent and I see ProtoHeartbeatEvent comes every 30 secs again.

But you said that "if you don't send any heartbeat you will not receive back an heartbeat message." This is not true on my side. Even if I dont send a hearbeat, I still receive ProtoHeartbeatEvent every 30 seconds for some period. Sometimes it's 5 minutes, sometimes a couple of hours. But my key point is that ProtoHeartbeatEvent comes without me sending ProtoHeartbeatEvent.

Regarding exceeding the limits, I dont send that many messages to be able to exceed the limits. My application only listens for events.

What is WPF? Is it this source https://github.com/spotware/ctrader-open-api-v2-java-example? If so, that was exactly the code I used.


@olegchubukov

amusleh
21 Sep 2021, 10:46

RE: RE: RE:

olegchubukov said:

amusleh said:

Hi,

You shouldn't use ProtoOAReconcileReq to keep your app up to date with account orders, use it only once and then use execution event to remove/modify/add new account orders.

Regarding Heatbeats, its a response to sending heartbeat, if you don't send any heartbeat you will not receive back an heartbeat message.

You should use a queue to send messages on a specific time interval so you will not reach maximum allowed messages number per second, otherwise you will receive an error message.

Please check our WPF sample code, there we have all of what I just said.

Well, I need to start with saying that I was accidently sending ProtoOAReconcileReq instead of ProtoHeartbeatEvent. Copy/paste... My bad. Is it that's why you commented about ProtoOAReconcileReq?

I have now changed my scheduler to send ProtoHeartbeatEvent and I see ProtoHeartbeatEvent comes every 30 secs again.

But you said that "if you don't send any heartbeat you will not receive back an heartbeat message." This is not true on my side. Even if I dont send a hearbeat, I still receive ProtoHeartbeatEvent every 30 seconds for some period. Sometimes it's 5 minutes, sometimes a couple of hours. But my key point is that ProtoHeartbeatEvent comes without me sending ProtoHeartbeatEvent.

Regarding exceeding the limits, I dont send that many messages to be able to exceed the limits. My application only listens for events.

What is WPF? Is it this source https://github.com/spotware/ctrader-open-api-v2-java-example? If so, that was exactly the code I used.

Here is our WPF sample: OpenAPI.Net/src/WPF.Sample at master · spotware/OpenAPI.Net (github.com)


@amusleh

olegchubukov
21 Sep 2021, 14:57

RE: RE: RE: RE:

amusleh said:

olegchubukov said:

amusleh said:

Hi,

You shouldn't use ProtoOAReconcileReq to keep your app up to date with account orders, use it only once and then use execution event to remove/modify/add new account orders.

Regarding Heatbeats, its a response to sending heartbeat, if you don't send any heartbeat you will not receive back an heartbeat message.

You should use a queue to send messages on a specific time interval so you will not reach maximum allowed messages number per second, otherwise you will receive an error message.

Please check our WPF sample code, there we have all of what I just said.

Well, I need to start with saying that I was accidently sending ProtoOAReconcileReq instead of ProtoHeartbeatEvent. Copy/paste... My bad. Is it that's why you commented about ProtoOAReconcileReq?

I have now changed my scheduler to send ProtoHeartbeatEvent and I see ProtoHeartbeatEvent comes every 30 secs again.

But you said that "if you don't send any heartbeat you will not receive back an heartbeat message." This is not true on my side. Even if I dont send a hearbeat, I still receive ProtoHeartbeatEvent every 30 seconds for some period. Sometimes it's 5 minutes, sometimes a couple of hours. But my key point is that ProtoHeartbeatEvent comes without me sending ProtoHeartbeatEvent.

Regarding exceeding the limits, I dont send that many messages to be able to exceed the limits. My application only listens for events.

What is WPF? Is it this source https://github.com/spotware/ctrader-open-api-v2-java-example? If so, that was exactly the code I used.

Here is our WPF sample: OpenAPI.Net/src/WPF.Sample at master · spotware/OpenAPI.Net (github.com)

I was sending a heartbeat every 10 seconds, but connection was lost after two hours and ProtoHeartbeatEvent stopped coming from the API.

 

Is something wrong in the setup or is this a normal behaviour and I just need to reconnect the netty client?


@olegchubukov