I am running an automated script that pulls real-time data as well as historic data. I've noticed however that when using get_timeseries, it is much slower than get_data (almost instant) even if I set the time period such that only one datapoint is retrieved.
Any advice on how to speed it up? The script I am running needs to finish within a few seconds, but the get_timeseries function is slowing it down significantly.
It is what it is. I guess it's fair to say that get_data method returns real-time market data faster than get_timeseries method. There are certainly reasons for that, which include real-time market data being closer and more ready available to the Web service that delivers it vs. timeseries of price history as well as a more flat data model for real-time market data vs. timeseries. From the client application side there's not much you can do to speed up the retrieval of timeseries data. Pretty much the only variable you have to play with is the number of RICs in the request. It would certainly be faster to retrieve timeseries for several instruments in one request than in a loop one RIC at a time. What the optimum number of RICs per request is can only be established empirically.
The only other recommendation I can think of is the obvious: limit your data requests to only the data you require.