Query Performance
ntrous opened this issue · comments
Getting historical data takes much longer than getting the historical data through postman. Is there any way of increasing the speed for this?
It is particularly obvious when querying for many symbols.
I don't know postman at all. is it this tool: Postman ?
How much longer it takes ?
What I can notice in my application is that the first query threw Yahoo Api takes a little bit longer (due to fetching cookie & curl) the next request are quite fast. (when working on same process without disposing the previous api context obj so cookie & curl could be reused)
@delvier Yes that's the Postman im talking about.
Postman request is about 300ms whereas the library is taking anywhere from 500ms to 1second.
Whats the optimum lifetime for a class using this library? I currently use a single class to handle calling this library and that class is a Scoped instance so only lasting for the request. Would it be of greater performance to be a singleton for the lifetime of the application?
@ntrous
I wonder how exactly you calling the query. Is it console application or GUI ?
The yahoo client have internal singleton already implemented - it's flurl client obj. which is main caller for all post requests.
I believe your postman query have already Curl within your URI request so it's 1 request, whereas the Yahoo have to obtain that Cookie&Curl for the first accessed query.
Well I believe there is no need for special management of life cycle of your class because you use Singleton indirectly by using this library.
I performed UnitTest - the first query around 1s. second 470ms.
Query Code:
var dataList = _sut.GetPrice("INTC", new DateTime(2015, 1, 2), DateTime.Today);
var dataList2 = _sut.GetPrice("INTC", new DateTime(2015, 1, 2), DateTime.Today
@delvier I'm using this library for a website where i'm doing some complex calculations and when there are many Symbols to lookup each query taking 500ms to 1sec is starting to add up a lot. Even when running them async it's taking some time.
I may have to take a look at the source code myself and see if I can perform any optimisations.
@ntrous
Strange that each query takes the same in case of web application.
I'm newbie to web application but maybe someone can clear it out.
I'm able to query 1000 symbols within 1 minute. (which is fast enough for my needs)
Each query ask for 2 years of historical data.
Using my WPF desktop application and default parallel approach.
I just submitted a pull request which should improve historical data retrieval performance.
Is this fix in the latest 2.0.0 version on nuget?
Yes, the latest code is in the latest nuget package, version 2.0.0.
It definitely looks to be a bit quicker. an operation I'm running that takes roughly 8 seconds is now taking 7 seconds, so that's something!