Are Concurrent API Calls possible?

Created at 04 Sep 2017, 16:42
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!
CT

ctid320188

Joined 19.04.2017

Are Concurrent API Calls possible?
04 Sep 2017, 16:42


Hi,

Does the connect/tradingaccounts api allow concurrent api calls from a single source?

I am trying to async multi thread call the connect/tradingaccounts api but they seem to always come back in a regular timeframes suggesting they are not being processed concurrently.

I have some code that tries to call: 

connect/tradingaccounts/11111/positions?oauth_token=xxxx

connect/tradingaccounts/22222/positions?oauth_token=xxxx

connect/tradingaccounts/33333/positions?oauth_token=xxxx

all at the same time but the results seem to come back staggered every 2 seconds rather than all coming back more or less together. is this something that is built into the API to prevent this?

Thank you


@ctid320188
Replies

Spotware
04 Sep 2017, 16:51

Dear Trader,

To avoid abuse of the Accounts API there is a limitation of one request per two seconds. Please see here

Best Regards,

cTrader Team


@Spotware

ycomp
17 Oct 2017, 12:50

i get several 429s but I specifically added code that limits requests to no more than once every 2 seconds and by watching my log statements it looks like my rate-limiting code works (i.e. limits to at least 2 seconds between calls)

So is it possible to still get this HTTP response even if I'm doing that? There's a chance I might have overlooked something in my code but I really think I implemented the rate limiting correctly.


@ycomp

PanagiotisCharalampous
17 Oct 2017, 14:33

Hi ycomp,

Our request limit has been updated to 30 req/min so probably that is not the reason. Please check if you are exceeding this limit in any way.

Best Regards,

Panagiotis


@PanagiotisCharalampous