Jump to content

Recommended Posts

Hello,

I had two questions regarding retrieving market price information:

1. I'm aware of the different endpoints to retrieve historical price data. However, it looks like these endpoints are designed to be called for one market at a time. My first question is: is there a way to retrieve price data for multiple markets with a single call? I worry about getting throttled if I'm calling /market/{MarketId}/barhistory 15+ times, for example.

2. I'm also aware that you can subscribe to multiple markets via the Prices stream - is there a limit to the number of markets that you can subscribe to on one stream?

Thanks,

Garrett

Share this post


Link to post

Hello,

1) No, we don't have any calls where the user can pull prices for multiple markets in a single call. Throttling generally occurs when there are a large number of calls within a short time frame: 500 calls within 5 seconds. If you are only calling 15 markets that should be fine.

2) It'll mainly be limited by your internet connection and computer hardware, since each market requires bandwidth and processing power from your PC. The more simultaneous subscriptions you have, the more resources will be used. 
If you have a fast modern PC and a broadband internet connection, you should be able to subscribe to dozens of markets simultaneously without too much of a probelem.

Kind Regards, PM

Share this post


Link to post

Great, that's good to know.

I'm assuming that throttling also applies to calls to the Order endpoints as well? I ask because I'm writing a method to close all open positions asynchronously, given certain sets of circumstances (if we're within x minutes/seconds of market close, for example).

Since these positions will presumably be for different markets, with different quantities, directions, etc, I assumed that I can't just stuff all the position ids into one call to order/newtradeorder. However, I'd still like to close all positions as quickly as possible - hence my plan was to queue up all the close orders and make the api calls asynchronously, as opposed to having to do them all one by one.

So, I guess this question is similar to my first: if I were to do that with (potentially) 10-15 open positions, is it likely that I could get throttled?

Thanks!

Share this post


Link to post

Yes, the throttle of 500 / 5 seconds is for any 500 calls. 10-15 positions should not generally cause an issue.

On our trading platforms we already do something similar when the users clicks the Close All button - this sends a close order for each each position via the API very similar to what you are looking to do.

Kind Regards, PM 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×